[英]How to enable Ehcache 3.x JSR-107 MBean operations?
为什么以下 ehcache.xml 不允许通过 JMX 清除缓存(在 JVisualVM for MBean 中禁用操作选项卡以进行缓存管理并启用缓存统计)? 我使用 spring 引导框架并通过 spring.cache.jcache.config 属性指定 ehcache.xml 文件位置,并且只使用 @Cachable spring 框架注释。
<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>
JSR-107 规范不支持清除缓存条目。 只能清除统计信息。 要解决此问题,您必须创建自己的 MBean。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.