EclipseLink1.0 - 20080707 API Reference

org.eclipse.persistence.annotations
Annotation Type Cache


@Target(value=TYPE)
@Retention(value=RUNTIME)
public @interface Cache

The Cache annotation is used to set an org.eclipse.persistence.descriptors.invalidation.CacheInvalidationPolicy which sets objects in TopLink's identity maps to be invalid following given rules. By default in TopLink, objects do not expire in the cache. Several different policies are available to allow objects to expire.

See Also:
A Cache annotation may be defined on an Entity or MappedSuperclass. In the case of inheritance, a Cache annotation should only be defined on the root of the inheritance hierarchy.
Author:
Guy Pelletier
Since:
Oracle TopLink 11.1.1.0.0

Optional Element Summary
 boolean alwaysRefresh
          (Optional) Force all queries that go to the database to always refresh the cache.
 CacheCoordinationType coordinationType
          (Optional) The cache coordination mode.
 boolean disableHits
          (Optional) Setting to true will force all queries to bypass the cache for hits but still resolve against the cache for identity.
 int expiry
          (Optional) Expire cached instance after a fix period of time (ms).
 TimeOfDay expiryTimeOfDay
          (Optional) Expire cached instance a specific time of day.
 boolean refreshOnlyIfNewer
          (Optional) For all queries that go to the database, refresh the cache only if the data received from the database by a query is newer than the data in the cache (as determined by the optimistic locking field)
 boolean shared
          (Optional) Cached instances in the shared cache or a client isolated cache.
 int size
          (Optional) The size of cache to use.
 CacheType type
          (Optional) The type of cache to use.
 

type

public abstract CacheType type
(Optional) The type of cache to use.

Default:
SOFT_WEAK

size

public abstract int size
(Optional) The size of cache to use.

Default:
100

shared

public abstract boolean shared
(Optional) Cached instances in the shared cache or a client isolated cache.

Default:
true

expiry

public abstract int expiry
(Optional) Expire cached instance after a fix period of time (ms). Queries executed against the cache after this will be forced back to the database for a refreshed copy

Default:
-1

expiryTimeOfDay

public abstract TimeOfDay expiryTimeOfDay
(Optional) Expire cached instance a specific time of day. Queries executed against the cache after this will be forced back to the database for a refreshed copy

Default:
@org.eclipse.persistence.annotations.TimeOfDay(specified=false)

alwaysRefresh

public abstract boolean alwaysRefresh
(Optional) Force all queries that go to the database to always refresh the cache.

Default:
false

refreshOnlyIfNewer

public abstract boolean refreshOnlyIfNewer
(Optional) For all queries that go to the database, refresh the cache only if the data received from the database by a query is newer than the data in the cache (as determined by the optimistic locking field)

Default:
false

disableHits

public abstract boolean disableHits
(Optional) Setting to true will force all queries to bypass the cache for hits but still resolve against the cache for identity. This forces all queries to hit the database.

Default:
false

coordinationType

public abstract CacheCoordinationType coordinationType
(Optional) The cache coordination mode.

Default:
SEND_OBJECT_CHANGES

EclipseLink1.0 - 20080707 API Reference