为什么以下ehcache.xml不允许通过JMX清除缓存(在JVisualVM中禁用了用于缓存管理的MBean操作选项卡,并启用了缓存统计)?我使用spring框架并通过ehcache.xml属性指定spring.cache.jcache.config文件位置,只使用@Cachable框架注释。
<config
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns='http://www.ehcache.org/v3'
xmlns:jsr107='http://www.ehcache.org/v3/jsr107'
xsi:schemaLocation="
http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.0.xsd
http://www.ehcache.org/v3/jsr107 http://www.ehcache.org/schema/ehcache-107-ext-3.0.xsd">
<service>
<jsr107:defaults enable-management="true" enable-statistics="true"/>
</service>
<cache alias="stringCache">
<key-type>java.lang.String</key-type>
<value-type>java.lang.String</value-type>
<heap unit="entries">2000</heap>
</cache>
</config>发布于 2017-05-25 15:21:20
JSR-107规范不支持清除缓存项。只有清除统计数据才有可能。要解决这个问题,您必须创建自己的MBean。
https://stackoverflow.com/questions/44164986
复制相似问题