Skip Headers
Oracle® Application Server TopLink Application Developer's Guide
10g Release 2 (10.1.2)
Part No. B15901-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Cache Locking and Isolation

By default, OracleAS TopLink optimizes concurrency to minimize cache locking during reads or writes. Use the default OracleAS TopLink isolation level unless you have a specific reason to change it.

Use the following application programming interface (API) on Databaselogin to change the OracleAS TopLink isolation level:

login.setCacheTransactionIsolation(int cacheTransactionIsolation)

The available settings for cacheTransactionIsolation are:

Configuring the Cache

A well-managed cache makes your application more efficient. There are very few cases in which you turn the cache off entirely, because the cache reduces database access and is an important part of managing object identity.

To make the most of your cache strategy and to minimize your application's exposure to stale data, we recommend the following:

Configure the cache on a per-class basis If other applications can modify the data used by a particular class, use a weaker style of cache for the class. For example, the SoftCacheWeakIdentityMap or WeakIdentityMap minimizes the length of time the cache maintains a dereferenced object.

For more information about configuring cache usage on a per-class basis, see "Working with Identity Maps" in the Oracle Application Server TopLink Mapping Workbench User's Guide.


Note:

If your application reaches a low system memory condition frequently enough, or if your platform JVM treats weak and soft references the same, the objects in the subcache may be garbage collected so often that you will not benefit from the performance improvement provided by the subcache. If this is the case, Oracle recommends that you use the HardCacheWeakIdentityMap. It is identical to the SoftCacheWeakIdentityMap except that it uses hard references in the subcache. This guarantees that your application will benefit from the performance improvement provided by the subcache.

Force a cache refresh when required on a per-query basis Any query can include a flag that forces a cache refresh to the database.

For more information about configuring cache refresh on a per-query basis, see "Refresh".