What is caching?
Store copies of data closer to the user or app so responses are faster and backends do less work.
What is caching?
Cache = a copy of data in a fast place. Instead of hitting the database or API every time, you read from the cache. If the data is there (hit), you get a fast answer. If not (miss), you fetch, then store in the cache for next time.
Why cache? Speed and cost. Less load on the source (DB, API). Lower latency for users. Trade-off: data in the cache can be stale until it expires or is invalidated.
What is a cache?
A copy of data in a fast place. Read from cache first; if miss, fetch then store for next time. Speed + less load on the source.
In-app / distributed
In-app = memory in your process (fast, not shared). Distributed = Redis, Memcached—shared across instances. Good for sessions, API responses.
Edge / CDN
Cache at the edge (CloudFront, Fastly). Static assets (images, JS, CSS) and sometimes API responses. Serves from a location close to the user.
When to cache
Read-heavy, same data often, a bit of staleness OK (e.g. product catalog). Set TTL; invalidate on write when you need freshness.
Cache = faster responses and less work for the backend. Trade-off: data can be stale until TTL or invalidation.
Where to cache
In-app = memory inside your process (e.g. a map or Redis next to the app). Fastest, but not shared across instances.
Distributed cache = Redis, Memcached. Shared across many app instances. Good for session data, API responses, or computed results.
Edge / CDN = cache at the edge (CloudFront, Fastly). Caches static assets (images, JS, CSS) and sometimes API responses. Serves from a location close to the user.
When to use caching
Cache when: read-heavy, same data asked often, and a bit of staleness is OK (e.g. product catalog, leaderboard).
Avoid or be careful when: data changes often, must be exact (e.g. balance after payment), or cache invalidation is hard. Set TTL (time-to-live) so old data expires; invalidate on write when you need freshness.
Sign in to track progress on your dashboard.
Ready to see how this works in the cloud?
Switch to Career Paths on the Academy page for structured paths (e.g. Developer, DevOps) and provider-specific lessons.
View role-based paths