fix(router.py): add modelgroup to call metadata

This commit is contained in:
Krrish Dholakia 2023-11-23 20:55:49 -08:00
parent b6fe6b2839
commit 3a8d7ec835
3 changed files with 71 additions and 131 deletions

View file

@ -62,6 +62,10 @@ class InMemoryCache(BaseCache):
cached_response['cache'] = True # set cache-hit flag to True
return cached_response
return None
def flush_cache(self):
self.cache_dict.clear()
self.ttl_dict.clear()
class RedisCache(BaseCache):
@ -97,6 +101,9 @@ class RedisCache(BaseCache):
traceback.print_exc()
logging.debug("LiteLLM Caching: get() - Got exception from REDIS: ", e)
def flush_cache(self):
self.redis_client.flushall()
class DualCache(BaseCache):
"""
This updates both Redis and an in-memory cache simultaneously.
@ -147,6 +154,10 @@ class DualCache(BaseCache):
return result
except Exception as e:
traceback.print_exc()
def flush_cache(self):
self.redis_cache.flush_cache()
self.in_memory_cache.flush_cache()
#### LiteLLM.Completion Cache ####
class Cache: