Skip Headers

# Configuring Cache Expiration at the Project 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 Type and Size at the Project Level"). Alternatively, you can configure an object with a `CacheInvalidationPolicy` that lets you 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 refreshing (see "Configuring Cache Refreshing").

Table: Project Support for Cache Invalidation Configuration summarizes which projects support cache invalidation configuration.

Project Support for Cache Invalidation Configuration

Descriptor | Using TopLink Workbench | Using Java
--- | --- | ---
Relational Projects |  |
EIS Projects |  |
XML Projects |  |

The cache invalidation options you configure at the project level apply globally to all descriptors. Use this section to define global cache invalidation options for a TopLink project.

You can override the project-level cache invalidation configuration by defining cache invalidation at the descriptor (see "Configuring Cache Expiration at the Descriptor Level") 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".

Note: When using TopLink Workbench, changing the project's default cache invalidation does not affect descriptors that already exist in the project; only newly added descriptors are affected.

For more information, see "Cache Invalidation".