thadeusb / flask-cache

Cache extension for Flask
http://packages.python.org/Flask-Cache/
Other
697 stars 185 forks source link

Force Recache #116

Open woozyking opened 9 years ago

woozyking commented 9 years ago

The use case is straightforward. I have some data/templates that I'd like to cache for a whole day, and always refresh on clock change, say 00:00. I thought about using unless but the description says "Cache will always execute the caching facilities unelss this callable is true", so probably not what I want.

So I am thinking about having an every argument, that allows the caching layer to check on all current conditions and every to refresh the cache. Vaguely, every can just be another time in seconds, but instead of having it behave as TTL, it behaves as a denominator in a modulo operation to determine whether it's time to refresh the data.

kelvin22 commented 8 years ago

+1 for this use case

Is there a good way to achieve this manually at the moment? I currently have a function that will go through every key in the cache and regenerate it. (I currently use a script that logs in as each user and visits each page)

woozyking commented 8 years ago

@kelvin22 consider the last commit made into this repo is over a year ago now, I'm guessing that this is not going to happen any time soon.

In terms of immediate solution, I think hacking the cache backend is as straightforward as it goes now.

I'm considering putting some effort into carrying out this particular feature in the near future when I find some time. I'll try to contact the original author when I submit a PR for this issue.