Cache Refreshing Options

Use the following table to enter data in the fields on the descriptor's Settings tab to specify how TopLink will refresh the cache for queries:

Field | Description
--- | ---

Always Refresh

Refreshes the cache on all queries.

Avoids stale data by ensuring that any query that accesses the data source will refresh the resulting objects in the cache. This has no effect on queries that get a cache hit and never access the data source, such as read-object primary key queries or in-memory queries.

Configuring descriptor level cache refresh may affect performance. As an alternative, consider configuring:

- cache refresh on a query-by-query basis (see "Refreshing the Cache")

- cache expiration (see "Configuring Cache Expiration at the Descriptor Level")

- isolated caching (see "Cache Isolation")

Only Refresh If Newer Version

Refreshes the cache only if the object in the database is newer than the object in the cache (as determined by the Optimistic Locking field). See "Configuring Locking Policy" for more information.

Improves performance by avoiding unnecessary refreshing of an object if its version matches the data source version. This option does not cause refreshing on its own: you must use it in combination with Always Refresh, query refreshing (see "Refreshing the Cache"), or cache expiration (see "Configuring Cache Expiration at the Descriptor Level").

Disable Cache Hits

When selected, TopLink bypasses the cache and goes to the database for read object queries based on primary key. Using this option in conjunction with Always Refresh ensures that TopLink always goes to the database.

This option ensures that all queries including read-object primary key queries will always access the data source. This option does not cause refreshing on its own: you must use it in combination with Always Refresh.

This option can cause a serious performance issue: avoid whenever possible.

Caution: Use the Always Refresh and Disable Cache Hits properties with caution as they may lead to poor performance. As an alternative, consider configuring cache refresh on a query-by-query basis (see "Refreshing the Cache") or configuring cache expiration (see "Configuring Cache Expiration at the Descriptor Level"). For more information about cache performance, see "Cache Optimization".

See Also

  Configuring Cache Refreshing