Problem Statement
Write-through vs write-back (write-behind): which statement is accurate?
Explanation
Write-through persists to the database and updates the cache in the same flow, trading latency for freshness.
Write-back queues DB persistence and can batch writes for speed, but risks data loss on cache failure without durable write logs.
Code Solution
SolutionRead Only
writeThrough(k,v){ db.put(k,v); cache.set(k,v,ttl); }