StackPractices

caching

Practical resources about caching for software engineers.

39 results

Speeding Up Applications with Caching

Caching is one of the highest-impact optimizations available to engineers. A well-placed cache can reduce database load by orders of magnitude and turn slow endpoints into sub-millisecond responses.

Discover patterns for in-memory caching with Redis, CDN edge caching, cache-aside and write-through strategies, and invalidation approaches. Each recipe discusses consistency trade-offs and provides production-tested configuration examples.

intermediate

Caching Strategies: Browser, CDN, Redis & Database

Implement effective caching at every layer of the stack: browser cache, CDN edge, Redis application...

intermediate

Embedding Cache Pattern

Cache LLM embeddings to reduce API calls and cost. Store embeddings with a content hash key and...

intermediate

Cache Invalidation Pattern

Strategies for keeping cached data fresh: TTL expiration, explicit invalidation, write-through, and...

advanced

Cache Stampede Prevention Pattern

Prevent thundering herd cache misses with locks, single-flight, stale-while-revalidate and early...

intermediate

Read-Through Cache Pattern

A transparent cache layer that intercepts read requests, fetches from the data source on miss, and...

advanced

Refresh-Ahead Cache Pattern

Proactively refresh cache entries before they expire to eliminate cache misses on hot keys and...

advanced

Two-Level Cache Pattern

Combine an L1 in-memory cache with an L2 distributed cache to reduce latency for hot keys while...

advanced

Write-Behind Cache Pattern

Write to the cache synchronously and persist to the database asynchronously for high-throughput...

intermediate

Write-Through Cache Pattern

Synchronously write to both cache and backing store so the cache always has the latest data without...

intermediate

Cache Eviction Policy Template

Template for documenting cache eviction rules per cache layer: LRU, LFU, TTL, FIFO, random...

intermediate

Cache Strategy Decision Template

Fill-in template for choosing and documenting a cache strategy per service: decision matrix, TTL...

intermediate

Cache Warmup Runbook

Operational runbook for warming caches after deploys, restarts and incidents: identify hot keys,...

intermediate

CDN Cache Rules Template

Template for CDN caching rules and edge behavior: cache keys, TTL by content type, query params,...

advanced

Complete Guide to GraphQL Caching

Cache GraphQL responses at every layer: CDN, gateway, DataLoader, persisted queries, and...

advanced

Complete Guide to Application-Level Caching

In-memory, distributed and hybrid caches at the app layer: LRU, TTL, two-tier strategies, sizing,...

caching in-memory distributed-cache guide
advanced

Complete Guide to Cache Invalidation

Cache invalidation strategies: TTL, event-driven, versioned keys, tag-based purging, write-through,...

advanced

Complete Guide to CDN Caching Strategy

CDN caching for web apps and APIs: edge caching, cache keys, headers, invalidation, surrogate keys,...

advanced

Complete Guide to Redis Caching Strategies

Choose and implement the right Redis caching pattern — cache-aside to refresh-ahead — with...

advanced

Complete Guide to Redis in Production

Keep Redis stable in production: RDB/AOF persistence, Sentinel vs Cluster for HA, memory...

No results found.