My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Wiki pages
Links

A high performance version of java.util.LinkedHashMap for use as a software cache.

Design

  • A linked list runs through a ConcurrentHashMap to provide eviction ordering.
  • Avoids lock contention by amortizing the penalty under lock.

See the design document and the StrangeLoop conference slides (Concurrent Caching at Google).

Features

  • LRU page replacement policy (currently being upgraded to LIRS).
  • Equivalent performance to ConcurrentHashMap under load.
  • Can bound by the size of the values (e.g. Multimap cache).
  • Can notify a listener when an entry is evicted.

See the tutorial for examples of using this library.

Status

See the Changelog for version history.

Future

See the Changelog for more details and current progress.

Maven

Maven users should choose one of the dependencies based on their JDK version.

<!-- JDK 6 -->
<dependency>
  <groupId>com.googlecode.concurrentlinkedhashmap</groupId>
  <artifactId>concurrentlinkedhashmap-lru</artifactId>
  <version>1.4</version>
</dependency>

<!-- JDK 5 -->
<dependency>
  <groupId>com.googlecode.concurrentlinkedhashmap</groupId>
  <artifactId>concurrentlinkedhashmap-lru</artifactId>
  <version>1.2_jdk5</version>
</dependency>

Performance

In this benchmark an unbounded ConcurrentHashMap is compared to a ConcurrentLinkedHashMap v1.0 with a maximum size of 5,000 entries under an artificially high load (250 threads, 4-cores).

Powered by Google Project Hosting