[infinispan-dev] Cache entry not invalidated callback?

Galder Zamarreno galder at redhat.com
Wed Oct 28 05:29:55 EDT 2009


Hi,

Re: Porting over 
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3818 to 
Infinispan 2nd level cache.

For HHH-3818, Brian used the cache as a bus to notify that the cache 
contents where invalid. To do so, he implemented cache entry modified 
and invalidated callbacks that react to cache modifications or 
invalidations where the FQN is an internal fqn which contains the local 
address.

Now, the trick he uses for the invalidation is that on startup or 
whenever there's a view change, he establishes these internal FQNs in 
each node for each of the members in the cluster, i.e. 
fqn=/test/com/foo/test/ENTITY/NODE/127.0.0.1:39104

So, in an invalidation scenario, if you a node puts something on 
/test/com/foo/test/ENTITY/NODE/127.0.0.1:39104, the other nodes have at 
least /test/com/foo/test/ENTITY/NODE/127.0.0.1:39104 created on their 
caches which means that the invalidation callback works fine cos the FQN 
exists in other nodes.

Now, in Infinispan's case, bearing in mind that there're no FQNs, I 
could set up such keys when there's a view change too. However, I was 
thinking of another alternative.

Currently, cache invalidation callback fails on Infinispan because when 
you do a put on key=127.0.0.1:39104, the other nodes do not contain the 
key=127.0.0.1:39104, so no invalidation callback is received. So, my 
suggestion is the following:

Why not have a callback saying: "I attempted to do an invalidation on 
k=x but k=x did not exist". Maybe something like 
CacheEntryNotInvalidated callback? It looks to me that it'd be 
relatively simply to implement such notification and would simplify the 
code on the Infinispan 2nd level cache provider.

Thoughts?
-- 
Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache



More information about the infinispan-dev mailing list