Comparisons

Redis vs Memcached

Both are in-memory key-value stores used as caches. Redis adds rich data structures, persistence and replication; Memcached is a leaner, multithreaded pure cache.

1 min read·8 sections
Open the interactive version → diagrams, practice & more

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

RedisMemcached
Data typesStrings, hashes, sorted sets, streams, …Strings/blobs only
ThreadingMostly single-threaded coreMultithreaded
PersistenceOptional (RDB/AOF)None — pure cache
Replication / HABuilt-in (replicas, Sentinel, Cluster)Client-side sharding only
ExtrasPub/sub, Lua, transactions, TTL per keyMinimal, 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.

Part of Comparisons on SystemLore — system design explained with 148 deep topics, interactive diagrams, and a build-it-yourself game. Build this one →