vs

Ehcache vs Memcached

Ehcache: The standard embedded JVM cache, with heap, off-heap and disk tiers and optional Terracotta clustering. Memcached: The original multi-threaded, dead-simple distributed memory cache for key-value blobs.

key differences

  • Memcached is built for larger datasets (≤ 1 PB) than Ehcache (≤ 100 GB).
  • Horizontal scaling is addon in Ehcache and manual in Memcached.
  • Transactions: Ehcache offers limited ACID; Memcached offers none.
  • Only Ehcache has durable persistence.
  • Ehcache can run embedded in your application process.

choose ehcache for

  • +Hibernate second-level cache
  • +Spring @Cacheable method caching
  • +Local caching of reference data in JVM services

best at · Cache, Embedded

choose memcached 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

best at · Cache, Sessions

overview
Primary model
Key-Value
Key-Value
Also supports
–
–
Type
Embedded library
Database engine
Status
Active
Active
Developer
Terracotta (IBM)
Memcached community (originally Danga Interactive)
First release
2003
2003
Latest version
3.12.0 (Apr 3, 2026)
1.6.45 (Jul 9, 2026)
License
Open source (permissive)Apache License 2.0
Open source (permissive)BSD 3-Clause
Free tier
✓
✓
popularity
WhichDB Score
17.6
50.6
Rank
#188
#25
GitHub stars
2.1K
14.3K
Stack Overflow questions
2.4K
5.2K
scale & guarantees
Comfortable data size
Small (≤ 100 GB)
Large (≤ 1 PB)
Horizontal scaling
Addon
Manual
Multi-region
None
None
ACID
Limited
None
Consistency
Strong, Eventual
Eventual
Schema
Schemaless
Schemaless
Architecture
Embedded, In memory
In memory, Single node, Client server
deployment
Self-hosted
✓
✓
Vendor-managed cloud
—
—
Serverless
—
—
Embedded
✓
—
Edge
—
—
Clouds
–
AWS, Google Cloud, Alibaba Cloud, Tencent Cloud
capabilities
Transactions
—
—
Joins
—
—
Secondary indexes
—
—
Full-text search
—
—
Vector search
—
—
Geospatial
—
—
JSON
—
—
Change data capture
—
—
Triggers
—
—
Stored procedures
—
—
Materialized views
—
—
TTL / expiry
✓
✓
Pub/Sub
—
—
Columnar storage
—
—
In-memory
✓
✓
Durable persistence
✓
—
Compression
—
—
Encryption at rest
—
—
Role-based access
—
—
Time travel
—
—
Branching
—
—
Online schema changes
—
—
Streaming ingest
—
—
Offline sync
—
—
Runs in WebAssembly
—
—
interfaces
Query languages
Java API
Memcached text/meta protocol
Client languages
Java
C, Java, Python, PHP, Go, JavaScript, Ruby, C#
Best for
Cache, Embedded
Cache, Sessions

Ehcache vs Memcached: FAQ

What is the difference between Ehcache and Memcached?

Ehcache: The standard embedded JVM cache, with heap, off-heap and disk tiers and optional Terracotta clustering. Memcached: The original multi-threaded, dead-simple distributed memory cache for key-value blobs. Memcached is built for larger datasets (≤ 1 PB) than Ehcache (≤ 100 GB). Horizontal scaling is addon in Ehcache and manual in Memcached. Transactions: Ehcache offers limited ACID; Memcached offers none.

When should I choose Ehcache over Memcached?

Choose Ehcache for hibernate second-level cache, spring @Cacheable method caching and local caching of reference data in JVM services. Choose Memcached for read-through caching of database query results; rendered page and fragment caching; and session storage when losing sessions is acceptable.

Is Ehcache or Memcached more popular?

Memcached ranks #25 on the WhichDB Score (50.6/100) and Ehcache ranks #188 (17.6/100). Popularity is not fit: check the requirements that matter for your project.

Are Ehcache and Memcached open source?

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