Bahus / easy_cache

Caching and invalidation have never been so easy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recalculate cache on demand

dyus opened this issue · comments

It would be nice to have an opportunity to recalculate cache before it expires. Something like a invalidate_cache, recalculate_cache. If you think this is a good idea i can provide PR.

Hello, I think its a good idea to implement this feature.
I suggest the following API:

@ecached()
def method(*args, **kwargs):
   pass

method.refresh_cache(*args, **kwargs)

Method refresh_cache should replace cached data (if exists) and renew expiration time for data and tags.

I would greatly appreciate it if you do a PR, test are very welcome, see development docs here:
https://github.com/Bahus/easy_cache#development-and-contribution

Thanks!

PR is in 0.6.0 version on pypi, good job!
P.S. Please look though latest commits – I had to remove some "copy-paste" from documentation.