Skip Headers

Oracle TopLink Developer's Guide 10g Release 3 (10.1.3) B13593-01 |
| Home | Solution Area | Contents | Index

Previous | Next |

# Configuring Cache Type and Size at the Descriptor Level

The TopLink cache is an in-memory repository that stores recently read or written objects based on class and primary key values. TopLink uses the cache to do the following:

- improve performance by holding recently read or written objects and accessing them in-memory to minimize database access

- manage locking and isolation level

- manage object identity

Table 28-13 summarizes which descriptors support identity map configuration.

Table 28-13 Descriptor Support for Identity Map

Descriptor | Using TopLink Workbench | Using Java
--- | --- | ---
Relational DescriptorsFoot 1 |  |
Object-Relational Descriptors |  |
EIS DescriptorsFoot 2 |  |
XML Descriptors |  |

Footnote 1 Relational class descriptors only (see "Relational Class Descriptors").

Footnote 2 EIS root descriptors only (see "EIS Root Descriptors").

This configuration overrides the default identity map configuration defined at the project level (see "Configuring Cache Type and Size at the Project Level").

For detailed information on caching and object identity, and the recommended settings to maximize TopLink performance, see to "Cache Type and Object Identity".

For more information about the cache, see "Understanding the Cache".

## Using TopLink Workbench

To specify the identity map information for a descriptor, use this procedure:

1. Select the descriptor in the Navigator.

2. Select the Caching tab in the Editor. The Caching tab appears.

   Figure 28-25 Caching Tab, Identity Map Options

   Description of "Figure 28-25 Caching Tab, Identity Map Options"

Use the following table to enter data in following fields on the Caching tab:

Field | Description
--- | ---
Type Foot 1 | Use the Type list to choose the identity map: Weak with Soft Subcache (`SoftCacheWeakIdentityMap`) - cache first n elements in soft space, anything after that in weak space (see "Soft and Hard Cache Weak Identity Maps") Weak with Hard Subcache (`HardCacheWeakIdentityMap`) - cache first n elements in hard space, anything after that in weak space (see "Soft and Hard Cache Weak Identity Maps") Weak (`WeakIdentityMap`) - cache everything in weak space (see "Weak Identity Map") Full (`FullIdentityMap`) - cache everything permanently (see "Full Identity Map") None (`NoIdentityMap`) - cache nothing (see "No Identity Map") For more information, see "Cache Type and Object Identity". Changing the project's default identity map does not affect descriptors that already exist in the project.
Size Footref 1 | Specify the size of the cache. When using Weak with Soft Subcache or Weak with Hard Subcache, the size is the size of the subcache. When using Full or Weak, the size indicates the starting size of the identity map.
Default | When you enter a cache size, the Default check box is cleared. To reset the size to the default for the selected cache type, check the Default check box.

Footnote 1 If a descriptor is a child in an inheritance hierarchy, TopLink makes this field read only and displays the options from the parent root descriptor. For more information, see "Inheritance".

## Using Java

Use one of the following `ClassDescriptor` methods to configure the descriptor to use the appropriate type of identity map:

- `useFullIdentitMap`

- `useWeakIdentityMap`

- `useSoftCacheWeakIdentityMap`

- `useHardCacheWeakIdentityMap`

- `useNoIdentityMap`

Use the `ClassDescriptor` method `setIdentityMapSize` to configure the size of the identity map.