🔴 Redis Beginner

What is the difference between Redis and Memcached?

Answer

Both Redis and Memcached are in-memory caches, but Redis is significantly more capable. Data types: Memcached only supports plain string key-value pairs; Redis supports Strings, Lists, Sets, Sorted Sets, Hashes, Streams, and more. Persistence: Memcached has no persistence — all data is lost on restart; Redis supports RDB snapshots and AOF logs. Replication and clustering: Redis has built-in primary-replica replication and Cluster mode; Memcached requires client-side sharding. Atomic operations: Redis supports complex atomic operations like INCR, LPUSH, Lua scripts, and transactions; Memcached only has add/incr/decr. Choose Memcached only for the simplest caching use case where you need multi-threaded memory efficiency; choose Redis for almost everything else.