Skip Headers

# Soft and Hard Cache Weak Identity Maps

Previous

Next

This option is similar to the weak identity map except that it maintains a most frequently used subcache. The subcache uses soft or hard references to ensure that these objects are garbage-collected only if the system is low on memory.

The soft cache weak identity map and hard cache weak identity map provide more efficient memory use. They release objects as they are garbage-collected, except for a fixed number of most recently used objects. Note that weakly cached objects might be flushed if the transaction spans multiple client/server invocations. The size of the subcache is proportional to the size of the identity map as specified by the `Descriptor` method `setIdentityMapSize`. You should set this cache size to be as large as the maximum number of objects (of the same type) referenced within a transaction (see "Configuring Cache Type and Size at the Descriptor Level").

Oracle recommends using this identity map in most circumstances as a means to control memory used by the cache.

For more information, see "Understanding the Internals of Soft and Hard Cache Weak Identity Map".