-
1. Re: Replicated cache with Infinispan
nathandennis Oct 26, 2017 11:18 AM (in response to nimsys)There is a MetaParam.MetaLastUsed (Infinispan JavaDoc API) in 9.1. I believe it was something like lastUsed in 7.0.. anyway.. im pretty sure the gist is the last access reset it.
-
2. Re: Replicated cache with Infinispan
pferraro Oct 27, 2017 4:56 PM (in response to nimsys)1 of 1 people found this helpfulInfinispan's max-idle logic is based on a the lastUsed attribute of a cache entry's meta data (see infinispan/TransientMortalCacheEntry.java at 8.2.x · infinispan/infinispan · GitHub ). While lastUsed is updated on both read and write (i.e. get and put), it is only replicated on write (not read), and therefore is not recommended for use with replicated/distributed caches. This is a known limitation of Infinispan's max-idle based expiration. See: Infinispan: Expiration Enhancements
-
3. Re: Replicated cache with Infinispan
nimsys Oct 30, 2017 3:08 AM (in response to pferraro)Thank you very much Paul for the answer. Yes the link you provided is very clear about it. It's a bit late to back out of the replicated solution now, so I guess we'll just have to stick with writes to keep entries alive
-
4. Re: Replicated cache with Infinispan
pferraro Oct 30, 2017 8:09 AM (in response to nimsys)There are some workarounds. If you cache entries are particularly large, making superfluous writes expensive, you can split your entries into 2 (using key wrappers): one containing a single timestamp/counter that you always update using AdvancedCache.put(K, MetaData) with a maxIdle value, and the other immortal entry containing your value. You can then use a expiration event to cascade the expiration of the timestamp entry to remove the corresponding entry containing your value.
-
5. Re: Replicated cache with Infinispan
nimsys Oct 31, 2017 9:35 AM (in response to pferraro)Nice workaround.
In plain text they can be about 100-200 kb but I Gzip them and store values as byte arrays which reduces the size by up to 90%. Your solution seems even more effective though and I will definately consider it.
Thanks again!