Skip to main content

CosmosDBCache

Synchronous implementation of AbstractCache using Azure Cosmos DB NoSQL API.
This class provides a concrete implementation of the AbstractCache interface using Azure Cosmos DB for caching data, with synchronous operations.
Attributes:
seed (Union[str, int]): A seed or namespace used as a partition key.
client (CosmosClient): The Cosmos DB client used for caching.
container: The container instance used for caching.
Initialize the CosmosDBCache instance.
Parameters:

Instance Methods

close

Close the Cosmos DB client.
Perform any necessary cleanup, such as closing network connections.

create_cache

Factory method to create a CosmosDBCache instance based on the provided configuration.
This method decides whether to use an existing CosmosClient or create a new one.
Parameters:

from_config

Parameters:

from_connection_string

Parameters:

from_existing_client

Parameters:

get

Retrieve an item from the Cosmos DB cache.
Parameters: Returns:

set

Set an item in the Cosmos DB cache.
Parameters: