Skip to main content

Module cache

Module cache 

Source
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§

CacheEntry
Cached payload.
CacheKey
Cache key derived from method + URL + optional body hash.
LayeredCache
Layered L1 memory + L2 sqlite.
MemoryCache
In-process L1 cache (dies with the process — one-shot safe).
RedisCache
Redis-backed cache (RESP over TCP). Enabled when config set cache_backend redis and cache_redis_url is set (XDG only).
SqliteCache
SQLite-backed cache under XDG cache directory.

Traits§

HttpCache
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).