I am working with infinispan cache (7.1.0.Final) in a maven application running on wildfly 10.1.0.Final.
Caching is working fine, I am using the automatic caching approach with @CacheResult, @CacheRemove, @CacheRemoveAll annotations and defined the interceptors in beans.xml (CacheResultInterceptor, CachePutInterceptor, CacheRemoveAllInterceptor, CacheRemoveEntryInterceptor).
I did not find a way to retrieve number of entries in javax.cache.Cache. Returned cache is instance of org.infinispan.jcache.JCache, no way either to get the count.
I thought as another option to make a custom entry listener and perform the counting on onCreated, onRemoved and onExpired entry events. It sounds a bit dirty ... I could not test that yet, but I think there should be a clever solution to this.
Any help is appreciated.
Best, Juan