StackShareStackShare
Follow on
StackShare

Discover and share technology stacks from companies around the world.

Follow on

© 2025 StackShare. All rights reserved.

Product

  • Stacks
  • Tools
  • Feed

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Service
  1. Stackups
  2. Application & Data
  3. Languages
  4. Java Tools
  5. Ehcache vs guava

Ehcache vs guava

OverviewDecisionsComparisonAlternatives

Overview

guava
guava
Stacks2.2K
Followers193
Votes6
GitHub Stars51.2K
Forks11.1K
Ehcache
Ehcache
Stacks616
Followers160
Votes4
GitHub Stars2.1K
Forks585

Ehcache vs guava: What are the differences?

Introduction

This article discusses the key differences between Ehcache and Guava, two popular caching libraries used in software development.

  1. In-Memory Caching vs Caching Utilities:

    • Ehcache is primarily an in-memory caching library that allows developers to store and retrieve data in memory for fast access. On the other hand, Guava is a general-purpose caching utility library that provides caching functionality along with other utility classes.
  2. Cache Eviction Policies:

    • Ehcache offers a wide range of cache eviction policies such as LRU (Least Recently Used), LFU (Least Frequently Used), and FIFO (First In, First Out). These policies determine which cache entries to remove when the cache reaches its maximum capacity. In contrast, Guava's caching utilities use a simpler eviction policy based on the size of the cache and a combination of time-based and reference-based cache eviction.
  3. Distributed Caching Support:

    • Ehcache provides built-in support for distributed caching, allowing multiple instances of an application to share a common cache. On the other hand, Guava does not offer native support for distributed caching and is primarily designed for single-instance caching scenarios.
  4. Cache Loading Strategies:

    • Ehcache supports various cache loading strategies such as manual loading, lazy loading, and asynchronous loading. These strategies dictate when and how cache entries are loaded into the cache. In contrast, Guava does not provide built-in support for cache loading strategies and requires developers to manually load cache entries.
  5. Integration with Java EE Standards:

    • Ehcache is integrated with Java EE standards and can be easily used in Java EE applications. It supports features such as caching annotations, declarative configuration, and integration with Java EE frameworks. On the other hand, Guava is a standalone library and does not have direct integration with Java EE standards.
  6. Cache Statistics and Monitoring:

    • Ehcache provides extensive cache statistics and monitoring features, allowing developers to gain insights into the cache's performance, hit/miss ratio, and memory usage. Guava, on the other hand, provides limited cache statistics functionality and lacks detailed monitoring features.

In summary, Ehcache is primarily an in-memory caching library with distributed caching support, various cache eviction policies, cache loading strategies, and integration with Java EE standards. Guava, on the other hand, is a general-purpose caching utility library with a simpler cache eviction policy, no native distributed caching support, no built-in cache loading strategies, and limited cache statistics and monitoring features.

Share your Stack

Help developers discover the tools you use. Get visibility for your team's tech choices and contribute to the community's knowledge.

View Docs
CLI (Node.js)
or
Manual

Advice on guava, Ehcache

Francisco José
Francisco José

Software engineer

Nov 9, 2019

Needs advice

Hi guys! I need an in-memory key/value storage with a lifespan for each key What do you recommend me to use? I was thinking about using a ConcurrentHashMap, with a scheduled thread evicting keys when apply. In fact, it is a possibility due because the performance is not important. But, on the other side, I have considered using any library such as Memcached, Ehcache, guava...

9.89k views9.89k
Comments

Detailed Comparison

guava
guava
Ehcache
Ehcache

The Guava project contains several of Google's core libraries that we rely on in our Java-based projects: collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O, and so forth.

Ehcache is an open source, standards-based cache for boosting performance, offloading your database, and simplifying scalability. It's the most widely-used Java-based cache because it's robust, proven, and full-featured. Ehcache scales from in-process, with one or more nodes, all the way to mixed in-process/out-of-process configurations with terabyte-sized caches.

Statistics
GitHub Stars
51.2K
GitHub Stars
2.1K
GitHub Forks
11.1K
GitHub Forks
585
Stacks
2.2K
Stacks
616
Followers
193
Followers
160
Votes
6
Votes
4
Pros & Cons
Pros
  • 5
    Interface Driven API
  • 1
    Easy to setup
Pros
  • 1
    Easy setup
  • 1
    Simpler to run in testing environment
  • 1
    Container doesn't have to be running for local tests
  • 1
    Way Faster than Redis and Elasticache Redis

What are some alternatives to guava, Ehcache?

Quarkus

Quarkus

It tailors your application for GraalVM and HotSpot. Amazingly fast boot time, incredibly low RSS memory (not just heap size!) offering near instant scale up and high density memory utilization in container orchestration platforms like Kubernetes. We use a technique we call compile time boot.

MyBatis

MyBatis

It is a first class persistence framework with support for custom SQL, stored procedures and advanced mappings. It eliminates almost all of the JDBC code and manual setting of parameters and retrieval of results. It can use simple XML or Annotations for configuration and map primitives, Map interfaces and Java POJOs (Plain Old Java Objects) to database records.

Thymeleaf

Thymeleaf

It is a modern server-side Java template engine for both web and standalone environments. It is aimed at creating elegant web code while adding powerful features and retaining prototyping abilities.

JSF

JSF

It is used for building component-based user interfaces for web applications and was formalized as a standard through the Java Community

JavaMelody

JavaMelody

It is used to monitor Java or Java EE application servers in QA and production environments. It is not a tool to simulate requests from users, it is a tool to measure and calculate statistics on real operation of an application depending on the usage of the application by users. It is mainly based on statistics of requests and on evolution charts.

RxJava

RxJava

A library for composing asynchronous and event-based programs by using observable sequences for the Java VM.

MapStruct

MapStruct

It is a code generator that greatly simplifies the implementation of mappings between Java bean types based on a convention over configuration approach. The generated mapping code uses plain method invocations and thus is fast, type-safe and easy to understand.

Java 8

Java 8

It is a revolutionary release of the world’s no 1 development platform. It includes a huge upgrade to the Java programming model and a coordinated evolution of the JVM, Java language, and libraries. Java 8 includes features for productivity, ease of use, improved polyglot programming, security and improved performance.

Apache FreeMarker

Apache FreeMarker

It is a "template engine"; a generic tool to generate text output (anything from HTML to auto generated source code) based on templates. It's a Java package, a class library for Java programmers.

Jackson

Jackson

It is a suite of data-processing tools for Java (and the JVM platform), including the flagship streaming JSON parser / generator library, matching data-binding library (POJOs to and from JSON) and additional data format modules to process data encoded in Avro, BSON, CBOR, CSV, Smile, (Java) Properties, Protobuf, XML or YAML; and even the large set of data format modules to support data types of widely used data types such as Guava, Joda.

Related Comparisons

Bootstrap
Materialize

Bootstrap vs Materialize

Laravel
Django

Django vs Laravel vs Node.js

Bootstrap
Foundation

Bootstrap vs Foundation vs Material UI

Node.js
Spring Boot

Node.js vs Spring-Boot

Liquibase
Flyway

Flyway vs Liquibase