ExLLM.Infrastructure.Cache.Storage behaviour (ex_llm v0.8.1)
View SourceBehaviour for cache storage backends.
This allows ExLLM to support different cache storage mechanisms like ETS, Redis, Memcached, etc.
Summary
Callbacks
Clear all entries from the cache.
Delete a key from the cache.
Get a value from the cache.
Get storage info/stats (optional).
Initialize the storage backend.
Get all keys matching a pattern (optional).
Put a value in the cache with expiration time.
Callbacks
Clear all entries from the cache.
Delete a key from the cache.
@callback get(key :: String.t(), state :: any()) :: {:ok, value :: any(), state :: any()} | {:miss, state :: any()}
Get a value from the cache.
Get storage info/stats (optional).
Initialize the storage backend.
@callback list_keys(pattern :: String.t(), state :: any()) :: {:ok, keys :: [String.t()], state :: any()}
Get all keys matching a pattern (optional).
@callback put(key :: String.t(), value :: any(), expires_at :: integer(), state :: any()) :: {:ok, state :: any()}
Put a value in the cache with expiration time.