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

Method async_set_cache

litellm/caching/s3_cache.py:102–113  ·  view source on GitHub ↗

Asynchronously set cache using run_in_executor to avoid blocking the event loop. Compatible with Python 3.8+.

(self, key, value, **kwargs)

Source from the content-addressed store, hash-verified

100 print_verbose(f"S3 Caching: set_cache() - Got exception from S3: {e}")
101
102 async def async_set_cache(self, key, value, **kwargs):
103 """
104 Asynchronously set cache using run_in_executor to avoid blocking the event loop.
105 Compatible with Python 3.8+.
106 """
107 try:
108 verbose_logger.debug("Set ASYNC S3 Cache: Key=%s. Value=%s", key, value)
109 loop: Final = asyncio.get_event_loop()
110 func: Final = partial(self.set_cache, key, value, **kwargs)
111 await loop.run_in_executor(None, func)
112 except Exception as e:
113 verbose_logger.error("S3 Caching: async_set_cache() - Got exception from S3: %s", e)
114
115 def get_cache(self, key, **kwargs):
116 import botocore

Calls 3

partialFunction · 0.85
debugMethod · 0.45
errorMethod · 0.45