我使用IndexedDB在Chrome中保存遊戲數據。爲什麼空的IndexedDB仍佔用空間?
平均遊戲大概是4MB。保存了幾個遊戲然後刪除它們後,開發控制檯的「資源」選項卡顯示我的indexedDB是空的,但如果我轉到內容設置「Cookies和網站數據」,它將顯示大約12MB的索引數據庫磁盤大小。
這是一個之後刷新,甚至重新啓動的鉻。以下是我的刪除代碼,當我刪除並且舊數據的查詢不會返回任何內容時,我會獲得成功。
database.indexedDB.deleteGame = function(nameIn){
var db = database.indexedDB.db;
var trans = db.transaction(["saves"], "readwrite");
var store = trans.objectStore("saves");
var wipeSlate = store.delete(nameIn);
wipeSlate.onsuccess = function(e) {
console.log("Old game wiped");
};
wipeSlate.onerror = function(e) {
console.log("I don't think the old game existed..." + e);
};
};
我檢查以下問題(和搜索結果沒有顯示任何東西太有前途):
- Why does an empty database take megabytes of space
- Does an empty field take up space in a database
- IndexedDB deleteDatabase does not reset version
- I seem to be getting a dirty read from an IndexedDB index. Is this possible?
但他們都沒有處理我的的問題,任何和所有的幫助非常感謝。
感謝您的澄清和鏈接。 – agryson 2013-04-08 15:26:20