0% completed
Read-Through vs Write-Through Cache
Read-through and write-through caching are two caching strategies used to manage how data is synchronized between a cache and a primary storage system. They play crucial roles in system performance optimization, especially in applications where data access speed is critical.
Read-Through Cache
- Definition: In a read-through cache, data is loaded into the cache on demand, typically when a read request occurs for data that is not already in the cache.
- Process:
- When a read request is made, the cache first checks if the data is available (cache hit).
.....
.....
.....
Felipe Moreno
· 9 months ago
Read Through and Write Through policies are independent from each other. There is no VS between the two. You could have both.
It should be Read-through VS Read-around policy. And Write-Through VS. Write-Back policy.
Marko Urh
· 2 years ago
I'm thinking about write-through cache:
Data Consistency: Provides strong consistency between the cache and the primary storage. No Data Loss on Crash: Since data is written to the primary storage, there’s no risk of data loss if the cache fails.
What if cache write fails, ok we have DB, maybe we can fill cache-miss, but what if DB fails. I have a problem now. I need to ensure atomicity of this parallel operation. To achieve transaction on two separate systems something like Two phase commit, it would be useful to maybe add some more sugar to this.If there's no mechanism like that successful cache write could be serving wrong data, while DB is trying to be written or ultimately fails, but then needs to rollback cache. Unless we ensure some transaction across these two with "simul
kate powler
· 5 months ago
Remember, the database doesn't directly interact with the cache (unlike the diagram suggests). The application orchestrates their synchronization
Wonee
· a year ago
Doesn't the application interact with the DB as well? Isn't there 2 writes for a cache-through strategy?
asif malek
· a year ago
In write thru cache, we write data in db and cache at same time. What if cache write is a success and db write fails, then system will serve wrong data via cache.