Ravindra BagaleCourses & study guides मराठी Track your progress

Ravi Sir's Cards › AWS

Cache-aside pattern

This revision card explains Cache-aside pattern. It starts from the need that writing only to cache and never to DB loses data on flush. It describes cache-aside — app reads cache; on miss read DB and fill cache; writes go to DB then invalidate or update cache. The how-to section notes implement getOrLoad(key) with short TTL; delete key on product update. An example on the card is after price update, next read refreshes from DB instead of serving stale price forever.

Cache-aside pattern Writing only to cache and never to DB loses data on flush. Cache-aside: app reads cache; on miss read DB and fill cache; writes go to DB then invalidate or update cache. Implement getOrLoad(key) with short TTL; delete key on product update. After price update, next read refreshes from DB instead of serving stale price forever.
Cache-aside pattern · Download PNG
Read card text

What this card says

Why do we need it?

Writing only to cache and never to DB loses data on flush.

What is it?

Cache-aside: app reads cache; on miss read DB and fill cache; writes go to DB then invalidate or update cache.

cache-aside

How to do it

Implement getOrLoad(key) with short TTL; delete key on product update.

Example

After price update, next read refreshes from DB instead of serving stale price forever.

See all AWS revision cards