-
Notifications
You must be signed in to change notification settings - Fork 5
Accept timedelta for ttl #334
Copy link
Copy link
Open
Labels
backendsCache backends and their atomic primitivesCache backends and their atomic primitivescache-managerApplication-level CacheManagerApplication-level CacheManagerdeveloper-experienceSurprising behaviour, missing warnings or unclear errors for library usersSurprising behaviour, missing warnings or unclear errors for library usersenhancementNew feature or requestNew feature or requesthttp-cacheThe @cache decorator, cache keys and Cache-Control handlingThe @cache decorator, cache keys and Cache-Control handling
Description
Activity
Metadata
Metadata
Assignees
Labels
backendsCache backends and their atomic primitivesCache backends and their atomic primitivescache-managerApplication-level CacheManagerApplication-level CacheManagerdeveloper-experienceSurprising behaviour, missing warnings or unclear errors for library usersSurprising behaviour, missing warnings or unclear errors for library usersenhancementNew feature or requestNew feature or requesthttp-cacheThe @cache decorator, cache keys and Cache-Control handlingThe @cache decorator, cache keys and Cache-Control handling
Problem
ttlmust be anintnumber of seconds everywhere.@cache(ttl=timedelta(minutes=5))raisesCacheXError: ttl must be an int number of seconds, got timedelta, and the backends andCacheManagerraiseTypeError.Proposal
Accept
datetime.timedeltawherever attl(orstale_ttl) is taken, converting it to whole seconds, and reject values that are not whole seconds or that are out of range, as today. Keepbool/floatrejected.