Grokking System Design Fundamentals
Ask Author
Back to course home

0% completed

Vote For New Content
Does write-around invalidate current cache value?

mbliss398

Sep 22, 2023

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?

2

0

Comments
Comments
Ricardo Franco
Ricardo Franco2 years ago

No, stale data is not purged. Write-around shouldn't be used in heavy-read situations, like your example.

Design Gurus
Design Gurus2 years ago

In a write-around cache scheme, when data is written directly to the permanent datastore, the cache is not immediately updated or purged of the stale data. Using your example:

  1. Initial State: Item A with a price of $20 is stored in both the cache and the databas...

On this page