View Source LlmComposer.Cache.Behaviour behaviour (llm_composer v0.8.0)

Cache behaviour to use other implementations for cache mod.

Summary

Callbacks

Deletes a key from the cache. Returns :ok.

Retrieves a value from the cache by key. Returns {:ok, value} if found and not expired, :miss otherwise.

Stores a value in the cache with the given key and TTL in seconds. Returns :ok.

Callbacks

@callback delete(key :: term()) :: :ok

Deletes a key from the cache. Returns :ok.

@callback get(key :: term()) :: {:ok, term()} | :miss

Retrieves a value from the cache by key. Returns {:ok, value} if found and not expired, :miss otherwise.

Link to this callback

put(key, value, ttl_seconds)

View Source
@callback put(key :: term(), value :: term(), ttl_seconds :: non_neg_integer()) :: :ok

Stores a value in the cache with the given key and TTL in seconds. Returns :ok.