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

Can you please clarify in the documentation - if flushExpired() is never called, will the expired data just sit there in the database, or will something else eventually flush it? #57

Open
psmartt opened this issue Jun 21, 2016 · 2 comments

Comments

@psmartt
Copy link

psmartt commented Jun 21, 2016

No description provided.

@ConstantineYurevich
Copy link

+1

@Krinkle
Copy link

Krinkle commented Feb 27, 2017

From what I can see, there is no automatic, periodic, randomised or sampled call to flushExpired().

However, two clean up strategies exist:

  • When trying to retrieve a key of which the value is expired, it'll be removed on-demand.
  • When setting a key and the 5-10MB storage quota is full, the library will remove values (starting with the oldest) to free up the required space.

It may be useful to add something like if (Math.random() < 0.2) { requestIdleCallback( lscache.flushExpired ); } to your page to periodically trigger a clean up on 1/5 page views.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants