每次我打开一个现有的索引数据库(通过 pouchdb)时,少量数据(188 或 161 字节)会附加到我的离线存储数据 google chrome

Every time i open an existing indexed db(via pouchdb), small amount of data(188 or 161 bytes) is appended to my offline storage data in google chrome

我正在尝试根据 official documents 打开一个现有的 pouchdb 数据库:

var db = new PouchDB('table_db');

而且我每次打开 'table_db' 时都会检查 google chrome 离线存储:

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 中索引数据库实现的后备存储是 leveldb,它通过将数据附加到日志然后偶尔将数据压缩到各种 table 来实现高数据吞吐量] 文件并消除旧数据。每次访问都会将最少量的数据写入日志,这就是您所看到的。在某些时候,压缩算法将启动并回收未使用的 space.