CosmosDBCache(
self,
container: Any,
*,
serde: SerializerProtocol | None = None
)BaseCache[ValueT]| Name | Type | Description |
|---|---|---|
container* | Any | An already-created async |
serde | SerializerProtocol | None | Default: NoneOptional custom serializer. |
| Name | Type |
|---|---|
| container | Any |
| serde | SerializerProtocol | None |
Asynchronous CosmosDB implementation of LangGraph BaseCache.
Uses the native azure.cosmos.aio async client for non-blocking I/O.
Sync methods (get, set, clear) delegate to the async
implementations via asyncio.run_coroutine_threadsafe.
Use from_conn_info to create an instance:
Example:
async with CosmosDBCache.from_conn_info( ... endpoint="https://your-account.documents.azure.com:443/", ... key="your_key", ... database_name="langgraph_db", ... container_name="cache", ... ) as cache: ... result = await cache.aget([(("ns",), "key1")])