[
https://issues.apache.org/jira/browse/OFBIZ-6747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16507108#comment-16507108 ]
Ben Manes commented on OFBIZ-6747:
----------------------------------
The two libraries do share a compatible interface via {{ConcurrentMap}}. That is the interface for {{ConcurrentLinkedHashMap}} and provided by Caffeine's {{Cache.asMap()}} view. You are welcome to abstract out caching as you see fit, as neither are invasive (e.g. no singleton {{CacheManager}} or configuration files - those are for applications to introduce and manage).
{{ConcurrentLinkedHashMap}} was written for Java 5, so it does not provide atomic versions of the new default methods such as {{computeIfAbsent}}. I believe that the copy embedded by Groovy did add this, if you want to follow their example. The library is tiny, so many brought it under their own umbrella to avoid external dependencies (e.g. another example is SQL Server's JDBC driver).
Unfortunately most other caching libraries do no support {{ConcurrentMap}}, so bridging them might be difficult. You may instead prefer to have a custom {{Cache}} interface with only the methods your project finds useful to minimize the effort. Another option is {{JSR107 JCache}} but be warned that it is riddled with problems, highly flawed, and results in a very frustrating developer experience. While the JSR was approved, it was rejected by JavaEE (both EE7 and EE8) and not widely adopted by consuming frameworks / applications.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)