Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expiry of databases #205

Closed
falsandtru opened this issue May 29, 2017 · 3 comments
Closed

Expiry of databases #205

falsandtru opened this issue May 29, 2017 · 3 comments
Labels
feature request storage buckets Handle this with Storage Buckets instead?

Comments

@falsandtru
Copy link

falsandtru commented May 29, 2017

One of the worries to use IndexedDB is resource management used by them. For example, developers need to remember all database names and delete all unused databases.

indexedDB.open('a');
// 3 years later
indexedDB.deleteDatabase('a');
indexedDB.deleteDatabase('b');
...
indexedDB.deleteDatabase('y');
indexedDB.open('z');

It is too complicated. If IndexedDB can be set the expiry, developers don't need to write the code for management.

indexedDB.open('a', 0, 30 * 24 * 3600 * 1e3); // will be automatically deleted 30 days later since last access.
// 3 years later
indexedDB.open('z', 0, 30 * 24 * 3600 * 1e3);
@Bx1
Copy link

Bx1 commented Aug 18, 2018

This is hot! With expirationTime unused or unnecessary databases would be removed, which is now impossible. Maybe with an absoulute time value such as expirationDate range of possibilities would be more rewarding. It would be still possible to make it relevant (for example: set expiration to 30 days later). Cookies have something similar.

indexedDB.open(name, { version, expirationDate });

Another solution for this "resource" management would be getting list of all databases names, then deleted the unnecessary ones. However expiration of a database is still better option.

When expiration is set, it should be renewed with any next database opening.

@inexorabletash
Copy link
Member

Enumeration is covered in #31

I'm neutral on expiration; rather than a one-off solution per storage type (e.g. IDB, Cache, ...) having some sort of scheduled notification fired at service workers which can wake up and do work might be a better platform addition. But definitely keeping this open to track the use case.

@inexorabletash inexorabletash added the storage buckets Handle this with Storage Buckets instead? label Sep 20, 2019
@inexorabletash
Copy link
Member

TPAC 2019 Web Apps Indexed DB triage notes:

We think doing this as part of Storage Buckets makes the most sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request storage buckets Handle this with Storage Buckets instead?
Projects
None yet
Development

No branches or pull requests

3 participants