ring
ring copied to clipboard
Dynamic expire config like expire_callback or expired_at
I think it would be nice if I could determine the expiration in more various ways or dynamically .
use expire callback
def get_expire():
# return seconds
...
@ring.lru(expire_callback=get_exprie())
def foo():
return "foo"
use expired_at
expired_at can be cron expressoin or time or datetime.
I think cron expression is very nice.
time and datetime is ambiguous, because it cannot be repeated and can only be used once.
@ring.lru(expired_at=expired_at)
def foo():
return "foo"