Overview
If you just need to put bytes in front of a database, both work. The difference shows up when you need more than a flat key-value blob: Redis ships sorted sets, hashes, streams, pub/sub, Lua scripting, optional persistence and replication, which turns it into a Swiss-army knife for leaderboards, rate limiters, queues and sessions. Memcached deliberately stays simple and is multithreaded, so it can saturate a big box for pure caching.
Redis vs Memcached: key differences
| Redis | Memcached | |
|---|---|---|
| Data types | Strings, hashes, sorted sets, streams, … | Strings/blobs only |
| Threading | Mostly single-threaded core | Multithreaded |
| Persistence | Optional (RDB/AOF) | None — pure cache |
| Replication / HA | Built-in (replicas, Sentinel, Cluster) | Client-side sharding only |
| Extras | Pub/sub, Lua, transactions, TTL per key | Minimal, very predictable |
When to use Redis
You need data structures (leaderboards, rate limiting, sessions, queues), persistence, replication/failover, or pub/sub — i.e. almost every modern cache use case.
When to use Memcached
You want the simplest possible high-throughput cache for opaque blobs and value raw multithreaded performance and operational simplicity over features.
Verdict
Default to Redis — its data structures and HA cover far more use cases, and for plain caching it is plenty fast. Choose Memcached when you specifically want a lean, multithreaded cache and need none of Redis’s extras.
Common questions
Is Redis or Memcached better for caching?
For most teams Redis, because it does everything Memcached does plus persistence, replication and data structures. Memcached can edge ahead on raw multithreaded throughput for pure blob caching on a large machine.
Does Redis lose data on restart?
Only if you run it purely in-memory. Redis offers RDB snapshots and AOF logging for durability; Memcached has no persistence, so a restart always clears it.