Infinispan数据逐出 [英] Infinispan data eviction

查看:50
本文介绍了Infinispan数据逐出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用infinispan缓存版本5.1.6.FINA.我已经配置了命名缓存:

I use infinispan cache version 5.1.6.FINA. I have configured named cache:

<namedCache name="cacheName">
    <locking lockAcquisitionTimeout="5000" />
    <eviction maxEntries="10" strategy="NONE" />
    <expiration lifespan="-1" maxIdle="-1" />
</namedCache>

我用它仅将一些数据存储在内存中.我在创建缓存的过程中使用了此配置,缓存中的键为 Long ,值为 String ,并且在那里仅保留4个元素,始终仅包含4个元素.为此,我对4个键进行了硬编码:1L,2L,3L,4L,有时只是更改这些元素的值.

I use it to store some data in memory only. I use this configuration during creating cache where key is Long and value is String and hold there only 4 elements always only 4. For this purpose I have hardcoded 4 keys: 1L, 2L, 3L, 4L and sometimes just change values of those elements.

如果缓存中包含2个元素,它们分别包含键1L和2L以及一些值,而我尝试将其他两个值与其键值相加,则它们将相互重播.因此,结果缓存仅包含3个元素,其键为1L,2L,3L或1L,2L,4L.我试图更改迁离策略,但无济于事.另外,我可以说这是本地环境,不是集群.

If cache holds 2 elements with key 1L and 2L and some values and I try to add other two with his values, they replays each other. So as a result cache holds just 3 element with keys 1L, 2L, 3L or 1L, 2L, 4L. I've tried to change eviction strategy but is doesn't help. Additionally I can say that it is local environment, non clustering.

有人可以向我解释这种行为吗?

Could someone to explain me this behavior?

推荐答案

如果您有 maxEntries = 10 ,我希望您在缓存中会有±8个条目,而不仅仅是3个.通常,答案在这里:

If you have maxEntries=10, I'd expect you would have ±8 entries in the cache, not just 3. But generally, the answer is here:

  • Cache’s number of entries never reaches configured maxEntries, why is that?
  • Advanced Eviction Internals (also described here)

这篇关于Infinispan数据逐出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆