I'm using an IndexedDB for saving game data in Chrome.
An average game is about 4MB. After saving a few games, and then deleting them, the dev console's 'Resources' tab shows that my indexedDB is empty, as expected, but if I go to content settings, "Cookies and site data" it's showing me roughly 12MB as the indexedDB size on disk.
This is a after a refresh and even a restart of Chrome. The following is my code for deletion and I'm getting success when I delete and a query for the old data returns nothing, as expected.
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);
};
};
I've checked the following questions (and search results aren't showing anything too promising either):
But none of them deal with my question, any and all help very much appreciated.
Chrome doesn't immediately delete the data from disk, it is just marked deleted. If you write ~4 more megabytes to IndexedDB, LevelDB will do a compaction and the files containing the old entries will be deleted.
Chrome has no 50mb limit and will not ever ask for user permission for IndexedDB.
This question may be helpful. What are the storage limits for the Indexed DB on Google's Chrome browser?
Why are you worrying?
OS and Browser may take holistic approach to optimize user experience. Storage is one of them. In most situation, rather than deleting, marked them as deleted are more efficient.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With