How to set total heap size limit at CacheManager level with Ehcache 3.x

45 views
Skip to first unread message

Jong Kim

unread,
Dec 16, 2024, 7:02:28 PM12/16/24
to ehcache-users
I have an application that uses Ehcache 2.x. It sets total heap size limit using the following method at the CacheManager level across all caches managed by the specific manager instance.

Configuration config = ...;
config.setMaxBytesLocalHeap(maxBytesLocalHeap);
CacheManager cacheManager = CacheManager.newInstance(config);

I could not find equivalent method to achieve to same effect with Ehcache 3.x. The only methods that I found were the one for setting the limit on individual cache and one that defines the default limit for cache. Both define the limit at the individual cache level, as opposed to at the cache manager. What I want is the ability to limit the "total" size of heap used irrespective of how much individual caches use.

How do I achieve this? Any tip would be greatly appreciated.

Thanks in advance.
/Jong
Reply all
Reply to author
Forward
0 new messages