fix(caching.py): enable async setting of cache for dual cache

This commit is contained in:
Krrish Dholakia 2024-03-20 18:42:34 -07:00
parent 9a221851d5
commit f0d8472bfd
2 changed files with 11 additions and 2 deletions

View file

@ -836,6 +836,17 @@ class DualCache(BaseCache):
except Exception as e:
traceback.print_exc()
async def async_set_cache(self, key, value, local_only: bool = False, **kwargs):
try:
if self.in_memory_cache is not None:
await self.in_memory_cache.async_set_cache(key, value, **kwargs)
if self.redis_cache is not None and local_only == False:
await self.redis_cache.async_set_cache(key, value, **kwargs)
except Exception as e:
print_verbose(f"LiteLLM Cache: Excepton async add_cache: {str(e)}")
traceback.print_exc()
def flush_cache(self):
if self.in_memory_cache is not None:
self.in_memory_cache.flush_cache()