query re: browser CacheStorage datastore
SignpostMarv opened this issue · comments
so there's a quirk in chrome (and probably other chromium-based browsers?) where removing an idb/clearing site data doesn't release all the storage spaced used up by the idb.
on the other hand, CacheStorage.delete seems to release as soon as the promise has resolved.
as I'm not overly familiar with how the idb implementation behaves, I'm wondering whether it'd be practical to store all data under CacheStorage, or just some of it?
for ref. I'm currently caching ipfs.cat
responses in CacheStorage for the ever-so-slightly snappier resolution of an mfs address to a blob url (i.e. no need to async-iterate for each file on every page load).
If you wrote a interface-datastore compatible datastore-cachestorage
module (just extend the adapter), you could plug it in to the repo config in a way similar to datastore-s3:
const CacheStore = require('datastore-cachestorage') // <-- you need to write this module
const IPFS = require('ipfs')
const IPFSRepo = require('ipfs-repo')
const node = IPFS.create({
repo: new IPFSRepo({
storageBackends: {
root: CacheStore,
blocks: CacheStore,
keys: CacheStore,
datastore: CacheStore
}
})
})
I've no idea how suitable CacheStorage would be for use as a general-purpose data store, my guess is not very.
I've no idea how suitable CacheStorage would be for use as a general-purpose data store, my guess is not very.
I would be thinking using it only for actual file data, since typically that's the biggest contributor to "idb doesn't free up storage space right away" being an actual issue.
Closing this as it's not an issue with js-ipfs-repo.