Cache prefetch

This commit is contained in:
cuom1999 2024-02-23 17:07:34 -06:00
parent c2f6dba462
commit 2831a24b90
6 changed files with 70 additions and 34 deletions

View file

@ -74,7 +74,17 @@ def cache_wrapper(prefix, timeout=None):
if l0_cache:
l0_cache.delete(cache_key)
def prefetch_multi(args_list):
keys = []
for args in args_list:
keys.append(get_key(func, *args))
results = cache.get_many(keys)
for key, result in results.items():
if result is not None:
_set_l0(key, result)
wrapper.dirty = dirty
wrapper.prefetch_multi = prefetch_multi
return wrapper