Skip to content

ConcurrentLinkedHashMap

Ben Manes edited this page Sep 22, 2015 · 7 revisions

Weigher

ConcurrentLinkedHashMap requires a minimum weight of 1. Like Guava, Caffeine allows a minimum weight of 0 to indicate that the entry will not be evicted due to a size-based policy.

Asynchronous notifications

ConcurrentLinkedHashMap processes eviction notifications from a queue that any calling thread may take from. Caffeine delegates to the configured executor (default: ForkJoinPool.commonPool()).

Computing as a Map

Guava inherits the non-atomic ConcurrentMap default computing methods (compute, computeIfAbsent, computeIfPresent, and merge). Caffeine implements atomic versions of these Java 8 additions.

Snapshot views

ConcurrentLinkedHashMap supports snapshot views in retention order. Caffeine provides this functionality in Policy.Eviction, obtained through Cache.policy(), where ascendingMapWithLimit is coldest and descendingMapWithLimit is hottest.

Serialization

ConcurrentLinkedHashMap retains the entries and discards the eviction order when serializing. Caffeine, like Guava, retains only the configuration and no data.

Clone this wiki locally