Interview › Databases & Caching
What is the difference between Redis as a cache and Redis as a primary datastore?
Databases & Caching · Advanced level
Answer
Redis as a cache is rebuildable from another source of truth. Redis as a primary datastore is authoritative, so persistence, backup, failover, no unsafe eviction, and recovery testing become mandatory.
Technical explanation
Cache data should be safely rebuildable from a durable source.
Primary-store data needs persistence, backups, no unsafe eviction, HA, and restore testing.
Financial records and durable ledgers should usually live in a transactional database, not only Redis.
Hands-on example
Classification:
Product details copied from RDS: cache.
User sessions: needs datastore-level HA policy.
Billing counters: needs durable queue, DB write, or reconciliation.
Set eviction to noeviction if data must not disappear.
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 would you use Redis for rate limiting?
- Why are some Redis commands (KEYS, FLUSHALL) dangerous in production?
- How would you use Redis for distributed locking, and what are the caveats?
- What is a cache hit ratio, and how do you improve it?
- How does ElastiCache provide high availability and automatic failover?
- What is the difference between Redis Sentinel and Redis Cluster?
- What is Redis Cluster, and how does sharding with hash slots work?
- How do you decide what to cache and what not to cache?