Annotation Type Cache
-
@Target(TYPE) @Retention(RUNTIME) public @interface CacheThe Cache annotation is used to configure the EclipseLink object cache. By default EclipseLink uses a shared object cache to cache all objects. The caching type and options can be configured on a per class basis to allow optimal caching.This includes options for configuring the type of caching, setting the size, disabling the shared cache, expiring objects, refreshing, and cache coordination (clustering).
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.
- See Also:
CacheType,CacheCoordinationType,ClassDescriptor,CacheInvalidationPolicy- Author:
- Guy Pelletier
- Since:
- Oracle TopLink 11.1.1.0.0
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description booleanalwaysRefresh(Optional) Force all queries that go to the database to always refresh the cache.CacheCoordinationTypecoordinationType(Optional) The cache coordination mode.DatabaseChangeNotificationTypedatabaseChangeNotificationType(Optional) The database change notification mode.booleandisableHits(Optional) Setting to true will force all queries to bypass the cache for hits but still resolve against the cache for identity.intexpiry(Optional) Expire cached instance after a fix period of time (ms).TimeOfDayexpiryTimeOfDay(Optional) Expire cached instance a specific time of day.CacheIsolationTypeisolation(Optional) Controls the level of caching this Entity will use.booleanrefreshOnlyIfNewer(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).booleansharedDeprecated.As of Eclipselink 2.2.intsize(Optional) The size of cache to use.CacheTypetype(Optional) The type of cache to use.
-
-
-
Element Detail
-
type
CacheType type
(Optional) The type of cache to use. The default is SOFT_WEAK.- Default:
- org.eclipse.persistence.annotations.CacheType.SOFT_WEAK
-
-
-
isolation
CacheIsolationType isolation
(Optional) Controls the level of caching this Entity will use. The default is CacheIsolationType.SHARED which has EclipseLink Caching all Entities in the Shared Cache.- See Also:
CacheIsolationType
- Default:
- org.eclipse.persistence.config.CacheIsolationType.SHARED
-
-
-
expiryTimeOfDay
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)
-
-
-
refreshOnlyIfNewer
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). This is normally used in conjunction with alwaysRefresh, and by itself it only affect explicit refresh calls or queries. Default is false.- Default:
- false
-
-
-
coordinationType
CacheCoordinationType coordinationType
(Optional) The cache coordination mode. Note that cache coordination must also be configured for the persistence unit/session.- Default:
- org.eclipse.persistence.annotations.CacheCoordinationType.SEND_OBJECT_CHANGES
-
-
-
databaseChangeNotificationType
DatabaseChangeNotificationType databaseChangeNotificationType
(Optional) The database change notification mode. Note that database event listener must also be configured for the persistence unit/session.- Default:
- org.eclipse.persistence.annotations.DatabaseChangeNotificationType.INVALIDATE
-
-