Eviction strategy
Eviction strategy base class and factory.
References
NONE
BaseEvictionStrategy
Bases: ABC
Base class for eviction strategies.
evict(vector_store)
abstractmethod
async
Evict entries based on the eviction policy.
This method should be implemented by subclasses to define how entries should be selected for eviction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector_store |
CacheCompatibleMixin | BaseDataStore
|
The cache store to use for eviction. |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the method is not implemented by the subclass. |
prepare_metadata(**kwargs)
abstractmethod
async
Prepare metadata for a new cache entry.
This method should be implemented by subclasses to define how metadata should be prepared for a new cache entry.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: A dictionary containing metadata for the new entry. |
dict[str, Any]
|
**kwargs: Additional keyword arguments to pass to the eviction strategy. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the method is not implemented by the subclass. |