System Design Fundamentals
Vote

0% completed

Cache Invalidation

Cache Invalidation Strategies

While caching can significantly improve performance, we must ensure that the data in the cache is still correct—otherwise, we serve out-of-date (stale) information. This is where cache invalidation comes in.

  1. Ensure Data Freshness
    • When the underlying data changes—say a product’s price updates in your database—you must mark or remove the old (cached) data so users don’t see stale information. This process is called “cache invalidation.”

.....

.....

.....

Like the course? Get enrolled and start learning!
M

mayank190804

· 2 years ago

Please help

Show 2 replies
M

mbliss398

· 3 years ago

When data is written to the permanent datastore in the write-around scheme, is any stale data in the cache purged?

Ex:

  • Item A has price of $20, stored in cache and DB

  • Item A goes on sale, write-around strategy sets price to $10 in DB

  • Client requests item A's price immediately after DB update, do they read the $20 value from the cache or does this trigger a cache miss and get the $10 from the DB?

Show 2 replies
Mat Wilk

Mat Wilk

· a year ago

Isn't it just writing to the perm storage strategies and not invalidation strategies, they don't necessarily invalidating the cache, it's super confusing and I think the naming in this post should be changed

Show 1 reply
Vaishnavi Ainapure

Vaishnavi Ainapure

· 5 months ago

How does a request know that a given data is stale? Is there any flag marked against each object or entity to indicate it is stale?

Sourav Singh

Sourav Singh

· 2 years ago

Can you cite some example where Write Back or Write Cache caching mechanism are suitable to use?