-
1. Re: How to lookup individual key without updating lastUsed entry metadata?
rvansa Aug 4, 2017 12:10 PM (in response to vdzhuvinov)Cache.getAdvancedCache().getDataContainer().peek(key) - this works only for data on this node, though. What is your use case?
-
2. Re: How to lookup individual key without updating lastUsed entry metadata?
vdzhuvinov Aug 4, 2017 1:40 PM (in response to rvansa)To run periodic checks for orphaned data that is stored in two separate caches, without updating the last use timestamp.
Does the .peek(key) method involve the cache store as well, or is it just the in-memory store?
-
3. Re: How to lookup individual key without updating lastUsed entry metadata?
vdzhuvinov Aug 7, 2017 1:21 AM (in response to vdzhuvinov)Did a few tests to check the behaviour with a cache store, DataContainer.peek(key) is indeed limited to the in-memory entries only. I'm not quite sure how to proceed with that.
We ended up needing this "get without side effects" because there is an expiration listener configured, which ones fired for an entry needs to clean up a referenced entry in another cache. When an entry is expired from the cache store, the value is not shipped to the listener, which then leaves the app with orphaned entries in the second cache which need to be reaped separately.
-
4. Re: How to lookup individual key without updating lastUsed entry metadata?
rvansa Aug 7, 2017 3:48 AM (in response to vdzhuvinov)I dislike user code reaping the caches, but I don't see any general solution for your architecture.
If you want to reap through cache store, you can fetch out PersistenceManager using cache.getAdvancedCache().getComponentRegistry().getComponent(PersisenceManager.class) and call one of its purgeOnAllStores methods. However, this is not a public interface, so use it at your own risk.
-
5. Re: How to lookup individual key without updating lastUsed entry metadata?
vdzhuvinov Aug 7, 2017 6:27 AM (in response to rvansa)Thanks for the suggestion! I knew it Infinispan has got something like this