Eviction data in Infinispan

I am using infinispan cache version 5.1.6.FINA. I set up a named cache:

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

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

If there are 2 elements in the cache with keys 1L and 2L and some values, and I try to add the other two with its values, they will repeat each other. Thus, as a result, the cache contains only 3 elements with the keys 1L, 2L, 3L or 1L, 2L, 4L. I tried to change the eviction strategy, but that doesn't help. In addition, I can say that this is a local environment, not clustering.

Can someone explain this behavior to me?

+1
source share
1 answer

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

+1
source

Source: https://habr.com/ru/post/1274927/


All Articles