Interview › Databases & Caching
What is read-your-writes consistency, and how can caching break it?
Databases & Caching · Advanced level
Answer
Read-your-writes means a user sees their own update immediately. Caching can break it by returning stale cached values or replica reads, so I bypass cache or invalidate/update it on write.
Technical explanation
Read-your-writes is strongest for the user who just performed the write.
Cache and read replicas can both break it immediately after update.
Solutions include delete/update cache on write, primary read after write, version checks, or short cache-bypass windows.
Hands-on example
Example:
PUT /profile updates RDS and deletes user:v2:123.
GET /profile for the same user during the next 10 seconds reads primary DB or rebuilt cache.
Public profile reads can remain cache-aside if stale reads are acceptable.
Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.
More Databases & Caching interview questions
- How do you decide what to cache and what not to cache?
- How do you handle cache warming after a restart or failover?
- How would you use Redis for distributed locking, and what are the caveats?
- What is the blast radius of a cache outage, and how do you make the app degrade gracefully?
- How would you use Redis for rate limiting?
- What is the difference between Redis as a cache and Redis as a primary datastore?
- How do you test a Redis or database failover without impacting users?
- Why are some Redis commands (KEYS, FLUSHALL) dangerous in production?