Shahbour
Shahbour

Reputation: 1323

ehCache Statistics with spring boot

I have spring boot application with ehcache as below

@Bean
public EhCacheManagerFactoryBean ehCacheManagerFactoryBean() {

    EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean();
    ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));
    //ehCacheManagerFactoryBean.setCacheManagerName("messageCache");
    ehCacheManagerFactoryBean.setShared(true);
    return ehCacheManagerFactoryBean;
}

@Bean
public EhCacheCacheManager cacheManager() {
    return new EhCacheCacheManager(ehCacheManagerFactoryBean().getObject());
}

I also put @EnableCaching on root configuration file

for ehcache.xml i have the below

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:noNamespaceSchemaLocation="ehcache.xsd"
 updateCheck="true" monitoring="autodetect" dynamicConfig="true">

<diskStore path="java.io.tmpdir" />

<defaultCache maxEntriesLocalHeap="10000" eternal="false"
    timeToIdleSeconds="120" timeToLiveSeconds="120" maxEntriesLocalDisk="10000000"
    diskExpiryThreadIntervalSeconds="120" statistics="true">
</defaultCache>

<cache name="mediumCache"
       maxEntriesLocalHeap="2000"
       eternal="false"
       timeToIdleSeconds="1800"
       timeToLiveSeconds="3600"
       overflowToDisk="false"
       memoryStoreEvictionPolicy="LFU" statistics="true"
    />

<cache name="highCache"
       maxEntriesLocalHeap="2000"
       eternal="false"
       timeToIdleSeconds="3600"
       timeToLiveSeconds="7200"
       overflowToDisk="false"
       memoryStoreEvictionPolicy="LFU" statistics="true"
    />

-->

Every thing is good and my cachable function are working good , now i want to see the statistics with spring-actuator in metric .

How can we do that ?

Upvotes: 1

Views: 2241

Answers (1)

jst
jst

Reputation: 1757

If you can afford to use a snapshot release of spring boot this feature is being added to 1.3.0. Right now you won't get that in 1.2.X

Upvotes: 0

Related Questions