# Redis vs Memcached: Choosing a Cache in 2026

URL: https://www.devopsness.com/blog/redis-vs-memcached
Author: Kiril Urbonas
Published: 2026-09-03
Updated: 2026-09-03
Categories: Infrastructure
Tags: Database, Performance, Caching, Redis, Memcached

Summary: Both are fast in-memory stores, and both get picked by habit more than by requirements. Here is what actually differs and when each one is the right call.

---
# Redis vs Memcached: Choosing a Cache in 2026

Most teams reach for Redis by default and never seriously consider Memcached, which is usually fine but not always the right call. Both are in-memory key-value stores fast enough that the network round-trip dominates latency more than the store itself. The real differences are in what each one is actually built to do once you need more than "get and set a string."

## What each one actually is

**Memcached** is deliberately simple: a distributed, multi-threaded in-memory cache for arbitrary blobs (strings, serialized objects), with no persistence, no built-in data structures beyond key-value, and no replication. Its entire feature set fits on one page of documentation, and that's the point.

**Redis** is an in-memory data structure server. Beyond simple key-value, it has native strings, hashes, lists, sets, sorted sets, streams, HyperLogLog, and geospatial indexes, plus optional persistence (RDB snapshots, AOF log), replication, and Redis Cluster for horizontal sharding. It's a cache that also does several other jobs.

```bash
# Memcached: get/set a blob, nothing more
$ memcached -m 512 -p 11211
$ echo -e "set user:42 0 300 13\r\nJohn Doe here\r" | nc localhost 11211

# Redis: same job, plus data structures the app can query directly
$ redis-server --maxmemory 512mb --maxmemory-policy allkeys-lru
$ redis-cli SET user:42 "John Doe here" EX 300
$ redis-cli ZADD leaderboard 4500 user:42          # sorted set, no app-side sorting needed
$ redis-cli LPUSH recent-events:user:42 "login"    # list, capped ring buffer with LTRIM
```

## Where Memcached actually wins

**Pure cache-aside caching at high concurrency.** Memcached is multi-threaded by design, so a single instance scales across CPU cores for simple get/set traffic without the sharding complexity Redis Cluster introduces. If the workload is genuinely "cache database query results as opaque blobs, evict under memory pressure, nothing more," Memcached's simplicity is a feature: less to configure, less to misconfigure, and a smaller attack surface since there's no scripting, no persistence layer, and no pub/sub to secure.

**Memory efficiency for large numbers of small objects.** Memcached's slab allocator has less per-key overhead than Redis's object encoding for simple string values, which matters at scale when you're caching millions of small objects and every byte of overhead multiplies.

## Where Redis actually wins

**Anything beyond "get and set."** Rate limiting with `INCR` + `EXPIRE`, a leaderboard with sorted sets, a job queue with lists, session storage with hashes, real-time pub/sub, geospatial queries — these are one Redis command each, versus application-side logic layered on top of Memcached's flat key-value model. If the workload needs an atomic counter, a sorted set, or a queue, Redis does it natively; Memcached makes you build it in your application and hope for no race conditions.

**Persistence and durability when the cache is more than a cache.** A pure cache can be empty on restart and just refill from the source of truth. But the moment Redis is holding session state, a rate-limit counter, or a queue where losing data on restart is a real problem, RDB/AOF persistence matters, and Memcached has no answer for it at all — data is gone on any restart, full stop.

**Replication and cluster-mode HA out of the box.** Redis Sentinel (automatic failover for a primary-replica setup) and Redis Cluster (sharded, multi-primary) are built in. Memcached has no native replication; HA for Memcached means client-side consistent hashing across independent nodes and accepting that a node failure just cold-caches that shard's keys, not a real failover.

## The tradeoff that actually matters

Redis's single-threaded command execution (per shard) is the flip side of its rich feature set: complex operations, or a slow Lua script via `EVAL`, block that shard's other commands while running. Memcached's multi-threaded architecture doesn't have this problem for its simple command set, because there's nothing complex enough to run long. This is why "just use Redis for everything" isn't free: a poorly written Lua script or a large `KEYS *` scan (which you should never run in production regardless) can create latency spikes that a pure Memcached cache-aside workload structurally can't hit.

## The decision, concretely

- Need only get/set caching at high throughput, with the simplest possible operational surface? Memcached is a legitimate, often underrated choice — don't reach for Redis's complexity you won't use.
- Need atomic counters, sorted sets, pub/sub, queues, or any data structure beyond a flat key-value blob? Redis, because building that logic client-side on top of Memcached is real engineering work Redis gives you for free.
- Need the cache's data to survive a restart, or need it to be more than "safe to lose"? Redis, since Memcached has no persistence story at all.
- Need built-in HA/failover rather than client-side sharding across independent nodes? Redis, via Sentinel or Cluster.
- Running both isn't unusual: a pure query-result cache-aside layer on Memcached, with Redis reserved for session state, rate limiting, and queues where its extra structure earns its complexity.

Using Redis's lists as a real job queue works for light workloads, but past a certain volume or delivery-guarantee requirement, a dedicated queue is the better tool; see [when to use a message queue](/blog/when-to-use-a-message-queue) for where that line is.

## The call we'd make

Default to Redis when the workload needs anything beyond flat key-value, because the data-structure and persistence options are free capability you'd otherwise build yourself. Reach for Memcached specifically when the job really is "cache blobs, evict under pressure, nothing else" and you want the smallest, most boring operational surface for that one job. Don't pick Redis purely out of habit for a workload that never uses anything past `GET`/`SET` — that's exactly the case where Memcached's simplicity wins.

