Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow expiration_time to be a callable #20
Migrated issue, originally created by David Beitey (davidjb)
My current use-case is to cache a set of values for a relative amount of time -- in one case, until the end of the current day, in another, until the end of the given week, and finally, until a certain date/time.
Currently, dogpile.cache accepts an expiration_time as an integer, which represents a fixed number seconds from now (eg in 24 hours time), and not a relative or otherwise dynamic value. In order to obtain a relative
So, my suggestion is to allow
David Beitey (davidjb) wrote:
If you set a callable
It does present potential for performance issues, but it would be on the user not to do something overly complicated in the callable. However, the expires callable could itself be cached by the user, too.
Any other suggestions otherwise?
Michael Bayer (zzzeek) wrote:
I'm not suggesting that the function be called immediately within the
yes, this is where we'd actually call the callable.
well only if a callable is presented. I'm just trying to avoid latency for the vast majority of use cases that only send a scalar value here.