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.

Preparing for an interview?

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

← All Databases & Caching questions