AFAIK, collection caches are removed if a cache setting for that region forces so or a cluster invalidation message is received by your cache. As in your case I believe you are fine. Hibernate does not actually cache object instances in a collection, and it only caches the keys to objects in an association. Therefore, if a new item is added to the system it has nothing to do with your collection cache. However, if an Item that is already in an association is updated you will get the updated Item object the next time you fetch the object from cache. To make things clear, imagine this example: You have three items in your cache:
[1]=[Soap]
[2]=[Bread]
[5]=[Milk]
and your customer is:
[1]=['Someone', 'Somewhere', [2,5]]
In this example [2,5] is the relation between items and the customer keyed 1.
Does this answer your question?
|