3 ms·
One thing I don't see called out as an option: CacheStorage (window.caches). Just store your data as Response. Fast, easy, available in Worker scope...
by dccoolgai 5y ago
One thing I don't see called out as an option: CacheStorage (window.caches). Just store your data as Response. Fast, easy, available in Worker scope...
- throwanem 5y agoNot apparently all that durable, though, especially when you hit the storage limit.
- tehbeard 5y agoDoesn't solve rich data though as neatly as IndexedDB does. Because IndexedDB uses structured clone, it can store javascript data as is, which includes storing correctly a number of interesting/useful types, including ArrayBuffers, Files/Blobs, CryptoKey instances (useful to avoid needing export flag on them), the cost of this is the performance hit compared to JSON.parse on a string. Also the cache is less persistent than IndexedDB when storage pressure increases.