I am using JCache API to configure caches in my application that uses spring caching with Ehcache 3.
cacheManager.createCache("users", new MutableConfiguration<String, User>()
.setStoreByValue(false)
.setManagementEnabled(true)
.setStatisticsEnabled(true)
.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(Duration.TEN_MINUTES)));
How can I limit cache size to say 50 entries? It is easy to do it via Ehcache XML configuration but if there is a way to control this using JCache config API I would prefer to use that.