5 questions to test your understanding
An application stores user profiles in PostgreSQL (200ms per query). A developer proposes caching results in Redis with a 5-minute TTL. A colleague objects: 'Key-value stores shouldn't hold data that's also in our relational database.' Who is correct?
A product manager asks the backend team to use their existing Redis cluster to answer: 'Which users in New York signed up in the last 7 days?' An engineer says this is not what key-value stores are designed for. Why?
Redis is an in-memory store and therefore can seldom persist data to disk, making it unsuitable for any use case where data is expected to survive a server restart.
Cache invalidation — deciding when to evict or update cached data — is a problem that key-value stores solve automatically through TTL expiration.
What is the fundamental tradeoff of the key-value data model, and why does this make key-value stores a complement to relational databases rather than a replacement?