Expand description
Response caching middleware for the proxy.
Caches ReadResource and CallTool responses with per-backend TTL.
Cache keys are derived from the request type, name/URI, and arguments.
§Cache Backends
The cache backend is configurable via [cache] in the proxy config:
"memory"(default): In-process moka cache. Fast, no external deps."redis": External Redis cache. Shared across instances. Requires theredis-cachefeature flag."sqlite": Local SQLite cache. Persistent across restarts. Requires thesqlite-cachefeature flag.
§Per-Backend Configuration
[[backends]]
name = "slow-api"
transport = "http"
url = "http://localhost:8080"
[backends.cache]
resource_ttl_seconds = 300
tool_ttl_seconds = 60
max_entries = 1000Structs§
- Cache
Handle - Shared handle for querying cache stats and clearing caches.
- Cache
Layer - Tower
Layerthat producesCacheServiceinstances sharing the same cache state andCacheHandle. - Cache
Service - Tower service that caches resource reads and tool call results.
- Cache
Stats Snapshot - Snapshot of cache statistics for a single backend.