MCPcopy Create free account
hub / github.com/BerriAI/litellm / get_cache

Method get_cache

litellm/caching/in_memory_cache.py:229–242  ·  view source on GitHub ↗
(self, key, **kwargs)

Source from the content-addressed store, hash-verified

227 return False
228
229 def get_cache(self, key, **kwargs):
230 if key in self.cache_dict:
231 if self.evict_element_if_expired(key):
232 return None
233 try:
234 original_cached_response: Final = self.cache_dict[key]
235 except KeyError:
236 return None
237 try:
238 cached_response = json.loads(original_cached_response)
239 except Exception:
240 cached_response = original_cached_response
241 return cached_response
242 return None
243
244 def batch_get_cache(self, keys: list, **kwargs):
245 return_val: Final = []

Callers 5

async_set_cache_saddMethod · 0.95
batch_get_cacheMethod · 0.95
increment_cacheMethod · 0.95
async_get_cacheMethod · 0.95
async_batch_get_cacheMethod · 0.95

Calls 2

loadsMethod · 0.80

Tested by

no test coverage detected