Skip Headers

# Configuring Cache Expiration at the Descriptor Level

Previous

Next

By default, objects remain in the cache until they are explicitly deleted (see "Deleting Objects") or garbage-collected when using a weak identity map (see "Configuring Cache Isolation at the Project Level"). Alternatively, you can configure an object with a `CacheInvalidationPolicy` that allows you to specify, either automatically or manually, that an object is invalid: when any query attempts to read an invalid object, TopLink will go to the data source for the most up-to-date version of that object and update the cache with this information.

Using cache invalidation ensures that your application does not use stale data. It provides a better performing alternative to always refreshing (see "Configuring Cache Refreshing").

Table: Descriptor Support for Cache Invalidation Policy summarizes which descriptors support a cache invalidation policy.

Descriptor Support for Cache Invalidation Policy

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").

You can override the project-level cache invalidation configuration (see "Configuring Cache Expiration at the Project Level") by defining cache invalidation at the descriptor or query level (see "Configuring Cache Expiration at the Query Level").

You can customize how TopLink communicates the fact that an object has been declared invalid to improve efficiency, if you are using a coordinated cache. For more information, see "Configuring Cache Coordination Change Propagation at the Descriptor Level".

For more information, see "Cache Invalidation".