[jboss-user] [JBoss Cache Users] - Invalidation-only cache

adamw do-not-reply at jboss.com
Tue Sep 22 07:55:09 EDT 2009


here's my scenario: I want to keep some objects in cache, which are calculated basing on some persistent state (DB lets say). Rarely, the persistent state changes, and the objects have to be re-calculated (lazily). So, on a change, I want to invalidate all items. Additionally, this happens in a cluster, so the invalidation must be cluster-wide, although the change notification is received only in one node. The calculated objects aren't serializable so each node must calculate them independently.

I was trying to solve this with a cache in the INVALIDATION_SYNC mode and a cache loader. The cache loader is responsible for calculating the objects (I also get the laziness here) in each node. When a change happens, I simple call remove(), which invalidates entries in all nodes (because of the mode). When a get() is later called, the objects are read using the cache loader.

Now this works fine as along as I don't use transactions. When I start to use transactions, the get() call after a remove() call (in the same TX) doesn't call the cache loader, but returns null. This is quite logical and ok in the normal cases, but not in mine.  Do you have any other suggestions on how to achieve the above functionality with transactions?


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4256360#4256360

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4256360

More information about the jboss-user mailing list