mst-persist
mst-persist copied to clipboard
add expiration time?
it is possible to add an expire time for local storage?
@sabermazoji so localStorage has no expiration built-in.
If you'd like to expire entries in your app, you'd have to add an expiration field or something to your models and just throw away any objects that are dated. There's a guide on doing this with localStorage directly, but the same concept could apply here.
Once I finally merge Transforms (#16) (which is unfortunately still blocked by multi-entry support upstream...), one could make a custom transform that encapsulates those details away from your app though
For anyone else finding this, there are also other storage engines that support expiration out-of-the-box, such as localstorage-slim, localforage-cache, and likely many others (found those from a very quick search).
A Transform could still abstract this kind of functionality to a higher level in order to apply to many different storage engines. Different options with different trade-offs to them