ExLLM.Infrastructure.Cache.Storage.TestCache (ex_llm v0.8.1)
View SourceSpecialized storage backend for timestamp-based test response caching.
This module provides hierarchical organization by provider/test module/scenario with timestamp-based file naming, rich metadata indexing, content deduplication, and smart fallback strategies for test response caching.
Summary
Functions
Clear cache entries for a specific cache key or pattern.
Check if a cached response exists and is valid.
Retrieve a cached response using TTL and fallback strategy.
Get cache statistics for a specific key or all keys.
List all available cache keys.
Store a test response with timestamp-based naming.
Types
@type cache_entry() :: %{ timestamp: DateTime.t(), filename: String.t(), status: :success | :error | :timeout, size: non_neg_integer(), content_hash: String.t(), response_time_ms: non_neg_integer(), api_version: String.t() | nil, cost: map() | nil }
@type cache_key() :: String.t()
@type fallback_strategy() :: :latest_success | :latest_any | :best_match
Functions
Clear cache entries for a specific cache key or pattern.
Check if a cached response exists and is valid.
Retrieve a cached response using TTL and fallback strategy.
Get cache statistics for a specific key or all keys.
@spec list_cache_keys() :: [cache_key()]
List all available cache keys.
Store a test response with timestamp-based naming.