Redis is an in-memory data store used for caching, sessions, queues, leaderboards and real-time analytics. Because it appears in so many architectures, Redis questions come up in backend, DevOps and SRE interviews. These Redis interview questions and answers cover the essentials, from data types to scaling and security.

Basics
1. What is Redis?
Redis (REmote DIctionary Server) is an in-memory key-value data store. It keeps data in RAM for very fast reads and writes, typically well under a millisecond, and can optionally save data to disk.
2. Why is Redis so fast?
It stores data in memory, uses efficient data structures and processes commands with an event loop that avoids locking overhead. Newer versions also use extra threads for network I/O.
3. Name common use cases.
Caching database results, storing user sessions, rate limiting, queues, pub/sub messaging, leaderboards with sorted sets, and counting with atomic increments.
4. What about Redis licensing?
In 2024, Redis changed its licence away from the open-source BSD licence. As a result, the Linux Foundation launched Valkey, an open-source fork. Redis 8 later added the AGPLv3 as a licensing option. In interviews, simply show that you are aware of both projects.
Data types
5. Which data types does Redis support?
| Type | Example use |
|---|---|
| String | Cached HTML, counters |
| Hash | User profile fields |
| List | Simple queues |
| Set | Unique tags or visitors |
| Sorted set | Leaderboards, ranked feeds |
| Stream | Event logs and consumer groups |
| Bitmap and HyperLogLog | Compact counting |
| Geospatial index | Nearby-location searches |
6. How do you set an expiry?
SET session:42 "data" EX 3600
TTL session:42EX 3600 makes the key expire after one hour.
Persistence
7. Explain RDB and AOF.
- RDB snapshots save the whole dataset at intervals. They are compact and fast to restore, but you can lose recent writes.
- AOF (append-only file) logs every write. It loses less data, especially with
appendfsync everysec, but files are larger.
Many deployments use both.
8. Can Redis be the primary database?
It can for some workloads, with persistence and replication enabled. However, if data must never be lost, use Redis as a cache or secondary store and keep the source of truth in a durable database.
Memory and eviction
9. What happens when Redis runs out of memory?
It follows the maxmemory-policy. Options include noeviction (return errors), allkeys-lru, allkeys-lfu, volatile-lru and volatile-ttl. For a cache, allkeys-lru or allkeys-lfu are common choices.
10. What is cache-aside?
The application first checks Redis. On a miss, it reads from the database and stores the result in Redis with a TTL. This is the most common caching pattern.
Scaling and availability
11. How does replication work?
Replicas copy data from a primary asynchronously. They can serve reads and take over if the primary fails.
12. Sentinel vs Cluster?
- Sentinel monitors a primary and its replicas and promotes a replica automatically on failure.
- Redis Cluster shards data across several primaries using 16,384 hash slots, and it also handles failover.
13. Why is the KEYS command dangerous in production?
KEYS * scans every key and blocks the server while it runs. Use SCAN instead, which works in small batches.
Security and operations
14. How do you secure Redis?
- Never expose port 6379 to the internet.
- Use ACL users with strong passwords and least privilege.
- Enable TLS for connections over untrusted networks.
- Keep protected mode on, and bind to private interfaces.
- Rename or disable dangerous commands, such as
FLUSHALLandCONFIG.
Exposed Redis servers are a frequent target for cryptomining malware. See our guide to troubleshooting high CPU usage on Linux.
15. How do you monitor Redis?
Use INFO for memory, clients and replication data, SLOWLOG for slow commands and LATENCY tools. In addition, export metrics to Prometheus or a similar system.
16. Redis vs Memcached?
Both are in-memory caches. Redis offers rich data types, persistence, replication and scripting, while Memcached is simpler and stores only strings.
Keep preparing
Practise each answer out loud, and run the commands in a lab rather than memorising them. Interviewers often ask follow-up questions, so make sure you understand why each answer is true.
Sources
Preparing for an interview? Browse more questions in our interview preparation hub. For businesses, we also offer security services such as VAPT, server hardening and ISO 27001 readiness.
