Expand description
HTTP/parse cache under XDG (one-shot L1 + SQLite L2). HTTP / parse cache under XDG (PRD 5AF / GAP-011 / GAP-023).
Backends: in-process L1 ([FxHashMap] of hex digests), SQLite under XDG
cache. Redis is optional via config set cache_backend=redis +
cache_redis_url (never env).
§Workload / hashing
L1 keys are SHA-256 hex digests produced by this process (trusted).
rustc_hash::FxHashMap avoids SipHash overhead on short fixed-width
keys (rules_rust_eficiencia_e_performance). Do not use FxHash for
untrusted external key spaces.
Concurrency: single-key get/put under short Mutex critical sections
that never cross .await (rules). Not a multi-item fan-out surface.
Structs§
- Cache
Entry - Cached payload.
- Cache
Key - Cache key derived from method + URL + optional body hash.
- Layered
Cache - Layered L1 memory + L2 sqlite.
- Memory
Cache - In-process L1 cache (dies with the process — one-shot safe).
- Redis
Cache - Redis-backed cache (RESP over TCP). Enabled when
config set cache_backend redisandcache_redis_urlis set (XDG only). - Sqlite
Cache - SQLite-backed cache under XDG cache directory.
Traits§
- Http
Cache - Trait for one-shot HTTP/parse caches.
Functions§
- default_
cache - Build the product cache from XDG
cache_backend(sqlite|memory|redis). - expires_
after - TTL helper: now + duration.
- sqlite_
layered_ cache - Layered only (tests / explicit sqlite path).