blob: 815a5cacdecbd284dcc942b59e55114d9c234d02 [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/integration/CacheWriter.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>CacheWriter (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="CacheWriter (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/CacheWriter.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/integration/CacheLoaderException.html" title="class in javax.cache.integration"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../javax/cache/integration/CacheWriterException.html" title="class in javax.cache.integration"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?javax/cache/integration/CacheWriter.html" target="_top">Frames</a></li>
<li><a href="CacheWriter.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>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</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.integration</div>
<h2 title="Interface CacheWriter" class="title">Interface CacheWriter&lt;K,V&gt;</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>K</code> - the type of keys maintained by this map</dd><dd><code>V</code> - the type of mapped values</dd></dl>
<hr>
<br>
<pre>public interface <span class="strong">CacheWriter&lt;K,V&gt;</span></pre>
<div class="block">A CacheWriter is used for write-through to an external resource.
<p>
Under Default Consistency, the non-batch writer methods are atomic with respect
to the corresponding cache operation.
<p>
For batch methods under Default Consistency, the entire cache operation
is not required to be atomic in <a href="../../../javax/cache/Cache.html" title="interface in javax.cache"><code>Cache</code></a> and is therefore not required to
be atomic in the writer. As individual writer operations can fail, cache
operations are not required to occur until after the writer batch method has
returned or, in the case of partial success, thrown an exception. In the case
of partial success, the collection of entries return must only contain
those entries that failed.
<p>
The entry passed into <a href="../../../javax/cache/integration/CacheWriter.html#write(javax.cache.Cache.Entry)"><code>write(Cache.Entry)</code></a> is independent
of the cache mapping for that key, meaning that if the value changes in the
cache or is removed it does not change the entry.</div>
<dl><dt><span class="strong">Since:</span></dt>
<dd>1.0</dd>
<dt><span class="strong">Author:</span></dt>
<dd>Greg Luck, Brian Oliver</dd>
<dt><span class="strong">See Also:</span></dt><dd><a href="../../../javax/cache/integration/CacheLoader.html" title="interface in javax.cache.integration"><code>CacheLoader</code></a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../javax/cache/integration/CacheWriter.html#delete(java.lang.Object)">delete</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;key)</code>
<div class="block">Delete the cache entry from the external resource.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../javax/cache/integration/CacheWriter.html#deleteAll(java.util.Collection)">deleteAll</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;?&gt;&nbsp;keys)</code>
<div class="block">Remove data and keys from the external resource for the given collection of
keys, if present.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../javax/cache/integration/CacheWriter.html#write(javax.cache.Cache.Entry)">write</a></strong>(<a href="../../../javax/cache/Cache.Entry.html" title="interface in javax.cache">Cache.Entry</a>&lt;? extends <a href="../../../javax/cache/integration/CacheWriter.html" title="type parameter in CacheWriter">K</a>,? extends <a href="../../../javax/cache/integration/CacheWriter.html" title="type parameter in CacheWriter">V</a>&gt;&nbsp;entry)</code>
<div class="block">Write the specified value under the specified key to the external resource.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../javax/cache/integration/CacheWriter.html#writeAll(java.util.Collection)">writeAll</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;<a href="../../../javax/cache/Cache.Entry.html" title="interface in javax.cache">Cache.Entry</a>&lt;? extends <a href="../../../javax/cache/integration/CacheWriter.html" title="type parameter in CacheWriter">K</a>,? extends <a href="../../../javax/cache/integration/CacheWriter.html" title="type parameter in CacheWriter">V</a>&gt;&gt;&nbsp;entries)</code>
<div class="block">Write the specified entries to the external resource.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="write(javax.cache.Cache.Entry)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>write</h4>
<pre>void&nbsp;write(<a href="../../../javax/cache/Cache.Entry.html" title="interface in javax.cache">Cache.Entry</a>&lt;? extends <a href="../../../javax/cache/integration/CacheWriter.html" title="type parameter in CacheWriter">K</a>,? extends <a href="../../../javax/cache/integration/CacheWriter.html" title="type parameter in CacheWriter">V</a>&gt;&nbsp;entry)
throws <a href="../../../javax/cache/integration/CacheWriterException.html" title="class in javax.cache.integration">CacheWriterException</a></pre>
<div class="block">Write the specified value under the specified key to the external resource.
<p>
This method is intended to support both key/value creation and value update
for a specific key.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>entry</code> - the entry to be written</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../javax/cache/integration/CacheWriterException.html" title="class in javax.cache.integration">CacheWriterException</a></code> - if the write fails. If thrown the
cache mutation will not occur.</dd></dl>
</li>
</ul>
<a name="writeAll(java.util.Collection)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeAll</h4>
<pre>void&nbsp;writeAll(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;<a href="../../../javax/cache/Cache.Entry.html" title="interface in javax.cache">Cache.Entry</a>&lt;? extends <a href="../../../javax/cache/integration/CacheWriter.html" title="type parameter in CacheWriter">K</a>,? extends <a href="../../../javax/cache/integration/CacheWriter.html" title="type parameter in CacheWriter">V</a>&gt;&gt;&nbsp;entries)
throws <a href="../../../javax/cache/integration/CacheWriterException.html" title="class in javax.cache.integration">CacheWriterException</a></pre>
<div class="block">Write the specified entries to the external resource. This method is intended
to support both insert and update.
<p>
The order that individual writes occur is undefined, as
<a href="../../../javax/cache/Cache.html#putAll(java.util.Map)"><code>Cache.putAll(java.util.Map)</code></a> also has undefined ordering.
<p>
If this operation fails (by throwing an exception) after a partial success,
the writer must remove any successfully written entries from the entries
collection so that the caching implementation knows what succeeded and can
mutate the cache.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>entries</code> - a mutable collection to write. Upon invocation, it contains
the entries to write for write-through. Upon return the
collection must only contain entries that were not
successfully written. (see partial success above)</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../javax/cache/integration/CacheWriterException.html" title="class in javax.cache.integration">CacheWriterException</a></code> - if one or more of the writes fail. If
thrown cache mutations will occur for
entries that succeeded.</dd></dl>
</li>
</ul>
<a name="delete(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>delete</h4>
<pre>void&nbsp;delete(<a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;key)
throws <a href="../../../javax/cache/integration/CacheWriterException.html" title="class in javax.cache.integration">CacheWriterException</a></pre>
<div class="block">Delete the cache entry from the external resource.
<p>
Expiry of a cache entry is not a delete hence will not cause this method to
be invoked.
<p>
This method is invoked even if no mapping for the key exists.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>key</code> - the key that is used for the delete operation</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../javax/cache/integration/CacheWriterException.html" title="class in javax.cache.integration">CacheWriterException</a></code> - if delete fails. If thrown the cache delete will
not occur.</dd></dl>
</li>
</ul>
<a name="deleteAll(java.util.Collection)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>deleteAll</h4>
<pre>void&nbsp;deleteAll(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;?&gt;&nbsp;keys)
throws <a href="../../../javax/cache/integration/CacheWriterException.html" title="class in javax.cache.integration">CacheWriterException</a></pre>
<div class="block">Remove data and keys from the external resource for the given collection of
keys, if present.
<p>
The order that individual deletes occur is undefined, as
<a href="../../../javax/cache/Cache.html#removeAll(java.util.Set)"><code>Cache.removeAll(java.util.Set)</code></a> also has undefined ordering.
<p>
If this operation fails (by throwing an exception) after a partial success,
the writer must remove any successfully written entries from the entries
collection so that the caching implementation knows what succeeded and can
mutate the cache.
<p>
Expiry of a cache entry is not a delete hence will not cause this method to
be invoked.
<p>
This method may include keys even if there is no mapping for that key,
in which case the data represented by that key should be removed from the
underlying resource.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>keys</code> - a mutable collection of keys for entries to delete. Upon
invocation, it contains the keys to delete for write-through.
Upon return the collection must only contain the keys that were
not successfully deleted. (see partial success above)</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../javax/cache/integration/CacheWriterException.html" title="class in javax.cache.integration">CacheWriterException</a></code> - if one or more deletes fail. If thrown
cache deletes will occur for entries that
succeeded.</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/CacheWriter.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/integration/CacheLoaderException.html" title="class in javax.cache.integration"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../javax/cache/integration/CacheWriterException.html" title="class in javax.cache.integration"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?javax/cache/integration/CacheWriter.html" target="_top">Frames</a></li>
<li><a href="CacheWriter.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>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</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>