我想在应用程序重新启动后使缓存可用,并在配置中添加了以下行:<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@EnableCachingpublic 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我有什么错吗?如何纠正呢?聚苯乙烯我想我需要提及磁盘上缓存的文件位置,但我不知道在哪里。
1 回答
HUX布斯
TA贡献1876条经验 获得超6个赞
我已经添加
<persistence directory="spring-boot-ehcache/cache" />
<cache>
在标签和堆栈跟踪消失之前
添加回答
举报
0/150
提交
取消