When we delete some special data, we mark it deleted instead of deleting it right away, and then we put the now-marked-deleted data in the cache, which replicates it across the cluster.
When clients read this special data from the cache, they see that it's deleted and can act accordingly (filtering it out).
Over time, all of the caches in a cluster have the version of the data that's marked deleted. Once that happens, they will no longer write that data to the database.
This is a lazy, robust way to gradually delete the data across a cluster--and it means we can do everything using ASYNC and not care about two-phase commits.
Once everything stabilizes, we can actually delete the marked-deleted data from the database. Before doing that, however, we want to delete it from all of the caches.
We would like for our garbage collector to not have to connect to each cache and tell it to delete the data. We'd like to delete the data from one node and have invalidation be sent for that node to the other caches in the cluster. That way our garbage collector only has to have one database connection and know about one app server.
What's the best way to accomplish that in 3.x?
We are currently just calling theCache.removeNode(the node to delete), but:
1) That seems pretty harsh. We tried to find something more like theNode.invalidate(), but don't see that in the API anywhere.
2) Does removeNode send invalidations to the other caches in a cluster? If not, what method should we be calling?
removeNode() is a clustered call and will cause removal on all instances in the cluster. It is also as efficient as an invalidate message (just sends an Fqn).
In fact, the only difference between removeNode() and invalidate is that invalidate will not affect any cache loaders configured (if any) while removeNode() will.