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

Add automatic cach invalidation upon exeding maximum cache age #6

Open
Olian04 opened this issue Apr 4, 2017 · 1 comment
Open

Comments

@Olian04
Copy link

Olian04 commented Apr 4, 2017

Ex:

@cache(5*60)
def foo(a):
    return a * a

This would invalidate the cache of function foo, 5 minutes after it being called the first time.

>>> foo(2) # will cache
4
>>> foo(2) # will use cache
4
>>> # wait for 5 min
>>> foo(2) # will cache again
@rouilj
Copy link

rouilj commented Oct 16, 2022

I think using cachetools.TTLCache as the cache backend should handle what you want.

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

2 participants