我正在尝试根据官方文件打开现有的pouchdb数据库:
var db = new PouchDB('table_db');
,我也检查谷歌chrome离线存储每次我打开'table_db'作为:
navigator.webkitTemporaryStorage.queryUsageAndQuota (
function(usedBytes, grantedBytes) {
console.log('we are using ', usedBytes, ' of ', grantedBytes, 'bytes');
},
function(e) { console.log('Error', e); }
);
,多次刷新后我得到的是:
we are using 26234 of 2629807161 bytes
we are using 26422 of 2629806901 bytes
we are using 26610 of 2629806926 bytes
...
我的适配器是'indexeddb',我使用chrome作为我的目标浏览器。它可能超过了我担心的极限,我该怎么办呢?
Chrome中索引DB实现的后台存储是leveldb,它允许通过将数据附加到日志中,然后偶尔将数据压缩到各种表文件并消除旧数据来实现高数据吞吐量。每次访问都会向日志写入最少量的数据,这就是您所看到的。在某些时候,压缩算法将启动并回收未使用的空间。