我想在应用程序重新启动后使缓存可用,并在配置中添加了以下行:
<disk unit="MB">100</disk>
之后,当我启动应用程序时,我有以下堆栈跟踪:
ehcache配置:
<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">
<cache alias="pow_cache">
<key-type>org.springframework.cache.interceptor.SimpleKey</key-type>
<value-type>java.lang.Double</value-type>
<expiry>
<ttl unit="seconds">120</ttl>
</expiry>
<listeners>
<listener>
<class>my.pack.CacheEventLogger</class>
<event-firing-mode>ASYNCHRONOUS</event-firing-mode>
<event-ordering-mode>UNORDERED</event-ordering-mode>
<events-to-fire-on>CREATED</events-to-fire-on>
<events-to-fire-on>EXPIRED</events-to-fire-on>
</listener>
</listeners>
<resources>
<heap unit="entries">2</heap>
<offheap unit="MB">10</offheap>
<disk unit="MB">100</disk>
</resources>
</cache>
</config>
弹簧配置:
@Configuration
@EnableCaching
public class EhcacheConfig {
@Bean
public CacheManager cacheManager() throws URISyntaxException {
JCacheCacheManager jCacheCacheManager = new JCacheCacheManager(Caching.getCachingProvider().getCacheManager(
getClass().getResource("/ehcache.xml").toURI(),
getClass().getClassLoader()
));
javax.cache.CacheManager cacheManager = jCacheCacheManager.getCacheManager();
Cache<Object, Object> powCache = cacheManager.getCache("pow_cache");
return jCacheCacheManager;
}
}
spring boot 版本是2.1.6.RELEASE ehcache 版本是3.6.3
我有什么错吗?如何纠正呢?
聚苯乙烯
我想我需要提及磁盘上缓存的文件位置,但我不知道在哪里。
HUX布斯
相关分类