Expand description
Process-wide holder of the cache’s single shared, multiplexed backend
and the RedisCacheStore over it — Rust port of the Java CacheRuntime.
Every v1.cache.redis worker instance calls store and shares this one
connection: redis.cache.instances is worker concurrency, not a connection
count (design spec §4.4: no pool; the client pipelines over one in-order
connection).
The backend is built lazily on first use, re-resolving configuration on every attempt until it connects. This is deliberate (spec §6): the function is registered before a credential-bootstrap application publishes a vault password, and — unlike sync-over-async, which must keep an eager Pub/Sub subscriber live — a cache has nothing to maintain at start-up and must not fail application start-up when Redis is briefly unreachable. While the connection cannot be built the store stays empty and each call retries (a late credential is picked up); once built, the client owns reconnection under it and the store is reused.
The one connection is released on shutdown through the platform’s
lifecycle (Platform::on_shutdown), registered from the build so the
cleanup is wired only when a connection has actually been opened.
Functions§
- current
- The store if one has been built (diagnostics;
Nonebefore the first successful call and aftershutdown). - set
- Install a store as the process-wide instance — the reuse/test seam (a store built against an embedded or in-process server). Replaces any current one.
- shutdown
- Release the shared backend (idempotent) — registered with
Platform::on_shutdownwhen the connection opens. Dropping the last handle closes the connection; a later call rebuilds from live configuration. - store
- The shared store, built on first use and reused thereafter. If the connection cannot be built yet, the error propagates to the caller (fail-fast — a cache failure is the caller’s concern via the flow’s exception handler) and the next call retries with freshly resolved configuration.