The concept
The application reads the cache first, loads the database on a miss, and deletes the key when the data changes.
Cache-aside, also called lazy loading, is a caching pattern in which the application, not the cache, keeps the cache filled: it reads the cache first, and on a miss it reads the database, stores the result in the cache with an expiry, and returns it. Redis is a common cache for it, an in-memory data store that never queries a database by itself.
On a write, the application updates the database first, then deletes the cached key rather than writing the new value into it. The next read misses and loads the new value. A delete is idempotent; values written into the cache by several writers can land in the wrong order.
The expiry is what bounds staleness. Anything that changes the database without deleting the key, an import job, a manual fix, another service, leaves the old value in the cache until the key expires. A key set without an expiry lives until someone deletes it or Redis evicts it, and the default policy evicts nothing: once maxmemory is reached, Redis refuses new writes.
Cache-aside does not keep the cache consistent with the database. Between a write and its delete, readers see the old value, and a slow read that overlaps a write can put the old value back after the delete. The expiry is the upper bound on how long that lasts.
A hot key that expires under load sends every request that misses to the database at once: a cache stampede. Common fixes let one caller reload the key while the others wait or keep serving the old value: a short lock taken with SET NX, coalescing requests inside a process, or recomputing a little before the expiry. Redis offers none of them as such: the application does it.