-
Does Caffeine support cache regions or a cache manager? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 6 replies
-
The core library is just a data structure with no extra lifecycle, like a HashMap. It doesn't include any concepts of a manager or region owner, it's just a map that includes eviction policies. The JCache module implements jsr107 which defines a CacheManager and lifecycle. This is a standard that was rejected by JEE / Jakarta, most modern frameworks, and has low adoption. The API is error prone so it is mostly used in cases like Hibernate which was an early adopter. Otherwise frameworks like Quarkus, Spring, and others incorporate their own cache managers. Their integrations are simple because they don't have to bridge different lifecycles and can manage everything directly. These tend to differ substantially, like Apache HBase's cache management is very different to Apache Solr's, yet both use Caffeine to manage the state. |
Beta Was this translation helpful? Give feedback.
-
Thank you so much for your detailed answer. I really appreciate you taking the time. This guides me further in our decision of choice. We want a lightweight and performance option for our framework. If it's not much to ask, how would you compare caffeine vs. guava cache? Do you have any guidance, pros, cons, or personal experience? |
Beta Was this translation helpful? Give feedback.
-
Thanks again @ben-manes , really appreciate it. I am guessing you are in CET since you are answering quite fast :). I am in Spain currently. This makes our choice easier to make. |
Beta Was this translation helpful? Give feedback.
-
Ok, another question. I don't see a way to provide an expiration on a per-item case. It's this by design? |
Beta Was this translation helpful? Give feedback.
-
I have seen the |
Beta Was this translation helpful? Give feedback.
The core library is just a data structure with no extra lifecycle, like a HashMap. It doesn't include any concepts of a manager or region owner, it's just a map that includes eviction policies.
The JCache module implements jsr107 which defines a CacheManager and lifecycle. This is a standard that was rejected by JEE / Jakarta, most modern frameworks, and has low adoption. The API is error prone so it is mostly used in cases like Hibernate which was an early adopter.
Otherwise frameworks like Quarkus, Spring, and others incorporate their own cache managers. Their integrations are simple because they don't have to bridge different lifecycles and can manage everything directly. These tend to…