Storefront has been decoupled into micro-frontends with a dedicated commerce app and shared shell.

Read the architecture guide →

ADR-004: Use FusionCache with Redis for selected catalog reads

Hot book lookups and the dashboard summary are cached through a FusionCache L1 in-process plus Redis distributed layer, treated as disposable.

October 20, 2026AcceptedData

1. Context & Problem

Individual BookEntityv1.0.0BookCanonical sellable title in the product catalog, encapsulating descriptive metadata, pricing, stock availability, taxono...Ownercatalog-experience-teamOpen docs detail pages and the administrative dashboard summary are viewed far more frequently than they change. Sending every repeated lookup directly to the primary database adds avoidable load and slows down response times.

However, caching introduces a secondary copy of data that can briefly lag behind edits or become unavailable. Catalog therefore needed a targeted caching approach that speeds up the hottest reads while keeping the database as the undisputed source of truth.

2. Business Value

  • Faster customer and admin experience: High-traffic book detail lookups and dashboard summaries respond quickly, improving browsing and operational responsiveness.
  • Protected database capacity: Offloads repetitive read traffic from the primary database, keeping write operations and search resolution fast under heavy load.
  • Zero risk to data ownership: Because cached entries are strictly disposable copies, cache loss or downtime affects speed temporarily without ever risking lost or corrupted catalog records.

3. How It Works

Catalog APIServicev1.0.0Catalog APIInternal HTTP and gRPC service for Catalog product management, hybrid discovery, and authoritative book metadata. PublishesBookUpdatedRatingFailedIntegrationEventSubscribesCreatePublisher, UpdatePublisher +24APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs uses a two-layer caching strategy designed strictly as a disposable performance helper:

  • Fast local + shared layers: Each service instance keeps a small in-memory cache for instant repeat reads, backed by a shared distributed cache in Catalog CacheContainerv1.0.0Catalog CacheNon-authoritative FusionCache and Redis caching layer owned by the Catalog bounded context for fast book detail lookups ...Ownercatalog-experience-teamDiagramOpen docs across all instances.
  • Selective coverage: Only two high-volume read paths are cached—individual BookEntityv1.0.0BookCanonical sellable title in the product catalog, encapsulating descriptive metadata, pricing, stock availability, taxono...Ownercatalog-experience-teamOpen docs lookups by identifier, and the administrative dashboard summary. Other queries go directly to the database.
  • Clear refresh rules: Whenever a book is updated, its individual cached entry is immediately cleared so the next lookup reloads fresh details from the database. The dashboard summary refreshes automatically after a short 15-second expiration window.
  • Authoritative checkout safety: Neither cache layer is ever treated as a source of truth; purchase-time price and availability decisions must rely on current authoritative data rather than cached copies.

4. Trade-offs & Lessons Learned

Alternatives considered

  • No caching: Simplest to operate and always strictly up to date, but leaves avoidable database pressure and higher latency on frequent book and dashboard reads.
  • Cache everything aggressively: Maximizes database offload, but greatly increases the risk and business impact of stale prices, outdated metadata, and complex invalidation bugs.
  • Shared distributed cache only (no local memory layer): Reduces caching layers, but forces every cache hit to make a network round trip instead of serving repeat reads directly from instance memory.

Trade-offs & operational considerations

  • Brief staleness window: Cached responses can briefly reflect prior values until invalidation or expiration takes effect, reinforcing why critical purchase checks must use authoritative data (see ADR-001: Use PostgreSQL as the Catalog system of recordDecision Recordv1.0.0ADR-001: Use PostgreSQL as the Catalog system of recordCatalog Database (PostgreSQL) is the single authoritative store for books, authors, categories, and publishers; cache an...Ownercatalog-experience-teamOpen docs).
  • Additional operational concerns: A two-layer cache introduces invalidation, expiration, data-shape versioning, and observability requirements. Changing the structure of a cached summary requires introducing a new versioned key so old and new data formats never collide.
  • Monitoring dependency: Operations teams must monitor cache hit/miss telemetry alongside distributed-cache connectivity and latency to tell whether read slowdowns stem from the database or the cache layer.

5. Technical Reference

DataKeySourceExpiration
BookEntityv1.0.0BookCanonical sellable title in the product catalog, encapsulating descriptive metadata, pricing, stock availability, taxono...Ownercatalog-experience-teamOpen docs lookup by IDbook:{id}Catalog DatabaseCaching:Expiration
Dashboard summarycatalog:dashboard:v1Catalog Database15 seconds
  • Invalidation & key versioning:
    • Book mutations invalidate book:{id} so the next lookup reloads from PostgreSQL (ADR-001: Use PostgreSQL as the Catalog system of recordDecision Recordv1.0.0ADR-001: Use PostgreSQL as the Catalog system of recordCatalog Database (PostgreSQL) is the single authoritative store for books, authors, categories, and publishers; cache an...Ownercatalog-experience-teamOpen docs).
    • catalog:dashboard:v1 relies on its 15-second TTL.
    • Changes to cached payload shapes must increment the key version (for example, catalog:dashboard:v2) to avoid deserializing incompatible cached JSON.
  • Fallback & observability:
    • Cache entries are disposable; cache misses or Redis outages fall back to the PostgreSQL-backed query path.
    • Monitor FusionCache metrics and traces, Redis connectivity, and Redis latency alongside PostgreSQL metrics.