infinispan缓存服务器到期失败 [英] infinispan cache server expiration failure
问题描述
我使用infinispan-5.1.6.FINAL作为远程缓存服务器和热棒协议来访问它。但发现它没有按预期工作,即按照以下配置在1ms后没有逐出密钥的缓存值
I am using infinispan-5.1.6.FINAL as a remote-cache server and hot-rod protocol to access it. but found the is not working as intended, i.e cached value of a key is not evicted after 1ms as per the config below
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:infinispan="urn:infinispan:config:5.1"
xsi:schemaLocation="urn:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd">
<global >
<globalJmxStatistics enabled="true"/>
</global>
<namedCache name="my-cache">
<expiration lifespan="1" maxIdle="1" reaperEnabled="true" wakeUpInterval="1" />
</namedCache>
</infinispan>
我爆炸了战争(infinispan-5.1.6.FINAL/modules/rest/infinispan-server-rest .war),保存了上面的配置,更改了web.xml以使用它并部署在tomcat 6.0.32中
I exploded war (infinispan-5.1.6.FINAL/modules/rest/infinispan-server-rest.war), saved the above config, changed web.xml to use it and deployed in tomcat 6.0.32
我能够放入缓存并从中检索,通过此资源
I was able to put into the cache and retrieve from it, by this resource
http://localhost:8080/infinispan-server-rest/rest/my-cache/1
但即使在10分钟后该条目也不会被驱逐。顺便说一下,相同的配置工作在嵌入式缓存模式。
but the entry is not evicted even after 10mins. btw the same config was working in embedded-cache mode.
我错过了什么吗?我怎样才能使这个工作?
did I miss something? how can I get this working?
推荐答案
REST服务器的默认行为是无限期地存储条目,而不管缓存设置如何。如果要使用缓存的默认过期设置,则必须指定 timeToLiveSeconds = 0
和 maxIdleTimeSeconds = 0
。
The default behaviour of the REST server is to store entries indefinitely, regardless of the cache settings. If you want to use the default expiration settings of the cache, you have to specify timeToLiveSeconds=0
and maxIdleTimeSeconds=0
.
这可能会在将来的版本中发生变化,请参阅 https://community.jboss.org/message/796785#796785 。
This may change in future releases, see https://community.jboss.org/message/796785#796785.
这篇关于infinispan缓存服务器到期失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!