storage icon indicating copy to clipboard operation
storage copied to clipboard

Allow all storage types to expire, not just cookies

Open davidsgrogan opened this issue 10 years ago • 12 comments

I could imagine this being done at the box level.

I've heard this requested a few times over the years but the presented use cases escape me at the moment. @inexorabletash might remember.

davidsgrogan avatar Oct 15 '15 17:10 davidsgrogan

I believe it was a privacy/authentication concern. E.g. a mail service may expire auth credentials via cookies after 30 days, and for privacy reasons they'd also want to wipe offline/cached data as well.

inexorabletash avatar Oct 15 '15 17:10 inexorabletash

Yeah, there was an idea to set an expiry thingie on a box so you can do this kind of thing.

annevk avatar Oct 16 '15 07:10 annevk

I guess if we want this before we want boxes we could add something dedicated for the default box.

annevk avatar Oct 16 '15 07:10 annevk

The requests I've heard around this are more granular. Eg restrict a particular cache/objectStore to a particular size or number of items.

jakearchibald avatar Mar 31 '16 11:03 jakearchibald

@jakearchibald that's different from letting it expire, no? But that's a feature we could also have with named boxes.

annevk avatar Apr 01 '16 09:04 annevk

Here's the related SW issue https://github.com/slightlyoff/ServiceWorker/issues/863

jakearchibald avatar Apr 01 '16 09:04 jakearchibald

Chiming in from a mention on StackOverflow asking for input. Client-side storage amounts to a data cache and automatically expiring data would reduce boilerplate code and lead to more efficient use of storage.

indolering avatar Oct 08 '16 05:10 indolering

Client-side storage amounts to a data cache and automatically expiring data would reduce boilerplate code and lead to more efficient use of storage.

See also https://phabricator.wikimedia.org/T121646#3063515 which described the same from a downstream perspective.

Lack of any reasonable eviction mechanism (LRU, TTL, etc.) for localStorage is proving difficult to deal with at scale.

Krinkle avatar Mar 01 '17 03:03 Krinkle

Yikes, I hadn't thought about this:

This means that when our more active users that participate on multiple wikis (Wikimedia hosts over 800 wikis, including 284 active Wikipedia subdomains), you visit a wiki, even once, that module cache is populated, but until you visit that wiki again, we have no way to clear it. The modules may have changed many times since then, and would be pruned immediately when viewed, but still it's taking up precious space and preventing other wikis from claiming space instead (in Firefox).

indolering avatar Mar 19 '17 03:03 indolering

FWIW, on IRC @Krinkle asked for expiration at the key-value level. While this could be emulated with lots of boxes, that might not be efficient nor desirable. @Krinkle if that's still desirable perhaps you could go into the use cases a bit why all these keys might need different expiry times?

annevk avatar Apr 17 '20 14:04 annevk

Not entirely sure if this is the right place to chime in, but just in case: We use indexeddb to buffer map data for a browser game. The game is organized in rounds on different subdomains, each of which will shut down at some point, when players will no longer visit the map and buffered data will needlessly persist. We're talking up to a couple of hundred MB each.

As such, +1.

NotherGithubAccount avatar Jan 13 '24 11:01 NotherGithubAccount

Likewise, I am using indexeddb as a buffer cache for a context that might be visited again but likely won't be (I cannot use a service worker in this case) and will be hundreds of megabytes, potentially gigabytes.

Currently the browser will persist the data indefinitely however it would be ideal if I could set an expiry on a key so it could remove itself if it has not been accessed within that time.

alshdavid avatar May 06 '24 05:05 alshdavid