<bean id="ehCacheManagementService" class="net.sf.ehcache.management.ManagementService" init-method="init" lazy-init="false">
<constructor-arg>
<bean class="net.sf.ehcache.CacheManager" factory-method="getInstance"/>
</constructor-arg>
<constructor-arg>
<bean class="org.springframework.jmx.support.JmxUtils" factory-method="locateMBeanServer"/>
</constructor-arg>
<constructor-arg value="true"/>
<constructor-arg value="true"/>
<constructor-arg value="true"/>
<constructor-arg value="true"/>
</bean>
<bean id="ehCacheManagementService" class="net.sf.ehcache.management.ManagementService" init-method="init" lazy-init="false">
<constructor-arg>
<bean class="net.sf.ehcache.CacheManager" factory-method="getInstance"/>
</constructor-arg>
<constructor-arg>
<bean class="org.springframework.jmx.support.JmxUtils" factory-method="locateMBeanServer"/>
</constructor-arg>
<constructor-arg value="true"/>
<constructor-arg value="true"/>
<constructor-arg value="true"/>
<constructor-arg value="true"/>
</bean>
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
ManagementService.registerMBeans(CacheManager.getInstance(), mbeanServer, true, true, true, true);
ManagementService.registerMBeans(CacheManager.getInstance(), mbeanServer, true, true, true, true);
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
您可以以这种方式获取 cache hits, misses, in-memory hits, disk hits, size stats。您还可以即时更改 CacheConfiguration 参数。