fix(caching.py): return updated kwargs from get_cache helper function

This commit is contained in:
Krrish Dholakia 2024-01-13 15:04:34 +05:30
parent ebf1bc842c
commit 7f83cca62c
3 changed files with 9 additions and 8 deletions

View file

@ -678,7 +678,7 @@ class Cache:
if k == "ttl":
kwargs["ttl"] = v
cached_data = {"timestamp": time.time(), "response": result}
return cache_key, cached_data
return cache_key, cached_data, kwargs
else:
raise Exception("cache key is None")
except Exception as e:
@ -696,7 +696,7 @@ class Cache:
None
"""
try:
cache_key, cached_data = self._add_cache_logic(
cache_key, cached_data, kwargs = self._add_cache_logic(
result=result, *args, **kwargs
)
self.cache.set_cache(cache_key, cached_data, **kwargs)
@ -710,7 +710,7 @@ class Cache:
Async implementation of add_cache
"""
try:
cache_key, cached_data = self._add_cache_logic(
cache_key, cached_data, kwargs = self._add_cache_logic(
result=result, *args, **kwargs
)
await self.cache.async_set_cache(cache_key, cached_data, **kwargs)