我希望EhCache使用默认模板创建缓存。这是我的ehcache.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<config
xmlns:jsr107='http://www.ehcache.org/v3/jsr107'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns='http://www.ehcache.org/v3'
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 default-template="default" jsr-107-compliant-atomics="true">
</jsr107:defaults>
</service>
<cache-template name="default">
<expiry>
<ttl unit="seconds">5</ttl>
</expiry>
<heap>100</heap>
</cache-template>
<!-- <cache alias="test" uses-template="default" />--> <!-- I want to omit this. -->
</config>这是我的application.yml文件:
spring:
cache:
jcache:
config: classpath:ehcache.xml我不想每次添加需要新的缓存名称时都更新ehcache.xml。如何使用Spring配置EhCache以使用我的默认模板?
如果不指定缓存名配置,则会得到以下错误:
java.lang.IllegalArgumentException: Cannot find cache named 'test' for CacheResultOperation发布于 2022-09-21 07:20:09
我相信您错过了这个配置:
properties.put("hibernate.javax.cache.missing_cache_strategy", "create-warn"); //Use create if you don't want to see a warninghttps://stackoverflow.com/questions/59585252
复制相似问题