Ehcache

active

by Terracotta (IBM) · since 2003 · also known as Ehcache 3

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

key-valueembedded libraryopen source (permissive)mature

Overview

Ehcache is an embedded Java caching library and one of the most widely deployed JCache (JSR-107) implementations, used for Hibernate second-level caching and Spring's cache abstraction. Ehcache 3 stores entries across on-heap, off-heap and local disk tiers, and can be clustered through a Terracotta server. It is maintained by the Terracotta team, whose published artifacts now list IBM as the owning organisation. Releases are infrequent but ongoing (3.12.0 in April 2026). Use it when you want in-process caching in a JVM app, not a network cache.

Strengths & trade-offs

Strengths

  • +Zero-network-hop reads from the application's own memory
  • +Off-heap tier holds large caches without GC pressure
  • +Drop-in JCache provider for Spring and Hibernate
  • +Mature and stable with a small API surface

Trade-offs

  • −JVM-only and embedded; not a shared cache by itself
  • −Clustering needs a separate Terracotta server
  • −Slow release cadence and modest community activity
  • −Caffeine is usually faster for pure on-heap caching

Great for

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

Think twice for

  • −Cross-service shared caches (use Redis/Valkey)
  • −Non-JVM languages

Capabilities

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

✓TTL / expiry
✓In-memory
✓Durable persistence
–Transactions
–Joins
–Secondary indexes
–Full-text search
–Vector search
–Geospatial
–JSON
–Change data capture
–Triggers
–Stored procedures
–Materialized views
–Pub/Sub
–Columnar storage
–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
Small · ≤ 100 GB
Horizontal scaling
Addon
Multi-region
No
Transactions
Limited ACID
Consistency
Strong, Eventual
Schema
Schemaless
Architecture
Embedded, In memory
Query languages
Java API

In-process per JVM; sharing across nodes requires a Terracotta server cluster.

Deployment

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

Ecosystem

apis & protocolsJCache (JSR-107), Ehcache API
client languagesJava

Alternatives to Ehcache

Compare all→
InfinispanKey-Value28.8

Red Hat's open-source distributed cache and key-value store, embeddable or as a RESP-compatible server.

ehcache vs infinispan →
HazelcastKey-Value33.5

A Java in-memory data grid and stream processor that embeds in your app or runs as a cluster.

ehcache vs hazelcast →
RedisKey-Value84.3

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

ehcache vs redis →
MemcachedKey-Value50.6

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

ehcache vs memcached →
Oracle CoherenceKey-Value15.7

Oracle's long-running Java data grid, with a UPL-licensed Community Edition on GitHub.

ehcache vs oracle-coherence →
Chronicle MapKey-Value8.7

Off-heap, memory-mapped key-value store for Java with microsecond latency and cross-process sharing.

ehcache vs chronicle-map →

Ehcache FAQ

What is Ehcache?

Ehcache is a key-value database by Terracotta (IBM), first released in 2003. Ehcache is an embedded Java caching library and one of the most widely deployed JCache (JSR-107) implementations, used for Hibernate second-level caching and Spring's cache abstraction. Ehcache 3 stores entries across on-heap, off-heap and local disk tiers, and can be clustered through a Terracotta server. It is maintained by the Terracotta team, whose published artifacts now list IBM as the owning organisation. Releases are infrequent but ongoing (3.12.0 in April 2026). Use it when you want in-process caching in a JVM app, not a network cache.

Is Ehcache open source?

Yes. Ehcache is open source. License: Apache License 2.0.

Does Ehcache support ACID transactions?

Partly. Ehcache offers limited ACID guarantees (for example, single-record or single-partition transactions), with strong, eventual consistency.

Does Ehcache scale horizontally?

Ehcache scales horizontally through an official extension, proxy or edition rather than in the core engine. It is comfortable at small scale (≤ 100 GB).

How can I run Ehcache?

You can self-host it and embed it in your application.

What is Ehcache best for?

Ehcache is a strong fit for hibernate second-level cache, spring @Cacheable method caching and local caching of reference data in JVM services. Think twice for cross-service shared caches (use Redis/Valkey).

What are the best alternatives to Ehcache?

Common alternatives to Ehcache include Infinispan, Hazelcast, Redis, Memcached and Oracle Coherence. The right choice depends on your workload, scale and hosting; WhichDB's smart match ranks them against your requirements.

How popular is Ehcache?

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