blob: 36001e7793b499d43189669acaf11ff35e140ae6 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_252) on Fri Jul 16 09:38:34 UTC 2021 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Cache (EclipseLink 3.0.2, API Reference)</title>
<meta name="date" content="2021-07-16">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Cache (EclipseLink 3.0.2, API Reference)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">EclipseLink 3.0.2, API Reference</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/eclipse/persistence/annotations/BatchFetchType.html" title="enum in org.eclipse.persistence.annotations"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../org/eclipse/persistence/annotations/CacheCoordinationType.html" title="enum in org.eclipse.persistence.annotations"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/eclipse/persistence/annotations/Cache.html" target="_top">Frames</a></li>
<li><a href="Cache.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Required&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.optional.element.summary">Optional</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.element.detail">Element</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.eclipse.persistence.annotations</div>
<h2 title="Annotation Type Cache" class="title">Annotation Type Cache</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/annotation/Target.html?is-external=true" title="class or interface in java.lang.annotation">@Target</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/annotation/Target.html?is-external=true#value--" title="class or interface in java.lang.annotation">value</a>=<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/annotation/ElementType.html?is-external=true#TYPE" title="class or interface in java.lang.annotation">TYPE</a>)
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/annotation/Retention.html?is-external=true" title="class or interface in java.lang.annotation">@Retention</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/annotation/Retention.html?is-external=true#value--" title="class or interface in java.lang.annotation">value</a>=<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/annotation/RetentionPolicy.html?is-external=true#RUNTIME" title="class or interface in java.lang.annotation">RUNTIME</a>)
public @interface <span class="memberNameLabel">Cache</span></pre>
<div class="block">The 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.
<p>
This includes options for configuring the type of caching,
setting the size, disabling the shared cache, expiring objects, refreshing,
and cache coordination (clustering).
<p>
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.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../org/eclipse/persistence/annotations/CacheType.html" title="enum in org.eclipse.persistence.annotations"><code>CacheType</code></a>,
<a href="../../../../org/eclipse/persistence/annotations/CacheCoordinationType.html" title="enum in org.eclipse.persistence.annotations"><code>CacheCoordinationType</code></a>,
<a href="../../../../org/eclipse/persistence/descriptors/ClassDescriptor.html" title="class in org.eclipse.persistence.descriptors"><code>ClassDescriptor</code></a>,
<a href="../../../../org/eclipse/persistence/descriptors/invalidation/CacheInvalidationPolicy.html" title="class in org.eclipse.persistence.descriptors.invalidation"><code>CacheInvalidationPolicy</code></a></dd>
<dt><span class="simpleTagLabel">Author:</span></dt>
<dd>Guy Pelletier</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Oracle TopLink 11.1.1.0.0</dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="annotation.type.optional.element.summary">
<!-- -->
</a>
<h3>Optional Element Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Optional Element Summary table, listing optional elements, and an explanation">
<caption><span>Optional Elements</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Optional Element and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/persistence/annotations/Cache.html#alwaysRefresh--">alwaysRefresh</a></span></code>
<div class="block">(Optional) Force all queries that go to the database to always
refresh the cache.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../org/eclipse/persistence/annotations/CacheCoordinationType.html" title="enum in org.eclipse.persistence.annotations">CacheCoordinationType</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/persistence/annotations/Cache.html#coordinationType--">coordinationType</a></span></code>
<div class="block">(Optional) The cache coordination mode.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../org/eclipse/persistence/annotations/DatabaseChangeNotificationType.html" title="enum in org.eclipse.persistence.annotations">DatabaseChangeNotificationType</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/persistence/annotations/Cache.html#databaseChangeNotificationType--">databaseChangeNotificationType</a></span></code>
<div class="block">(Optional) The database change notification mode.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/persistence/annotations/Cache.html#disableHits--">disableHits</a></span></code>
<div class="block">(Optional) Setting to true will force all queries to bypass the
cache for hits but still resolve against the cache for identity.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/persistence/annotations/Cache.html#expiry--">expiry</a></span></code>
<div class="block">(Optional) Expire cached instance after a fix period of time (ms).</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../org/eclipse/persistence/annotations/TimeOfDay.html" title="annotation in org.eclipse.persistence.annotations">TimeOfDay</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/persistence/annotations/Cache.html#expiryTimeOfDay--">expiryTimeOfDay</a></span></code>
<div class="block">(Optional) Expire cached instance a specific time of day.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../org/eclipse/persistence/config/CacheIsolationType.html" title="enum in org.eclipse.persistence.config">CacheIsolationType</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/persistence/annotations/Cache.html#isolation--">isolation</a></span></code>
<div class="block">(Optional) Controls the level of caching this Entity will use.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/persistence/annotations/Cache.html#refreshOnlyIfNewer--">refreshOnlyIfNewer</a></span></code>
<div class="block">(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).</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/persistence/annotations/Cache.html#size--">size</a></span></code>
<div class="block">(Optional) The size of cache to use.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../org/eclipse/persistence/annotations/CacheType.html" title="enum in org.eclipse.persistence.annotations">CacheType</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/persistence/annotations/Cache.html#type--">type</a></span></code>
<div class="block">(Optional) The type of cache to use.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="annotation.type.element.detail">
<!-- -->
</a>
<h3>Element Detail</h3>
<a name="type--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>type</h4>
<pre>public abstract&nbsp;<a href="../../../../org/eclipse/persistence/annotations/CacheType.html" title="enum in org.eclipse.persistence.annotations">CacheType</a>&nbsp;type</pre>
<div class="block">(Optional) The type of cache to use.
The default is SOFT_WEAK.</div>
<dl>
<dt>Default:</dt>
<dd>org.eclipse.persistence.annotations.CacheType.SOFT_WEAK</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="size--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>size</h4>
<pre>public abstract&nbsp;int&nbsp;size</pre>
<div class="block">(Optional) The size of cache to use.
The default is 100.</div>
<dl>
<dt>Default:</dt>
<dd>100</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="isolation--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isolation</h4>
<pre>public abstract&nbsp;<a href="../../../../org/eclipse/persistence/config/CacheIsolationType.html" title="enum in org.eclipse.persistence.config">CacheIsolationType</a>&nbsp;isolation</pre>
<div class="block">(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.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../org/eclipse/persistence/config/CacheIsolationType.html" title="enum in org.eclipse.persistence.config"><code>CacheIsolationType</code></a></dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>org.eclipse.persistence.config.CacheIsolationType.SHARED</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="expiry--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>expiry</h4>
<pre>public abstract&nbsp;int&nbsp;expiry</pre>
<div class="block">(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.
By default there is no expiry.</div>
<dl>
<dt>Default:</dt>
<dd>-1</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="expiryTimeOfDay--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>expiryTimeOfDay</h4>
<pre>public abstract&nbsp;<a href="../../../../org/eclipse/persistence/annotations/TimeOfDay.html" title="annotation in org.eclipse.persistence.annotations">TimeOfDay</a>&nbsp;expiryTimeOfDay</pre>
<div class="block">(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.</div>
<dl>
<dt>Default:</dt>
<dd>@org.eclipse.persistence.annotations.TimeOfDay(specified=false)</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="alwaysRefresh--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>alwaysRefresh</h4>
<pre>public abstract&nbsp;boolean&nbsp;alwaysRefresh</pre>
<div class="block">(Optional) Force all queries that go to the database to always
refresh the cache.
Default is false.
Consider disabling the shared cache instead of forcing refreshing.</div>
<dl>
<dt>Default:</dt>
<dd>false</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="refreshOnlyIfNewer--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>refreshOnlyIfNewer</h4>
<pre>public abstract&nbsp;boolean&nbsp;refreshOnlyIfNewer</pre>
<div class="block">(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.</div>
<dl>
<dt>Default:</dt>
<dd>false</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="disableHits--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>disableHits</h4>
<pre>public abstract&nbsp;boolean&nbsp;disableHits</pre>
<div class="block">(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.</div>
<dl>
<dt>Default:</dt>
<dd>false</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="coordinationType--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>coordinationType</h4>
<pre>public abstract&nbsp;<a href="../../../../org/eclipse/persistence/annotations/CacheCoordinationType.html" title="enum in org.eclipse.persistence.annotations">CacheCoordinationType</a>&nbsp;coordinationType</pre>
<div class="block">(Optional) The cache coordination mode.
Note that cache coordination must also be configured for the persistence unit/session.</div>
<dl>
<dt>Default:</dt>
<dd>org.eclipse.persistence.annotations.CacheCoordinationType.SEND_OBJECT_CHANGES</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="databaseChangeNotificationType--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>databaseChangeNotificationType</h4>
<pre>public abstract&nbsp;<a href="../../../../org/eclipse/persistence/annotations/DatabaseChangeNotificationType.html" title="enum in org.eclipse.persistence.annotations">DatabaseChangeNotificationType</a>&nbsp;databaseChangeNotificationType</pre>
<div class="block">(Optional) The database change notification mode.
Note that database event listener must also be configured for the persistence unit/session.</div>
<dl>
<dt>Default:</dt>
<dd>org.eclipse.persistence.annotations.DatabaseChangeNotificationType.INVALIDATE</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">EclipseLink 3.0.2, API Reference</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/eclipse/persistence/annotations/BatchFetchType.html" title="enum in org.eclipse.persistence.annotations"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../org/eclipse/persistence/annotations/CacheCoordinationType.html" title="enum in org.eclipse.persistence.annotations"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/eclipse/persistence/annotations/Cache.html" target="_top">Frames</a></li>
<li><a href="Cache.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Required&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.optional.element.summary">Optional</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.element.detail">Element</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2007&#x2013;2021 <a href="http://www.eclipse.org/eclipselink">Eclipse.org - EclipseLink Project</a>. All rights reserved.</small></p>
</body>
</html>