-
I am currently changing caching in an application from Ehcache to Caffeine, and there is one thing I cannot find an answer to, does caffeine has the copyOnRead and copyOnWrite functionality that is in in ehcache? If not, then are there any workarounds? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
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 The JCache module includes this concept in the standard, which combines the two settings into |
Beta Was this translation helpful? Give feedback.
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.…