Default stale=false; specific staleness parameters

This commit is contained in:
2023-05-03 01:45:32 -04:00
parent 6a284e9b6b
commit 9fe8227c57
2 changed files with 11 additions and 11 deletions

View File

@@ -129,7 +129,7 @@ class CacheProxy(object):
with cache:
res = cache[_cache_key] = await value(*args, **kw)
return res
async def thunk(*args, _cache_ttl: float=ttl, _cache_stale: bool=True, **kw):
async def thunk(*args, _cache_ttl: float=ttl, _cache_stale: bool=False, **kw):
_cache_key = prefix + key + repr(args) + repr(kw)
try:
return cache[_cache_key:_cache_ttl]
@@ -145,7 +145,7 @@ class CacheProxy(object):
with lock, cache:
res = cache[_cache_key] = value(*args, **kw)
return res
def thunk(*args, _cache_ttl: float=ttl, _cache_stale: bool=True, **kw):
def thunk(*args, _cache_ttl: float=ttl, _cache_stale: bool=False, **kw):
_cache_key = prefix + key + repr(args) + repr(kw)
try:
return cache[_cache_key:_cache_ttl]