Clear all entries in the Redis cache that match the cache prefix.
This method removes all cache entries that start with the specified prefix.
clear(
self,
**kwargs: Any = {},
) -> NoneExample:
cache = RedisCache(
redis_url="redis://localhost:6379",
prefix="my_cache"
)
# Add some entries to the cache
cache.update("prompt1", "llm1", [Generation(text="Result 1")])
cache.update("prompt2", "llm2", [Generation(text="Result 2")])
# Clear all entries
cache.clear()
# After this, all entries with keys starting with "my_cache:"
# will be removed
Note:
'redis:')
will be deleted.| Name | Type | Description |
|---|---|---|
**kwargs | Any | Default: {}Additional keyword arguments. Currently not used, but included for potential future extensions. |