Skip to main content

Cache

A wrapper class for managing cache configuration and instances.
This class provides a unified interface for creating and interacting with different types of cache (e.g., Redis, Disk). It abstracts the underlying cache implementation details, providing methods for cache operations.
Attributes:
config (Dict[str, Any]): A dictionary containing cache configuration.
cache: The cache instance created based on the provided configuration.
Initialize the Cache with the given configuration.
Validates the configuration keys and creates the cache instance.
Parameters:

Class Attributes

ALLOWED_CONFIG_KEYS



Static Methods

cosmos_db

Create a Cosmos DB cache instance with ‘autogen_cache’ as database ID.
Parameters: Returns:

disk

Create a Disk cache instance.
Parameters: Returns:

get_current_cache

Get the current cache instance.
Returns:
Cache: The current cache instance.
Parameters: Returns:

redis

Create a Redis cache instance.
Parameters: Returns:

Instance Methods

close

Close the cache.
Perform any necessary cleanup, such as closing connections or releasing resources.

get

Retrieve an item from the cache.
Parameters: Returns:

set

Set an item in the cache.
Parameters: