-
Notifications
You must be signed in to change notification settings - Fork 47
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
Clear the CacheRegion #7
Comments
Michael Bayer (zzzeek) wrote: the problem with this feature is that it can't be implemented for many backends, in particular memcached, the most common backend. memcached has no way to offer a listing of keys currently cached. |
Michael Bayer (zzzeek) wrote: Ah but, in beaker what we did do was give the cache region a so-called "start" time. That is, when the region pulls a cached value, it not only checks the creation time of the value against the current time - expiration time, it also checks that the creation time is greater than the "start" time, which would typically be set to the timestamp at region creation time. So this doesn't clear anything out but has the effect of considering everything in the cache before region startup time to be invalid. Mind if I update the title here to match that description ? because dogpile.cache does need this feature (I used to use it all the time). |
Mark (mhall) wrote: Ah, right. Difficult. Is there a way to access the underlying backend from a CacheRegion? That would make it possible to get the keys, where this is supported by the backend. |
Mark (mhall) wrote: So in that case, by setting the "start" time to the current time, everything created previously would become invalid? That sounds like a nice solution. |
Michael Bayer (zzzeek) wrote: yeah. actually we're on irc talking about it, so i think it should be simple - region.invalidate(). |
Michael Bayer (zzzeek) wrote: invalidate() is in [[https://bitbucket.org/zzzeek/dogpile.cache/changeset/2c97fc72ed60f1dfa2e59a8571f1207ff532e01f|2c97fc72ed60f1dfa2e59a8571f1207ff532e01f]], and I've also modified get() to use expiration/invalidation mechanics by default. We're bumped to version 0.3.0 now. Can you please field test a bit before I release ? |
Changes by Michael Bayer (zzzeek):
|
Mark (mhall) wrote: I'll be testing and report back. |
Mark (mhall) wrote: I've been continuously running the updated version for about 3 weeks now and have seen no errors or strange behaviour from the change. As far as I am concerned, it looks stable. |
Migrated issue, originally created by Mark (mhall)
It would be useful if the CacheRegion had a clean() method, in addition to the delete() method, that would remove all cached values (or at least their keys) from the CacheRegion.
The use-case I have is that I cache search results and occasionally need to clear the whole cache, when an update to the search index has been performed.
The text was updated successfully, but these errors were encountered: