Software Development

What is Cache?

Quick answer

A small, fast storage layer that keeps copies of frequently used data so future requests can be served more quickly.

Cache, explained

Caching works on a simple idea: if you will need something again soon, keep it close at hand. CPUs have tiny caches built into the chip, web browsers cache images and scripts, and applications use in-memory stores such as Redis to avoid repeating the same database queries.

For example, a news site might cache its homepage for 60 seconds so thousands of visitors are served the same prepared copy instead of rebuilding the page for each one. The hard part is invalidation: deciding when cached data is stale and must be refreshed. Serve stale data and users see outdated information; refresh too often and the cache stops saving work. Developers often joke that cache invalidation is one of the hardest problems in computing.

Related terms

Guides that mention Cache