cache_factory
autogen.cache.cache_factory.CacheFactory
CacheFactory
Static Methods
cache_factory
Factory function for creating cache instances.
This function decides whether to create a RedisCache, DiskCache, or CosmosDBCache instance based on the provided parameters. If RedisCache is available and a redis_url is provided, a RedisCache instance is created. If connection_string, database_id, and container_id are provided, a CosmosDBCache is created. Otherwise, a DiskCache instance is used.
Parameters:Name | Description |
---|---|
seed | Used as a seed or namespace for the cache. Type: str | int |
redis_url | URL for the Redis server. Type: str | None Default: None |
cache_path_root | Root path for the disk cache. Type: str Default: ‘.cache’ |
cosmosdb_config | Dictionary containing ‘connection_string’, ‘database_id’, and ‘container_id’ for Cosmos DB cache. Type: dict[str, typing.Any] | None Default: None |
Type | Description |
---|---|
autogen.cache.AbstractCache | An instance of RedisCache, DiskCache, or CosmosDBCache. |