pamelafox / lscache

A localStorage-based memcache-inspired client-side caching library.
Other
1.46k stars 160 forks source link

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 8 years ago

ConstantineYurevich commented 8 years ago

+1

Krinkle commented 7 years ago

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

However, two clean up strategies exist:

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.