【发布时间】:2017-04-14 13:10:58
【问题描述】:
我想要完成的是为缓存设置 TTL(生存时间)和 TTI(空闲时间),以便密钥在 TTL 时间之后过期,或者可以提前过期,以防万一'在 TTI 期间未被访问。
在 Ehcache 2 中,可以使用以下配置:
<cache name="my.custom.Cache"
timeToIdleSeconds="10"
timeToLiveSeconds="120">
</cache>
在 Ehcache 3 中,类似的配置块如下所示:
<cache alias="my.custom.Cache">
<expiry>
<tti unit="seconds">10</tti>
<ttl unit="minutes">2</ttl>
</expiry>
</cache>
问题是这样的配置被认为是无效的,因为ehcache.xsd 声明expiry 标签下应该只有 一个 选项(tti 或ttl,但不能同时使用) .
【问题讨论】:
标签: java xsd ehcache ehcache-3