Memcached
A bare-bones in-memory cache — pure key-value, multithreaded, no persistence, no data structures. Fast and simple, and that simplicity is the whole point.
What is Memcached?
Memcached is an in-memory key-value cache — you put a value under a key, you get it back fast, and that’s essentially the entire feature set. It has no persistence, no replication, no data structures beyond opaque blobs, and no cluster coordination. That radical simplicity is deliberate: Memcached exists to sit in front of a slow backend (a database, an API) and absorb repeated reads at microsecond latency. It’s the classic partner to Redis in the “which cache?” decision.
Memcached vs Redis — the only comparison that matters
Nearly every Memcached decision is really a Redis-vs-Memcached decision, and the honest framing is: Redis does more; Memcached does less, on purpose. Redis offers rich data structures (lists, sets, sorted sets, hashes), persistence, replication, pub/sub, and scripting — it’s a data-structure server that happens to be fast. Memcached offers plain key-value caching and one thing Redis historically didn’t: native multithreading, letting a single node use many cores for very high-throughput simple caching. The practical guidance: choose Redis when you want any of its richer features (which is most of the time — it’s become the default), and choose Memcached when your need is genuinely “cache opaque blobs by key at maximum throughput per node” and you value the operational simplicity of a tool that does exactly one thing. Managed versions of both exist (AWS ElastiCache offers each).
Cache reality — the same traps as any cache
Memcached inherits every caching pitfall. Invalidation is the hard problem: serving stale data because the cache wasn’t updated when the source changed. Cache stampedes happen when a popular key expires and every request simultaneously hits the backend to repopulate it. And a cache is not a database — Memcached can evict any key at any time under memory pressure (LRU), so treating it as durable storage is a data-loss bug waiting to happen. Cache what you can afford to lose and recompute.
What people get wrong
- Expecting durability — Memcached evicts under pressure and loses everything on restart; it’s a cache, never a store of record.
- Choosing it over Redis by default: Redis’s richer feature set makes it the more common right answer; pick Memcached for a specific throughput/simplicity reason.
- Ignoring stampedes and invalidation — the hard parts of caching are about when to refresh, not the cache itself.
Primary source: Memcached wiki
Historical figures and technical concepts for informational purposes only. Not technical, professional, legal, or financial advice. Sources: Official Documentation.