简体   繁体   中英

Unmodifiable Cache in EhCache

I recently learned about Unmodifiable Map that returns an unmodifiable copy of the Map. Is there any such implementation that prevents the modification of data of Cache entries in EhCache?

There is no out of the box support for a read-only Cache in Ehcache 2.x or 3.x as I understand your request.

In Ehcache 2.x you could roll your own by using a cache decorator and then making them available to the CacheManager by using CacheManager.addDecoratedCache

In Ehcache 3.x there is no built-in support for decorated caches, so you would have to handle that yourself. Note that anyway since there is no longer a CacheManager singleton, this is not as bad as it sounds with regards to the way you would share the decorated cache with your application components.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM