805 lines
38 KiB
HTML
805 lines
38 KiB
HTML
|
<!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_151) on Tue Oct 31 17:36:46 EDT 2017 -->
|
||
|
<title>WriteOptions (Oracle - Berkeley DB Java Edition API)</title>
|
||
|
<meta name="date" content="2017-10-31">
|
||
|
<link rel="stylesheet" type="text/css" href="../../../style.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="WriteOptions (Oracle - Berkeley DB Java Edition API)";
|
||
|
}
|
||
|
}
|
||
|
catch(err) {
|
||
|
}
|
||
|
//-->
|
||
|
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10};
|
||
|
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
|
||
|
var altColor = "altColor";
|
||
|
var rowColor = "rowColor";
|
||
|
var tableTab = "tableTab";
|
||
|
var activeTableTab = "activeTableTab";
|
||
|
</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="class-use/WriteOptions.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 class="aboutLanguage"><b>Berkeley DB Java Edition</b><br><font size=\"-1\"> version 7.5.11</font>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="subNav">
|
||
|
<ul class="navList">
|
||
|
<li><a href="../../../com/sleepycat/je/VersionMismatchException.html" title="class in com.sleepycat.je"><span class="typeNameLink">Prev Class</span></a></li>
|
||
|
<li><a href="../../../com/sleepycat/je/XAEnvironment.html" title="class in com.sleepycat.je"><span class="typeNameLink">Next Class</span></a></li>
|
||
|
</ul>
|
||
|
<ul class="navList">
|
||
|
<li><a href="../../../index.html?com/sleepycat/je/WriteOptions.html" target="_top">Frames</a></li>
|
||
|
<li><a href="WriteOptions.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: </li>
|
||
|
<li>Nested | </li>
|
||
|
<li>Field | </li>
|
||
|
<li><a href="#constructor.summary">Constr</a> | </li>
|
||
|
<li><a href="#method.summary">Method</a></li>
|
||
|
</ul>
|
||
|
<ul class="subNavList">
|
||
|
<li>Detail: </li>
|
||
|
<li>Field | </li>
|
||
|
<li><a href="#constructor.detail">Constr</a> | </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">com.sleepycat.je</div>
|
||
|
<h2 title="Class WriteOptions" class="title">Class WriteOptions</h2>
|
||
|
</div>
|
||
|
<div class="contentContainer">
|
||
|
<ul class="inheritance">
|
||
|
<li>java.lang.Object</li>
|
||
|
<li>
|
||
|
<ul class="inheritance">
|
||
|
<li>com.sleepycat.je.WriteOptions</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<div class="description">
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<dl>
|
||
|
<dt>All Implemented Interfaces:</dt>
|
||
|
<dd>java.lang.Cloneable</dd>
|
||
|
</dl>
|
||
|
<hr>
|
||
|
<br>
|
||
|
<pre>public class <span class="typeNameLabel">WriteOptions</span>
|
||
|
extends java.lang.Object
|
||
|
implements java.lang.Cloneable</pre>
|
||
|
<div class="block">Options for calling methods that write (insert, update or delete) records.
|
||
|
|
||
|
<h3><a name="ttl">Time-To-Live</a></h3>
|
||
|
|
||
|
<p>When performing a 'put' operation, a TTL may be specified using
|
||
|
<a href="../../../com/sleepycat/je/WriteOptions.html#setTTL-int-java.util.concurrent.TimeUnit-"><code>setTTL(int, TimeUnit)</code></a> or <a href="../../../com/sleepycat/je/WriteOptions.html#setTTL-int-"><code>setTTL(int)</code></a>.</p>
|
||
|
|
||
|
<p>By default, the TTL property is zero, meaning there is no automatic
|
||
|
expiration. A non-zero TTL may be specified to cause an inserted record
|
||
|
to expire. The expiration time may also be changed for an existing
|
||
|
record by updating the record and specifying a different TTL, including
|
||
|
specifying zero to prevent the record from expiring. However, the TTL of
|
||
|
an existing record is updated only if <a href="../../../com/sleepycat/je/WriteOptions.html#setUpdateTTL-boolean-"><code>setUpdateTTL(boolean)</code></a> is
|
||
|
explicitly set to true. When deleting a record, the TTL parameter is
|
||
|
ignored.</p>
|
||
|
|
||
|
<p>Records expire on day or hour boundaries, depending on the <code>timeUnit</code> parameter. At the time of the write operation, the TTL
|
||
|
parameter is used to compute the record's expiration time by first
|
||
|
converting it from days (or hours) to milliseconds, and then adding it
|
||
|
to the current system time. If the resulting expiration time is not
|
||
|
evenly divisible by the number of milliseconds in one day (or hour), it
|
||
|
is rounded up to the nearest day (or hour).</p>
|
||
|
|
||
|
<p>Passing TimeUnit.DAYS, rather than TimeUnit.HOURS, for the timeUnit
|
||
|
parameter is recommended to minimize storage requirements (memory
|
||
|
and disk). Because the expiration time is stored in the JE Btree
|
||
|
internally, when using the TTL feature, the additional memory and disk
|
||
|
space required for storing Btree internal nodes (INs) is twice as much
|
||
|
when using TimeUnit.HOURS as when using TimeUnit.DAYS. Using
|
||
|
TimeUnit.DAYS adds about 5% to the space needed for INs, while
|
||
|
TimeUnit.HOURS adds about 10%.</p>
|
||
|
|
||
|
<p>Note that JE stores the expiration time of the record and not the
|
||
|
original TTL value that was specified. The expiration time of a record
|
||
|
is available when reading (or writing) records via <a href="../../../com/sleepycat/je/OperationResult.html#getExpirationTime--"><code>OperationResult.getExpirationTime()</code></a>.</p>
|
||
|
|
||
|
<p>A summary of the behavior of expired records is as follows.</p>
|
||
|
<ul>
|
||
|
<li>Space for expired records will be purged in the background by
|
||
|
the JE cleaner, and expired records will be filtered out of queries
|
||
|
even if they have not been purged.<p></li>
|
||
|
|
||
|
<li>Expired records are removed individually: there is no guarantee
|
||
|
that records with the same expiration time will be removed
|
||
|
simultaneously.<p></li>
|
||
|
|
||
|
<li>Records with expiration times support repeatable-read semantics
|
||
|
in most cases, but with some exceptions (described below).<p></li>
|
||
|
</ul>
|
||
|
|
||
|
<p>A more detailed description is below, including some information on
|
||
|
how expired records are handled internally.</p>
|
||
|
<ul>
|
||
|
<li>Expired records will be purged in order to reclaim disk space.
|
||
|
This happens in background over time, and there is no guarantee that
|
||
|
the space for a record will be reclaimed at any particular time.
|
||
|
Purging of expired records occurs during the normal JE cleaning
|
||
|
process. The goals of the purging process are:
|
||
|
<ol>
|
||
|
<li>to minimize the cost of purging;</li>
|
||
|
<li>to keep disk utilization below the <a href="../../../com/sleepycat/je/EnvironmentConfig.html#CLEANER_MIN_UTILIZATION"><code>EnvironmentConfig.CLEANER_MIN_UTILIZATION</code></a> threshold, as usual,
|
||
|
but taking into account expired data; and</li>
|
||
|
<li>to reclaim expired data gradually and avoid spikes in
|
||
|
cleaning on day and hour boundaries.</li>
|
||
|
</ol>
|
||
|
|
||
|
<li>Expired records that have not been purged will be filtered out
|
||
|
of queries and will not be returned to the application. In a
|
||
|
replicated environment, purging and filtering occur independently on
|
||
|
each node. For queries to return consistent results on all nodes,
|
||
|
the system clocks on all nodes must be synchronized.<p></li>
|
||
|
|
||
|
<li>Repeatable-read semantics are supported for records that expire
|
||
|
after being read. If a lock of any kind is held on a record and the
|
||
|
record expires, when accessing it again using the same transaction
|
||
|
or cursor, it will be accessed as if it is not expired. In other
|
||
|
words, locking a record prevents it from expiring, from the
|
||
|
viewpoint of that transaction or cursor. However, there are some
|
||
|
caveats and exceptions to this rule:
|
||
|
<ul>
|
||
|
<li>A lock by one transaction or cursor will not prevent a
|
||
|
record from being seen as expired when accessing it using a
|
||
|
different transaction or cursor.<p></li>
|
||
|
|
||
|
<li>In the unlikely event that the system clock is changed,
|
||
|
locking a record may not guarantee that the record's data has
|
||
|
not been purged, if the data is not read at the time the
|
||
|
record is locked. This is because the record's key and its
|
||
|
data are purged independently. It is possible to lock a record
|
||
|
without reading its data by passing null for the 'data'
|
||
|
parameter. If a record is locked in this manner, and the data
|
||
|
was previously purged because the system clock was changed,
|
||
|
then one of the following may occur, even when using the same
|
||
|
transaction or cursor that was used to lock the record:
|
||
|
<p></li>
|
||
|
<ul>
|
||
|
<li>If the record is read again with a non-null data
|
||
|
parameter, the operation may fail (return null) because the
|
||
|
data cannot be read.<p></li>
|
||
|
|
||
|
<li>If a partial update is attempted (passing a <a href="../../../com/sleepycat/je/DatabaseEntry.html#setPartial-int-int-boolean-"><code>partial</code></a> 'data'
|
||
|
parameter), the operation may fail (return null)
|
||
|
because the pre-existing data cannot be read.<p></li>
|
||
|
</ul>
|
||
|
</ul>
|
||
|
|
||
|
<li>Even when multiple records have the same expiration time, JE
|
||
|
does not provide a way for them to expire atomically, as could be
|
||
|
done by explicitly deleting multiple records in a single
|
||
|
transaction. This restriction is for performance reasons; if records
|
||
|
could expire atomically, they could not be purged efficiently using
|
||
|
the JE cleaning process. Instead, each record expires individually,
|
||
|
as if each were deleted in a separate transaction. This means that
|
||
|
even when a set of records is inserted or updated atomically, a
|
||
|
query may return some but not not all of the records, when any of
|
||
|
the records expire at a time very close to the time of the query.
|
||
|
This is because the system clock is checked for each record
|
||
|
individually at the time it is read by the query, and because
|
||
|
expired records may be purged by other threads.<p></li>
|
||
|
|
||
|
<li>There are several special cases of the above rule that involve
|
||
|
access to primary and secondary databases. Because a given primary
|
||
|
record and its associated secondary records are normal records in
|
||
|
most respects, this set of records does not expire atomically. For
|
||
|
most read and write operations, JE treats the expiration of any
|
||
|
record in this set as if all records have expired, and in these
|
||
|
cases there is no special behavior to consider. For example:<p>
|
||
|
<ul>
|
||
|
<li>As long as the primary and secondary databases are
|
||
|
transactional, JE ensures that the expiration times of a
|
||
|
given primary record and all its associated secondary records
|
||
|
are the same.<p></li>
|
||
|
|
||
|
<li>When reading a primary record via a secondary key, JE
|
||
|
first reads the secondary record and then the primary. If
|
||
|
either record expires during this process, both records are
|
||
|
treated as expired.<p></li>
|
||
|
|
||
|
<li>When updating or deleting a primary record, JE first
|
||
|
reads the primary record to obtain the secondary keys and
|
||
|
then deletes/updates/inserts the secondary records as
|
||
|
needed. If a secondary record expires during this process,
|
||
|
this will not cause a <a href="../../../com/sleepycat/je/SecondaryIntegrityException.html" title="class in com.sleepycat.je"><code>SecondaryIntegrityException</code></a>, as
|
||
|
would normally happen when an expected associated record is
|
||
|
missing.<p></li>
|
||
|
|
||
|
<li>When a primary and/or secondary record expires after
|
||
|
being read, with few exceptions, repeatable-read semantics
|
||
|
are supported as described above, i.e., locks prevent
|
||
|
expiration from the viewpoint of the locking transaction or
|
||
|
cursor. Exceptions to this rule are described below.<p></li>
|
||
|
</ul>
|
||
|
|
||
|
However, there are several cases where such treatment by JE is not
|
||
|
practical, and the user should be aware of special behavior when
|
||
|
primary or secondary records expire. These are not common use cases,
|
||
|
but it is important to be aware of them. In the cases described
|
||
|
below, let us assume a primary database has two associated secondary
|
||
|
databases, and a particular primary record with primary key X has
|
||
|
two secondary records with keys A and B, one in each secondary
|
||
|
database.<p>
|
||
|
<ul>
|
||
|
<li>After a transaction or cursor reads and locks the primary
|
||
|
record via primary key X, reading via primary key X again
|
||
|
with the same transaction or cursor will also be successful
|
||
|
even if the record has expired, i.e., repeatable-read is
|
||
|
supported. However, if the record expires and the same
|
||
|
transaction or cursor attempts to read via key A or B, the
|
||
|
record will not be found. This is because the secondary
|
||
|
records for key A and B were not locked and they expire
|
||
|
independently of the primary record.<p></li>
|
||
|
|
||
|
<li>Similarly, after a transaction or cursor reads and locks
|
||
|
the primary record via secondary key A successfully, reading
|
||
|
via key A again with the same transaction or cursor will also
|
||
|
be successful even if the record has expired. Reading via
|
||
|
primary key X will also be successful, even if the record has
|
||
|
expired, because the primary record was locked. However, if
|
||
|
the record expires and the same transaction or cursor
|
||
|
attempts to read via key B, the record will not be found.
|
||
|
This is because the secondary record for key B was not locked
|
||
|
and it expires independently of the primary record and the
|
||
|
secondary record for key A.<p></li>
|
||
|
|
||
|
<li>When reading via a secondary database, it is possible to
|
||
|
read the only the secondary key and primary key (which are
|
||
|
both contained in the secondary record), but not the primary
|
||
|
record, by passing null for the 'data' parameter. In this
|
||
|
case the primary record is not locked. Therefore, if the
|
||
|
record expires and the same transaction or cursor attempts to
|
||
|
read the primary record (via any secondary key or the primary
|
||
|
key), the record will not be found.</li>
|
||
|
|
||
|
<li>When a record expires, if its database serves as
|
||
|
a <a href="../../../com/sleepycat/je/SecondaryConfig.html#setForeignKeyDatabase-com.sleepycat.je.Database-"><code>foreign key
|
||
|
database</code></a>, the <a href="../../../com/sleepycat/je/SecondaryConfig.html#setForeignKeyDeleteAction-com.sleepycat.je.ForeignKeyDeleteAction-"><code>foreign key delete
|
||
|
action</code></a> will not be enforced. Therefore, setting a TTL for a
|
||
|
record in a foreign key database is not recommended. The same
|
||
|
is true when using the DPL and a foreign key database is
|
||
|
specified using <a href="../../../com/sleepycat/persist/model/SecondaryKey.html#relatedEntity--"><code>SecondaryKey.relatedEntity()</code></a>.
|
||
|
<p></li>
|
||
|
</ul>
|
||
|
<p></li>
|
||
|
|
||
|
<li>When JE detects what may be an internal integrity error, it
|
||
|
tries to determine whether an expired record, rather than a true
|
||
|
integrity error, is the underlying cause. To prevent internal errors
|
||
|
when small changes in the system clock time are made, if a record
|
||
|
has expired within <a href="../../../com/sleepycat/je/EnvironmentConfig.html#ENV_TTL_CLOCK_TOLERANCE"><code>EnvironmentConfig.ENV_TTL_CLOCK_TOLERANCE</code></a>
|
||
|
(two hours, by default), JE treats the record as deleted and no
|
||
|
exception is thrown.
|
||
|
|
||
|
<p>When an integrity error does cause an exception to be thrown, the
|
||
|
record's expiration time will be included in the exception message
|
||
|
and this can help to diagnose the problem. This includes the
|
||
|
following exceptions:
|
||
|
<ul>
|
||
|
<li><a href="../../../com/sleepycat/je/SecondaryIntegrityException.html" title="class in com.sleepycat.je"><code>SecondaryIntegrityException</code></a></li>
|
||
|
<li><a href="../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je"><code>EnvironmentFailureException</code></a> with
|
||
|
LOG_FILE_NOT_FOUND in the message.</li>
|
||
|
</ul>
|
||
|
</p>
|
||
|
|
||
|
<p>In cases where the clock has been changed by more than one hour
|
||
|
and integrity exceptions occur because of this, it may be possible
|
||
|
to avoid the exceptions by setting the <a href="../../../com/sleepycat/je/EnvironmentConfig.html#ENV_TTL_CLOCK_TOLERANCE"><code>EnvironmentConfig.ENV_TTL_CLOCK_TOLERANCE</code></a> configuration parameter
|
||
|
to a larger value.</p></li>
|
||
|
</ul>
|
||
|
|
||
|
<p>In order to use the TTL feature in a ReplicatedEnvironment, all nodes
|
||
|
must be upgraded to JE 7.0 or later. If one or more nodes in a group
|
||
|
uses an earlier version, an IllegalStateException will be thrown when
|
||
|
attempting a put operation with a non-zero TTL. Also, once records with
|
||
|
a non-zero TTL have been written, a node using an earlier version of JE
|
||
|
may not join the group; if this is attempted, the node will fail during
|
||
|
open with an EnvironmentFailureException.</p></div>
|
||
|
<dl>
|
||
|
<dt><span class="simpleTagLabel">Since:</span></dt>
|
||
|
<dd>7.0</dd>
|
||
|
</dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="summary">
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList"><a name="constructor.summary">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<h3>Constructor Summary</h3>
|
||
|
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
|
||
|
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
|
||
|
<tr>
|
||
|
<th class="colOne" scope="col">Constructor and Description</th>
|
||
|
</tr>
|
||
|
<tr class="altColor">
|
||
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/WriteOptions.html#WriteOptions--">WriteOptions</a></span>()</code>
|
||
|
<div class="block">Constructs a WriteOptions object with default values for all properties.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<!-- ========== METHOD SUMMARY =========== -->
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList"><a name="method.summary">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<h3>Method Summary</h3>
|
||
|
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
|
||
|
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
|
||
|
<tr>
|
||
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
||
|
<th class="colLast" scope="col">Method and Description</th>
|
||
|
</tr>
|
||
|
<tr id="i0" class="altColor">
|
||
|
<td class="colFirst"><code><a href="../../../com/sleepycat/je/WriteOptions.html" title="class in com.sleepycat.je">WriteOptions</a></code></td>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/WriteOptions.html#clone--">clone</a></span>()</code> </td>
|
||
|
</tr>
|
||
|
<tr id="i1" class="rowColor">
|
||
|
<td class="colFirst"><code><a href="../../../com/sleepycat/je/CacheMode.html" title="enum in com.sleepycat.je">CacheMode</a></code></td>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/WriteOptions.html#getCacheMode--">getCacheMode</a></span>()</code>
|
||
|
<div class="block">Returns the <code>CacheMode</code> to be used for the operation, or null
|
||
|
if the Cursor, Database or Environment default will be used.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr id="i2" class="altColor">
|
||
|
<td class="colFirst"><code>int</code></td>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/WriteOptions.html#getTTL--">getTTL</a></span>()</code>
|
||
|
<div class="block">Returns the Time-To-Live property for a 'put' operation.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr id="i3" class="rowColor">
|
||
|
<td class="colFirst"><code>java.util.concurrent.TimeUnit</code></td>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/WriteOptions.html#getTTLUnit--">getTTLUnit</a></span>()</code>
|
||
|
<div class="block">Returns the Time-To-Live time unit for a 'put' operation.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr id="i4" class="altColor">
|
||
|
<td class="colFirst"><code>boolean</code></td>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/WriteOptions.html#getUpdateTTL--">getUpdateTTL</a></span>()</code>
|
||
|
<div class="block">Returns the update-TTL property for a 'put' operation.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr id="i5" class="rowColor">
|
||
|
<td class="colFirst"><code><a href="../../../com/sleepycat/je/WriteOptions.html" title="class in com.sleepycat.je">WriteOptions</a></code></td>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/WriteOptions.html#setCacheMode-com.sleepycat.je.CacheMode-">setCacheMode</a></span>(<a href="../../../com/sleepycat/je/CacheMode.html" title="enum in com.sleepycat.je">CacheMode</a> cacheMode)</code>
|
||
|
<div class="block">Sets the <code>CacheMode</code> to be used for the operation.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr id="i6" class="altColor">
|
||
|
<td class="colFirst"><code><a href="../../../com/sleepycat/je/WriteOptions.html" title="class in com.sleepycat.je">WriteOptions</a></code></td>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/WriteOptions.html#setExpirationTime-long-java.util.concurrent.TimeUnit-">setExpirationTime</a></span>(long expirationTime,
|
||
|
java.util.concurrent.TimeUnit timeUnit)</code>
|
||
|
<div class="block">A convenience method to set the TTL based on a given expiration time
|
||
|
and the current system time.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr id="i7" class="rowColor">
|
||
|
<td class="colFirst"><code><a href="../../../com/sleepycat/je/WriteOptions.html" title="class in com.sleepycat.je">WriteOptions</a></code></td>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/WriteOptions.html#setTTL-int-">setTTL</a></span>(int ttl)</code>
|
||
|
<div class="block">Sets the Time-To-Live property for a 'put' operation, using
|
||
|
<code>TimeUnit.Days</code> as the TTL unit.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr id="i8" class="altColor">
|
||
|
<td class="colFirst"><code><a href="../../../com/sleepycat/je/WriteOptions.html" title="class in com.sleepycat.je">WriteOptions</a></code></td>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/WriteOptions.html#setTTL-int-java.util.concurrent.TimeUnit-">setTTL</a></span>(int ttl,
|
||
|
java.util.concurrent.TimeUnit timeUnit)</code>
|
||
|
<div class="block">Sets the Time-To-Live property for a 'put' operation, using the given
|
||
|
<code>TimeUnit</code>.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr id="i9" class="rowColor">
|
||
|
<td class="colFirst"><code><a href="../../../com/sleepycat/je/WriteOptions.html" title="class in com.sleepycat.je">WriteOptions</a></code></td>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/WriteOptions.html#setUpdateTTL-boolean-">setUpdateTTL</a></span>(boolean updateTtl)</code>
|
||
|
<div class="block">Sets the update-TTL property for a 'put' operation.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<h3>Methods inherited from class java.lang.Object</h3>
|
||
|
<code>equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="details">
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<!-- ========= CONSTRUCTOR DETAIL ======== -->
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList"><a name="constructor.detail">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<h3>Constructor Detail</h3>
|
||
|
<a name="WriteOptions--">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockListLast">
|
||
|
<li class="blockList">
|
||
|
<h4>WriteOptions</h4>
|
||
|
<pre>public WriteOptions()</pre>
|
||
|
<div class="block">Constructs a WriteOptions object with default values for all properties.</div>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<!-- ============ METHOD DETAIL ========== -->
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList"><a name="method.detail">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<h3>Method Detail</h3>
|
||
|
<a name="clone--">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>clone</h4>
|
||
|
<pre>public <a href="../../../com/sleepycat/je/WriteOptions.html" title="class in com.sleepycat.je">WriteOptions</a> clone()</pre>
|
||
|
<dl>
|
||
|
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
|
||
|
<dd><code>clone</code> in class <code>java.lang.Object</code></dd>
|
||
|
</dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="setCacheMode-com.sleepycat.je.CacheMode-">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>setCacheMode</h4>
|
||
|
<pre>public <a href="../../../com/sleepycat/je/WriteOptions.html" title="class in com.sleepycat.je">WriteOptions</a> setCacheMode(<a href="../../../com/sleepycat/je/CacheMode.html" title="enum in com.sleepycat.je">CacheMode</a> cacheMode)</pre>
|
||
|
<div class="block">Sets the <code>CacheMode</code> to be used for the operation.
|
||
|
<p>
|
||
|
By default this property is null, meaning that the default specified
|
||
|
using <a href="../../../com/sleepycat/je/Cursor.html#setCacheMode-com.sleepycat.je.CacheMode-"><code>Cursor.setCacheMode(com.sleepycat.je.CacheMode)</code></a>,
|
||
|
<a href="../../../com/sleepycat/je/DatabaseConfig.html#setCacheMode-com.sleepycat.je.CacheMode-"><code>DatabaseConfig.setCacheMode(com.sleepycat.je.CacheMode)</code></a> or
|
||
|
<a href="../../../com/sleepycat/je/EnvironmentMutableConfig.html#setCacheMode-com.sleepycat.je.CacheMode-"><code>EnvironmentMutableConfig.setCacheMode(com.sleepycat.je.CacheMode)</code></a> will be used.</div>
|
||
|
<dl>
|
||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||
|
<dd><code>cacheMode</code> - is the <code>CacheMode</code> used for the operation, or
|
||
|
null to use the Cursor, Database or Environment default.</dd>
|
||
|
<dt><span class="returnLabel">Returns:</span></dt>
|
||
|
<dd>'this'.</dd>
|
||
|
</dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="getCacheMode--">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>getCacheMode</h4>
|
||
|
<pre>public <a href="../../../com/sleepycat/je/CacheMode.html" title="enum in com.sleepycat.je">CacheMode</a> getCacheMode()</pre>
|
||
|
<div class="block">Returns the <code>CacheMode</code> to be used for the operation, or null
|
||
|
if the Cursor, Database or Environment default will be used.</div>
|
||
|
<dl>
|
||
|
<dt><span class="seeLabel">See Also:</span></dt>
|
||
|
<dd><a href="../../../com/sleepycat/je/WriteOptions.html#setCacheMode-com.sleepycat.je.CacheMode-"><code>setCacheMode(CacheMode)</code></a></dd>
|
||
|
</dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="setTTL-int-">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>setTTL</h4>
|
||
|
<pre>public <a href="../../../com/sleepycat/je/WriteOptions.html" title="class in com.sleepycat.je">WriteOptions</a> setTTL(int ttl)</pre>
|
||
|
<div class="block">Sets the Time-To-Live property for a 'put' operation, using
|
||
|
<code>TimeUnit.Days</code> as the TTL unit.</div>
|
||
|
<dl>
|
||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||
|
<dd><code>ttl</code> - the number of days after the current time on which
|
||
|
the record will automatically expire, or zero for no automatic
|
||
|
expiration. May not be negative.</dd>
|
||
|
<dt><span class="returnLabel">Returns:</span></dt>
|
||
|
<dd>'this'.</dd>
|
||
|
<dt><span class="seeLabel">See Also:</span></dt>
|
||
|
<dd><a href="#ttl">Time-To-Live</a></dd>
|
||
|
</dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="setTTL-int-java.util.concurrent.TimeUnit-">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>setTTL</h4>
|
||
|
<pre>public <a href="../../../com/sleepycat/je/WriteOptions.html" title="class in com.sleepycat.je">WriteOptions</a> setTTL(int ttl,
|
||
|
java.util.concurrent.TimeUnit timeUnit)</pre>
|
||
|
<div class="block">Sets the Time-To-Live property for a 'put' operation, using the given
|
||
|
<code>TimeUnit</code>.</div>
|
||
|
<dl>
|
||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||
|
<dd><code>ttl</code> - the number of days or hours after the current time on which
|
||
|
the record will automatically expire, or zero for no automatic
|
||
|
expiration. May not be negative.</dd>
|
||
|
<dd><code>timeUnit</code> - is TimeUnit.DAYS or TimeUnit.HOURS. TimeUnit.DAYS is
|
||
|
recommended to minimize storage requirements (memory and disk).</dd>
|
||
|
<dt><span class="returnLabel">Returns:</span></dt>
|
||
|
<dd>'this'.</dd>
|
||
|
<dt><span class="seeLabel">See Also:</span></dt>
|
||
|
<dd><a href="#ttl">Time-To-Live</a></dd>
|
||
|
</dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="getTTL--">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>getTTL</h4>
|
||
|
<pre>public int getTTL()</pre>
|
||
|
<div class="block">Returns the Time-To-Live property for a 'put' operation.</div>
|
||
|
<dl>
|
||
|
<dt><span class="seeLabel">See Also:</span></dt>
|
||
|
<dd><a href="../../../com/sleepycat/je/WriteOptions.html#setTTL-int-"><code>setTTL(int)</code></a></dd>
|
||
|
</dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="getTTLUnit--">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>getTTLUnit</h4>
|
||
|
<pre>public java.util.concurrent.TimeUnit getTTLUnit()</pre>
|
||
|
<div class="block">Returns the Time-To-Live time unit for a 'put' operation.</div>
|
||
|
<dl>
|
||
|
<dt><span class="seeLabel">See Also:</span></dt>
|
||
|
<dd><a href="../../../com/sleepycat/je/WriteOptions.html#setTTL-int-java.util.concurrent.TimeUnit-"><code>setTTL(int, TimeUnit)</code></a></dd>
|
||
|
</dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="setUpdateTTL-boolean-">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>setUpdateTTL</h4>
|
||
|
<pre>public <a href="../../../com/sleepycat/je/WriteOptions.html" title="class in com.sleepycat.je">WriteOptions</a> setUpdateTTL(boolean updateTtl)</pre>
|
||
|
<div class="block">Sets the update-TTL property for a 'put' operation.
|
||
|
<p>
|
||
|
If this property is true and the operation updates a record, the
|
||
|
specified TTL will be used to assign a new expiration time for the
|
||
|
record, or to clear the record's expiration time if the specified
|
||
|
TTL is zero.
|
||
|
<p>
|
||
|
If this parameter is false and the operation updates a record, the
|
||
|
record's expiration time will not be changed.
|
||
|
<p>
|
||
|
If the operation inserts a record, this parameter is ignored and the
|
||
|
specified TTL is always applied.
|
||
|
<p>
|
||
|
By default, this property is false.</div>
|
||
|
<dl>
|
||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||
|
<dd><code>updateTtl</code> - is whether to assign (or clear) the expiration time
|
||
|
when updating an existing record.</dd>
|
||
|
<dt><span class="returnLabel">Returns:</span></dt>
|
||
|
<dd>'this'.</dd>
|
||
|
<dt><span class="seeLabel">See Also:</span></dt>
|
||
|
<dd><a href="#ttl">Time-To-Live</a></dd>
|
||
|
</dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="getUpdateTTL--">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>getUpdateTTL</h4>
|
||
|
<pre>public boolean getUpdateTTL()</pre>
|
||
|
<div class="block">Returns the update-TTL property for a 'put' operation.</div>
|
||
|
<dl>
|
||
|
<dt><span class="seeLabel">See Also:</span></dt>
|
||
|
<dd><a href="../../../com/sleepycat/je/WriteOptions.html#setUpdateTTL-boolean-"><code>setUpdateTTL(boolean)</code></a></dd>
|
||
|
</dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="setExpirationTime-long-java.util.concurrent.TimeUnit-">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockListLast">
|
||
|
<li class="blockList">
|
||
|
<h4>setExpirationTime</h4>
|
||
|
<pre>public <a href="../../../com/sleepycat/je/WriteOptions.html" title="class in com.sleepycat.je">WriteOptions</a> setExpirationTime(long expirationTime,
|
||
|
java.util.concurrent.TimeUnit timeUnit)</pre>
|
||
|
<div class="block">A convenience method to set the TTL based on a given expiration time
|
||
|
and the current system time.
|
||
|
<p>
|
||
|
Given a desired expiration time and <code>TimeUnit</code> (DAYS or HOURS),
|
||
|
sets the TTL to a value that will cause a record to expire at or after
|
||
|
the given time, if the record is stored at the current time. The
|
||
|
intended use case is to determine the TTL when writing a record and the
|
||
|
desired expiration time, rather than the TTL, is known.
|
||
|
<p>
|
||
|
This method determines the TTL by taking the difference between the
|
||
|
current time and the given time, converting it from milliseconds to
|
||
|
days (or hours), and rounding up if it is not evenly divisible by
|
||
|
the number of milliseconds in one day (or hour).
|
||
|
<p>
|
||
|
A special use case is when the expiration time was previously obtained
|
||
|
from <a href="../../../com/sleepycat/je/OperationResult.html#getExpirationTime--"><code>OperationResult.getExpirationTime()</code></a>, for example, when
|
||
|
performing an export followed by an import. To support this, null can be
|
||
|
passed for the timeUnit parameter and the time unit will be determined
|
||
|
as follows.
|
||
|
<ul>
|
||
|
<li>This method first converts the expiration time to a TTL in
|
||
|
hours, as described above. If the expiration time was obtained by
|
||
|
calling <a href="../../../com/sleepycat/je/OperationResult.html#getExpirationTime--"><code>OperationResult.getExpirationTime()</code></a>, then it will be
|
||
|
evenly divisible by the number of milliseconds in one hour and no
|
||
|
rounding will occur.</li>
|
||
|
|
||
|
<li>If the resulting TTL in hours is an even multiple of 24,
|
||
|
<code>DAYS</code> is used; otherwise, <code>HOURS</code> is used. For example,
|
||
|
when performing an import, if the original expiration time was
|
||
|
specified in <code>DAYS</code>, and obtained by calling
|
||
|
<a href="../../../com/sleepycat/je/OperationResult.html#getExpirationTime--"><code>OperationResult.getExpirationTime()</code></a>, the unit derived by this
|
||
|
method will also be <code>DAYS</code>.</li>
|
||
|
</ul>
|
||
|
<p>
|
||
|
Note that when a particular time unit is desired, null should not be
|
||
|
passed for the timeUnit parameter. Normally <code>TimeUnit.DAYS</code> is
|
||
|
recommended instead of <code>TimeUnit.HOURS</code>, to minimize storage
|
||
|
requirements (memory and disk). When the desired unit is known, the unit
|
||
|
should be passed explicitly.</div>
|
||
|
<dl>
|
||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||
|
<dd><code>expirationTime</code> - is the desired expiration time in milliseconds
|
||
|
(UTC), or zero for no automatic expiration.</dd>
|
||
|
<dd><code>timeUnit</code> - is <code>TimeUnit.DAYS</code> or <code>TimeUnit.HOURS</code>, or
|
||
|
null to derive the time unit as described above.</dd>
|
||
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
||
|
<dd><code>java.lang.IllegalArgumentException</code> - if ttlUnits is not DAYS, HOURS or null.</dd>
|
||
|
<dt><span class="seeLabel">See Also:</span></dt>
|
||
|
<dd><a href="#ttl">Time-To-Live</a></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="class-use/WriteOptions.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 class="aboutLanguage"><b>Berkeley DB Java Edition</b><br><font size=\"-1\"> version 7.5.11</font>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="subNav">
|
||
|
<ul class="navList">
|
||
|
<li><a href="../../../com/sleepycat/je/VersionMismatchException.html" title="class in com.sleepycat.je"><span class="typeNameLink">Prev Class</span></a></li>
|
||
|
<li><a href="../../../com/sleepycat/je/XAEnvironment.html" title="class in com.sleepycat.je"><span class="typeNameLink">Next Class</span></a></li>
|
||
|
</ul>
|
||
|
<ul class="navList">
|
||
|
<li><a href="../../../index.html?com/sleepycat/je/WriteOptions.html" target="_top">Frames</a></li>
|
||
|
<li><a href="WriteOptions.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: </li>
|
||
|
<li>Nested | </li>
|
||
|
<li>Field | </li>
|
||
|
<li><a href="#constructor.summary">Constr</a> | </li>
|
||
|
<li><a href="#method.summary">Method</a></li>
|
||
|
</ul>
|
||
|
<ul class="subNavList">
|
||
|
<li>Detail: </li>
|
||
|
<li>Field | </li>
|
||
|
<li><a href="#constructor.detail">Constr</a> | </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><font size=1>Copyright (c) 2002, 2017 Oracle and/or its affiliates. All rights reserved.</font> </small></p>
|
||
|
</body>
|
||
|
</html>
|