Cuero
Cuero

Reputation: 1209

How to get size of EhCache in version 3.1

I know there is getSize() function in EhCache 2, but there is no getSize() anymore in Cache in version 3. Thus how to getSize()?

Thanks.

Upvotes: 1

Views: 3800

Answers (2)

loicmathieu
loicmathieu

Reputation: 5562

You can access the size of a cache in both the number of entries and bytes using the statistic service.

I explain in this answer how to configure it and gather the statistics : I answer this question here : https://stackoverflow.com/a/49304590/3603660

Upvotes: 0

Lefty G Balogh
Lefty G Balogh

Reputation: 1898

Cuero, by the looks of it, the 3.0 documentation examples still include getSize(). Check out the code example here: http://www.ehcache.org/documentation/3.0/getting-started.html#update-resourcepools

cache.getRuntimeConfiguration().getResourcePools()
.getPoolForResource(ResourceType.Core.HEAP).getSize()

Does that solve your issue?

Upvotes: 1

Related Questions