Skip to content

Moving from ehcache to Caffeine (copyOnRead and write) #609

Answered by ben-manes
keyhan asked this question in Q&A
Discussion options

You must be logged in to vote

That is not supported by the core library. You can easily apply a copy function before adding or after reading from the cache. The core is more like a bounded ConcurrentHashMap.

The JCache module includes this concept in the standard, which combines the two settings into store-by-value. When enabled you can supply a Copier, where it defaults to Java serialization, and it copies all key/value pairs going in/out of the cache. Note that the default copier isn't recommended since native serialization is slow and prone to security problems. Unfortunately while the JCache standard is nice for integrations (e.g. Hibernate), it has a quirky api that can be frustrating for application development.…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ben-manes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants