Flowryn
Flowryn

Reputation: 1447

How to get programmatically the maxBytesLocalHeap for a specific cache?

I am configuring my caches from an ehcache.xml file, among other configurations I set there the maxBytesLocalHeap for all the caches.

I also have a web interface where I have to show all the available caches, their actual size and their maximum size.

I am able to get the global maxBytesLocalHeap but I can not find a way to get this for each cache. Is there any method to do this? (Or an workaround if is not possible to get it via Ehcache public APIs)

PS: My caches are using only on-heap memory.

Upvotes: 0

Views: 304

Answers (1)

Robin Singh
Robin Singh

Reputation: 28

@Flowryn..you can get the each & every detail about each Cache using StatisticsGateway Class...Use cache.getStatistics().getLocalHeapSizeInBytes() I addition to above there are many Methods which u can use to show on your web interface...

Let me know if you need any clarification on it.

Upvotes: 1

Related Questions