blob: 24d2bb78755cb529c88f72b377bc78cdc45e3295 [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>
<link rel="canonical" href="https://ignite.apache.org/jcache/1.0.0/javadoc/javax/cache/annotation/CacheRemove.html" />
<!-- Generated by javadoc (version 1.7.0_25) on Fri Mar 28 13:34:25 EST 2014 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>CacheRemove (JSR107 API and SPI 1.0.0 API)</title>
<meta name="date" content="2014-03-28">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-61232409-1', 'auto');
ga('send', 'pageview');
</script></head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="CacheRemove (JSR107 API and SPI 1.0.0 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><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="class-use/CacheRemove.html">Use</a></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>
<div class="subNav">
<ul class="navList">
<li><a href="../../../javax/cache/annotation/CachePut.html" title="annotation in javax.cache.annotation"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../javax/cache/annotation/CacheRemoveAll.html" title="annotation in javax.cache.annotation"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?javax/cache/annotation/CacheRemove.html" target="_top">Frames</a></li>
<li><a href="CacheRemove.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All 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>Required&nbsp;|&nbsp;</li>
<li><a href="#annotation_type_optional_element_summary">Optional</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&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">javax.cache.annotation</div>
<h2 title="Annotation Type CacheRemove" class="title">Annotation Type CacheRemove</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre><a href="http://download.oracle.com/javase/6/docs/api/java/lang/annotation/Target.html?is-external=true" title="class or interface in java.lang.annotation">@Target</a>(<a href="http://download.oracle.com/javase/6/docs/api/java/lang/annotation/Target.html?is-external=true#value()" title="class or interface in java.lang.annotation">value</a>={<a href="http://download.oracle.com/javase/6/docs/api/java/lang/annotation/ElementType.html?is-external=true#METHOD" title="class or interface in java.lang.annotation">METHOD</a>,<a href="http://download.oracle.com/javase/6/docs/api/java/lang/annotation/ElementType.html?is-external=true#TYPE" title="class or interface in java.lang.annotation">TYPE</a>})
<a href="http://download.oracle.com/javase/6/docs/api/java/lang/annotation/Retention.html?is-external=true" title="class or interface in java.lang.annotation">@Retention</a>(<a href="http://download.oracle.com/javase/6/docs/api/java/lang/annotation/Retention.html?is-external=true#value()" title="class or interface in java.lang.annotation">value</a>=<a href="http://download.oracle.com/javase/6/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="strong">CacheRemove</span></pre>
<div class="block">When a method annotated with <a href="../../../javax/cache/annotation/CacheRemove.html" title="annotation in javax.cache.annotation"><code>CacheRemove</code></a> is invoked a <a href="../../../javax/cache/annotation/GeneratedCacheKey.html" title="interface in javax.cache.annotation"><code>GeneratedCacheKey</code></a> will be generated and <a href="../../../javax/cache/Cache.html#remove(K)"><code>Cache.remove(Object)</code></a> will be
invoked on the specified cache.
<p>
The default behavior is to call <a href="../../../javax/cache/Cache.html#remove(K)"><code>Cache.remove(Object)</code></a> after
the annotated method is invoked, this behavior can be changed by setting
<a href="../../../javax/cache/annotation/CacheRemove.html#afterInvocation()"><code>afterInvocation()</code></a> to false in which case
<a href="../../../javax/cache/Cache.html#remove(K)"><code>Cache.remove(Object)</code></a> will be called before the annotated
method is invoked.
<p>
Example of removing a specific Domain object from the "domainCache". A <a href="../../../javax/cache/annotation/GeneratedCacheKey.html" title="interface in javax.cache.annotation"><code>GeneratedCacheKey</code></a> will be generated from the String and int parameters and
used to call <a href="../../../javax/cache/Cache.html#remove(K)"><code>Cache.remove(Object)</code></a> after the deleteDomain
method completes successfully.
<pre><code>
package my.app;
public class DomainDao {
&#64;CacheRemove(cacheName="domainCache")
public void deleteDomain(String domainId, int index) {
...
}
}
</code></pre>
<p>
Exception Handling, only used if <a href="../../../javax/cache/annotation/CacheRemove.html#afterInvocation()"><code>afterInvocation()</code></a> is true.
<ol>
<li>If <a href="../../../javax/cache/annotation/CacheRemove.html#evictFor()"><code>evictFor()</code></a> and <a href="../../../javax/cache/annotation/CacheRemove.html#noEvictFor()"><code>noEvictFor()</code></a> are both empty then all
exceptions prevent the remove</li>
<li>If <a href="../../../javax/cache/annotation/CacheRemove.html#evictFor()"><code>evictFor()</code></a> is specified and <a href="../../../javax/cache/annotation/CacheRemove.html#noEvictFor()"><code>noEvictFor()</code></a> is not
specified then only exceptions that pass an instanceof check against the
evictFor list result in a remove</li>
<li>If <a href="../../../javax/cache/annotation/CacheRemove.html#noEvictFor()"><code>noEvictFor()</code></a> is specified and <a href="../../../javax/cache/annotation/CacheRemove.html#evictFor()"><code>evictFor()</code></a> is not
specified then all exceptions that do not pass an instanceof check against the
noEvictFor result in a remove</li>
<li>If <a href="../../../javax/cache/annotation/CacheRemove.html#evictFor()"><code>evictFor()</code></a> and <a href="../../../javax/cache/annotation/CacheRemove.html#noEvictFor()"><code>noEvictFor()</code></a> are both specified then
exceptions that pass an instanceof check against the evictFor list but do not
pass an instanceof check against the noEvictFor list result in a remove</li>
</ol></div>
<dl><dt><span class="strong">Since:</span></dt>
<dd>1.0</dd>
<dt><span class="strong">Author:</span></dt>
<dd>Eric Dalquist, Rick Hightower, Greg Luck</dd>
<dt><span class="strong">See Also:</span></dt><dd><a href="../../../javax/cache/annotation/CacheKey.html" title="annotation in javax.cache.annotation"><code>CacheKey</code></a></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="overviewSummary" 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><strong><a href="../../../javax/cache/annotation/CacheRemove.html#afterInvocation()">afterInvocation</a></strong></code>
<div class="block">When <a href="../../../javax/cache/Cache.html#remove(K)"><code>Cache.remove(Object)</code></a> should be called.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;? extends <a href="../../../javax/cache/annotation/CacheKeyGenerator.html" title="interface in javax.cache.annotation">CacheKeyGenerator</a>&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../javax/cache/annotation/CacheRemove.html#cacheKeyGenerator()">cacheKeyGenerator</a></strong></code>
<div class="block">The <a href="../../../javax/cache/annotation/CacheKeyGenerator.html" title="interface in javax.cache.annotation"><code>CacheKeyGenerator</code></a> to use to generate the <a href="../../../javax/cache/annotation/GeneratedCacheKey.html" title="interface in javax.cache.annotation"><code>GeneratedCacheKey</code></a> for interacting with the specified Cache.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><strong><a href="../../../javax/cache/annotation/CacheRemove.html#cacheName()">cacheName</a></strong></code>
<div class="block">The name of the cache.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;? extends <a href="../../../javax/cache/annotation/CacheResolverFactory.html" title="interface in javax.cache.annotation">CacheResolverFactory</a>&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../javax/cache/annotation/CacheRemove.html#cacheResolverFactory()">cacheResolverFactory</a></strong></code>
<div class="block">The <a href="../../../javax/cache/annotation/CacheResolverFactory.html" title="interface in javax.cache.annotation"><code>CacheResolverFactory</code></a> used to find the <a href="../../../javax/cache/annotation/CacheResolver.html" title="interface in javax.cache.annotation"><code>CacheResolver</code></a> to
use at runtime.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;? extends <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a>&gt;[]</code></td>
<td class="colLast"><code><strong><a href="../../../javax/cache/annotation/CacheRemove.html#evictFor()">evictFor</a></strong></code>
<div class="block">Defines zero (0) or more exception <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang"><code>classes</code></a>, that must be a
subclass of <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang"><code>Throwable</code></a>, indicating the exception types that must cause
a cache eviction.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;? extends <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a>&gt;[]</code></td>
<td class="colLast"><code><strong><a href="../../../javax/cache/annotation/CacheRemove.html#noEvictFor()">noEvictFor</a></strong></code>
<div class="block">Defines zero (0) or more exception <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang"><code>Classes</code></a>, that must be a
subclass of <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang"><code>Throwable</code></a>, indicating the exception types that must
<b>not</b> cause a cache eviction.</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="cacheName()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>cacheName</h4>
<pre>public abstract&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;cacheName</pre>
<div class="block">The name of the cache.
<p>
If not specified defaults first to <a href="../../../javax/cache/annotation/CacheDefaults.html#cacheName()"><code>CacheDefaults.cacheName()</code></a>,
and if that is not set then to:
package.name.ClassName.methodName(package.ParameterType,package.ParameterType)</div>
<dl>
<dt>Default:</dt>
<dd>""</dd>
</dl>
</li>
</ul>
<a name="afterInvocation()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>afterInvocation</h4>
<pre>public abstract&nbsp;boolean&nbsp;afterInvocation</pre>
<div class="block">When <a href="../../../javax/cache/Cache.html#remove(K)"><code>Cache.remove(Object)</code></a> should be called. If true it is called
after the annotated method invocation completes successfully. If false it is
called before the annotated method is invoked.
<p>
Defaults to true.
<p>
If true and the annotated method throws an exception the put will not be
executed.</div>
<dl>
<dt>Default:</dt>
<dd>true</dd>
</dl>
</li>
</ul>
<a name="cacheResolverFactory()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>cacheResolverFactory</h4>
<pre>public abstract&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;? extends <a href="../../../javax/cache/annotation/CacheResolverFactory.html" title="interface in javax.cache.annotation">CacheResolverFactory</a>&gt;&nbsp;cacheResolverFactory</pre>
<div class="block">The <a href="../../../javax/cache/annotation/CacheResolverFactory.html" title="interface in javax.cache.annotation"><code>CacheResolverFactory</code></a> used to find the <a href="../../../javax/cache/annotation/CacheResolver.html" title="interface in javax.cache.annotation"><code>CacheResolver</code></a> to
use at runtime.
<p>
The default resolver pair will resolve the cache by name from the default
<a href="../../../javax/cache/CacheManager.html" title="interface in javax.cache"><code>CacheManager</code></a></div>
<dl>
<dt>Default:</dt>
<dd>javax.cache.annotation.CacheResolverFactory.class</dd>
</dl>
</li>
</ul>
<a name="cacheKeyGenerator()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>cacheKeyGenerator</h4>
<pre>public abstract&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;? extends <a href="../../../javax/cache/annotation/CacheKeyGenerator.html" title="interface in javax.cache.annotation">CacheKeyGenerator</a>&gt;&nbsp;cacheKeyGenerator</pre>
<div class="block">The <a href="../../../javax/cache/annotation/CacheKeyGenerator.html" title="interface in javax.cache.annotation"><code>CacheKeyGenerator</code></a> to use to generate the <a href="../../../javax/cache/annotation/GeneratedCacheKey.html" title="interface in javax.cache.annotation"><code>GeneratedCacheKey</code></a> for interacting with the specified Cache.
<p>
Defaults to a key generator that uses
<a href="http://download.oracle.com/javase/6/docs/api/java/util/Arrays.html?is-external=true#deepHashCode(java.lang.Object[])" title="class or interface in java.util"><code>Arrays.deepHashCode(Object[])</code></a>
and <a href="http://download.oracle.com/javase/6/docs/api/java/util/Arrays.html?is-external=true#deepEquals(java.lang.Object[], java.lang.Object[])" title="class or interface in java.util"><code>Arrays.deepEquals(Object[], Object[])</code></a> with the array
returned by <a href="../../../javax/cache/annotation/CacheKeyInvocationContext.html#getKeyParameters()"><code>CacheKeyInvocationContext.getKeyParameters()</code></a></div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../javax/cache/annotation/CacheKey.html" title="annotation in javax.cache.annotation"><code>CacheKey</code></a></dd></dl>
<dl>
<dt>Default:</dt>
<dd>javax.cache.annotation.CacheKeyGenerator.class</dd>
</dl>
</li>
</ul>
<a name="evictFor()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>evictFor</h4>
<pre>public abstract&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;? extends <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a>&gt;[]&nbsp;evictFor</pre>
<div class="block">Defines zero (0) or more exception <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang"><code>classes</code></a>, that must be a
subclass of <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang"><code>Throwable</code></a>, indicating the exception types that must cause
a cache eviction. Only used if <a href="../../../javax/cache/annotation/CacheRemove.html#afterInvocation()"><code>afterInvocation()</code></a> is true.</div>
<dl>
<dt>Default:</dt>
<dd>{}</dd>
</dl>
</li>
</ul>
<a name="noEvictFor()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>noEvictFor</h4>
<pre>public abstract&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a>&lt;? extends <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a>&gt;[]&nbsp;noEvictFor</pre>
<div class="block">Defines zero (0) or more exception <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang"><code>Classes</code></a>, that must be a
subclass of <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang"><code>Throwable</code></a>, indicating the exception types that must
<b>not</b> cause a cache eviction. Only used if <a href="../../../javax/cache/annotation/CacheRemove.html#afterInvocation()"><code>afterInvocation()</code></a> is
true.</div>
<dl>
<dt>Default:</dt>
<dd>{}</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><a href="#skip-navbar_bottom" title="Skip navigation links"></a><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="class-use/CacheRemove.html">Use</a></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>
<div class="subNav">
<ul class="navList">
<li><a href="../../../javax/cache/annotation/CachePut.html" title="annotation in javax.cache.annotation"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../javax/cache/annotation/CacheRemoveAll.html" title="annotation in javax.cache.annotation"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?javax/cache/annotation/CacheRemove.html" target="_top">Frames</a></li>
<li><a href="CacheRemove.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All 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>Required&nbsp;|&nbsp;</li>
<li><a href="#annotation_type_optional_element_summary">Optional</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&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; 2014. All Rights Reserved.</small></p>
</body>
</html>