bodhi wrote:
How do you define cache regions for collections?
In the same way you define other cache regions. The names are the same as for the collection properties in the parent class.
After some experimenting, I have come to the conclusion that collection caches contain one element per collection.
E.g. if you have an application with parent and child objects, and you expect the resident set size to be 100 parents and every parent contains on average 15 children, you would define caches as:
<!-- Parent objects -->
<cache name="com.foo.Parent"
maxElementsInMemory="100"
...other params... />
<!-- This is the collection cache, if the property is named
children, i.e. the Parent class has setChildren and
getChildren methods. Note that this cache does NOT
contain the actual elements of the collections, only
information about which id:s belong to which
collection. -->
<cache name="com.foo.Parent.children"
maxElementsInMemory="100"
... blah ... />
<!-- This cache contains the actual elements
of the collections -->
<cache name="com.foo.Children"
maxElementsInMemory="1500"
... blah blah />