We're updating the issue view to help you get more done. 

Add caching support for Caffeine

Description

Caffeine is a Java 8 rewrite of Guava's cache to provide significantly higher performance and a near optimal hit rate. Previously I co-authored Guava's Cache and ConcurrentLinkedHashMap (used by Cassandra, etc).

Caffeine's policy takes into account both the recency and frequency in O(1) time, retaining the popularity history by using a compact sketch. The concurrent throughput scales linearly (tested with 32-core) at 33% of an unbounded Java 8 `ConcurrentHashMap`. The implementation passes Guava's test suite, JSR166's TCK, and its own (consisting of over 1M test execution variants). There is about 95% code coverage and is well documented.

In comparison, Ehcache has poor performance and in v3 the hit rate was dramatically reduced. Instead of taking a random sample, an MRU heavy distribution is sampled and then the priority strategy (LRU, etc) is applied. This leads to very a poor hit rate for small caches, raising to a random policy's hit rate for large caches. Infinispan is much better in regards to efficiency, but with even worse concurrent performance due to being optimized for cache misses (not hits).

If there is interest, I'd like to contribute a module with some guidance on how to implement it.

Environment

None

Status

Assignee

Unassigned

Reporter

BenjaminM

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Minor