App Cache vs DB Cache

Layer the cache.

Overview

App cache versus DB cache is not really a choice; the right answer is layered caching, where in-process app caches absorb the hottest reads, shared Redis or memcached caches absorb the next tier, and the database itself caches what gets through. Each layer trades scope for shared state: the app cache is fast but per-process and harder to invalidate; the DB cache is shared but pays a network round trip. Picking the right tier per data class is the discipline.

The approach

The practical approach is to layer caches deliberately rather than pick one, route per-data-class to the appropriate tier (rarely-changing reference data goes to in-process, frequently-shared state goes to Redis), define invalidation per tier with clear rules for when each layer must update, and document the per-cache rationale so the next engineer can reason about the layering rather than re-deriving it.

Why this compounds

Cache layering compounds across services. Each correctly-placed cache absorbs reads at the cheapest possible tier; each layer reduces load on the layers behind it; the team builds a vocabulary for matching data class to caching tier that pays off on every new feature. Without the discipline, every cache becomes Redis and the in-process savings get left on the table.

Cache layering discipline is an engineering discipline that pays off across years. Nova AI Ops integrates with caching telemetry, surfaces hit-rate patterns, and supports the team’s caching discipline.