Memcached

active

by Memcached community (originally Danga Interactive) · since 2003 · also known as memcache

The original multi-threaded, dead-simple distributed memory cache for key-value blobs.

key-valuedatabase engineopen source (permissive)mature

Overview

Memcached is a multi-threaded, in-memory cache that does one thing: store opaque values under keys with an expiry, evicting by LRU when memory runs out. There is no persistence, replication or server-side clustering; clients hash keys across a pool of independent nodes. That simplicity is its strength, and it still runs some of the largest cache fleets in the world. Modern releases add an extstore flash tier, TLS, a meta-command protocol and a built-in proxy for routing and replication. Pick it when you need a pure cache with predictable latency and nothing else.

Strengths & trade-offs

Strengths

  • +Multi-threaded design uses every core on a box with very little tuning
  • +Extremely predictable latency and memory behaviour with slab allocation
  • +Extstore spills cold items to NVMe to cut RAM cost
  • +Protocol supported by nearly every web framework and language
  • +Tiny operational surface: no persistence, no replication state to manage

Trade-offs

  • −No persistence: a restart empties the cache
  • −Only opaque blobs; no data structures, queries or server-side scripting
  • −No built-in replication or failover outside the proxy
  • −Item size limit (1 MB default) and no secondary access paths

Great for

  • +Read-through caching of database query results
  • +Rendered page and fragment caching
  • +Session storage when losing sessions is acceptable
  • +Very large, horizontally sharded look-aside cache tiers

Think twice for

  • −Any data you cannot afford to lose
  • −Queues, pub/sub or counters with complex semantics
  • −Rich data structures (use Redis or Valkey)

Capabilities

Native or official first-party support · 2 of 25 tracked

✓TTL / expiry
✓In-memory
–Transactions
–Joins
–Secondary indexes
–Full-text search
–Vector search
–Geospatial
–JSON
–Change data capture
–Triggers
–Stored procedures
–Materialized views
–Pub/Sub
–Columnar storage
–Durable persistence
–Compression
–Encryption at rest
–Role-based access
–Time travel
–Branching
–Online schema changes
–Streaming ingest
–Offline sync
–Runs in WebAssembly

Scale & consistency

Comfortable data size
Large · ≤ 1 PB
Horizontal scaling
Manual
Multi-region
No
Transactions
None
Consistency
Eventual
Schema
Schemaless
Architecture
In memory, Single node, Client server
Query languages
Memcached text/meta protocol

Scales by adding nodes and client-side consistent hashing; the built-in proxy can route and replicate. Meta and Netflix run fleets of thousands of nodes.

Deployment

Self-hosted Vendor-managed cloud Serverless Embedded Edge Kubernetes operator

available on · AWS · Google Cloud · Alibaba Cloud · Tencent Cloud

Ecosystem

compatible withMemcached
apis & protocolsMemcached text protocol, Meta protocol, Binary protocol (deprecated)
client languagesC, Java, Python, PHP, Go, JavaScript, Ruby, C#
used byMeta, Netflix, Wikipedia

Alternatives to Memcached

Compare all→
RedisKey-Value84.3

The in-memory data structure server that became the default cache, now with search, JSON and vectors built in.

memcached vs redis →
ValkeyKey-Value58.0

The Linux Foundation's BSD-licensed fork of Redis, now the default engine on AWS and Google Cloud.

memcached vs valkey →
DragonflyKey-Value20.7

A multi-threaded, shared-nothing in-memory store that speaks Redis and Memcached on one big box.

memcached vs dragonfly →
Amazon ElastiCacheKey-Value29.1

AWS's managed Valkey, Redis OSS and Memcached service, provisioned or serverless.

memcached vs amazon-elasticache →
EhcacheKey-Value17.6

The standard embedded JVM cache, with heap, off-heap and disk tiers and optional Terracotta clustering.

memcached vs ehcache →
EVCacheKey-Value2.8

Netflix's memcached-based distributed cache with zone-aware replication, built for AWS microservices.

memcached vs evcache →

Memcached FAQ

What is Memcached?

Memcached is a key-value database by Memcached community (originally Danga Interactive), first released in 2003. Memcached is a multi-threaded, in-memory cache that does one thing: store opaque values under keys with an expiry, evicting by LRU when memory runs out. There is no persistence, replication or server-side clustering; clients hash keys across a pool of independent nodes. That simplicity is its strength, and it still runs some of the largest cache fleets in the world. Modern releases add an extstore flash tier, TLS, a meta-command protocol and a built-in proxy for routing and replication. Pick it when you need a pure cache with predictable latency and nothing else.

Is Memcached open source?

Yes. Memcached is open source. License: BSD 3-Clause.

Does Memcached support ACID transactions?

No. Memcached does not provide ACID transactions; its consistency model is eventual.

Does Memcached scale horizontally?

Memcached has no built-in sharding; scaling out means partitioning data in your application. It is comfortable at large scale (≤ 1 PB).

How can I run Memcached?

You can self-host it. Managed offerings include Amazon ElastiCache for Memcached and Memorystore for Memcached. It is available on AWS, Google Cloud, Alibaba Cloud and Tencent Cloud.

What is Memcached best for?

Memcached is a strong fit for read-through caching of database query results; rendered page and fragment caching; and session storage when losing sessions is acceptable. Think twice for any data you cannot afford to lose.

What are the best alternatives to Memcached?

Common alternatives to Memcached include Redis, Valkey, Dragonfly, Amazon ElastiCache and Ehcache. The right choice depends on your workload, scale and hosting; WhichDB's smart match ranks them against your requirements.

How popular is Memcached?

Memcached ranks #25 of 844 databases on the WhichDB Score (50.6/100), and #4 among key-value databases. The score combines public adoption signals such as package downloads, GitHub activity, job posts and developer discussion.