Can I retrieve an expired cache entry from an Infinispan server listener using @ClientCacheEntryExpired?

191 Views Asked by At

I am modifying an embedded Infinispan application to use the Infinispan server and HotRod client. The embedded implementation relied on detecting cache expiration events in a listener. Using the "pre" event, I am able to read the expired entry and update external data.

This functionality spared me from having to write my own reaper, but as far as I can tell the HotRod client implementation does not provide the same capability. I can detect the expiration with a @ClientCacheEntryExpired, but apparently the event fires after the entry is removed from the cache and the only data available to the listener is the key.

Is there a (simple) way to duplicate the embedded behavior? Or will I have to implement my own expiration reaper?

1

There are 1 best solutions below

0
On

You can customize the event (see Documentation) to include the removed value, but the event will always be triggered after the removal.

Offtopic; the Infinispan server can communicate with a JDBC store (Documentation) and you can configure eviction with write-behind persistence to store your data externally (see Eviction and Write-Behing documentation).