Backend & systems·Caching and invalidation
you check the cache, miss, go and read the database yourself, and write the value back before you return it.
Cache-aside
Also calledlazy loading, lazy population
The application owns the cache: on a miss it loads from the store and populates the cache itself. It is the usual default because the cache can go down without taking reads with it, and because nothing is cached that nobody asked for. The costs are that every miss pays database latency plus a write, and that two requests missing the same key at the same moment both hit the database.