On 21 Jul 2010, at 12:54, Navin Surtani wrote:
1 - User does a put()
2 - Interceptor checks the set of keys used within the same context to
see if the same key has been used
3 - If it has an UPDATE is used.
4 - If not we do an ADD.
Sorry, just saw this. To confirm, this should work even beyond the scope of a single
invocation, and even a single transaction, correct? E.g.,:
Tx1:
1) creates a NEW entry using cache.put()
2) new entry is indexed
Tx2 (potentially at a later date):
1) updates the entry using cache.put()
2) the index should be updated
So to that end, just checking the presence of the entry in the invocation context is not
good enough - all it will tell you is whether the entry was touched within the same scope
(whether that scope is an invocation or a transaction is irrelevant).
Mircea's solution of testing entry.isCreated() is a valid one.
Cheers
Manik
--
Manik Surtani
manik(a)jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org