ring icon indicating copy to clipboard operation
ring copied to clipboard

Dynamic expire config like expire_callback or expired_at

Open sawaca96 opened this issue 3 years ago • 0 comments

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"

sawaca96 avatar Aug 16 '22 06:08 sawaca96