|
Berkeley DB Java Edition version 3.3.98 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Objectjava.lang.Enum<CacheMode>
com.sleepycat.je.CacheMode
public enum CacheMode
Modes that can be specified for control over caching of records in the JE in-memory cache. When a record is stored or retrieved, the cache mode determines how long the record is subsequently retained in the JE in-memory cache, relative to other records in the cache.
When the cache overflows, JE must evict some records from the cache. By default, JE uses a Least Recently Used (LRU) algorithm for determining which records to evict. With the LRU algorithm, JE makes a best effort to evict the "coldest" (least recently used or accessed) records and to retain the "hottest" records in the cache for as long as possible.
A non-default cache mode may be explicitly specified to override the
default behavior of the LRU algorithm. See KEEP_HOT
and UNCHANGED
for more information. When no cache mode is explicitly
specified, the default cache mode is DEFAULT
. The default mode
causes the normal LRU algorithm to be used.
Note that JE makes a best effort to implement an approximation of an LRU algorithm, and the very coldest record is not always evicted from the cache first. In addition, hotness and coldness are applied to the portion of the in-memory BTree that is accessed to perform the operation, not just to the record itself.
The cache mode for cursor operations can be specified by calling Cursor.setCacheMode
after opening a Cursor
.
The cache mode applies to all operations subsequently performed with that
cursor until the cursor is closed or its cache mode is changed. The cache
mode for Database
methods may not be specified and the default cache
mode is always used. To override the default cache mode, you must open a
Cursor.
Enum Constant Summary | |
---|---|
DEFAULT
The record's hotness is changed to "most recently used" by the operation where this cache mode is specified. |
|
EVICT_LN
The record (leaf node) is evicted as soon as possible after the operation where this cache mode is specified. |
|
KEEP_HOT
The record is assigned "maximum hotness" by the operation where this cache mode is specified. |
|
MAKE_COLD
The record is assigned "maximum coldness" by the operation where this cache mode is specified. |
|
UNCHANGED
The record's hotness or coldness is unchanged by the operation where this cache mode is specified. |
Method Summary | |
---|---|
static CacheMode |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static CacheMode[] |
values()
Returns an array containing the constants of this enum type, in the order they're declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final CacheMode DEFAULT
The record will be colder then other records accessed with a KEEP_HOT
cache mode. Otherwise, the record will be hotter than
other records accessed before it and colder then other records accessed
after it.
This cache mode is used when the application does not need explicit control over the cache and a standard LRU implementation is sufficient.
public static final CacheMode UNCHANGED
If the record was present in the cache prior to this operation, then its pre-existing hotness or coldness will not be changed. If the record was added to the cache by this operation, it will have "maximum coldness" and will therefore be colder than other records.
This cache mode is normally used when the application does not intend to access this record again soon.
public static final CacheMode KEEP_HOT
The record will have the same hotness as other records accessed with
this cache mode. Its relative hotness will not be reduced over time as
other records are accessed. It can only become colder over time if it
is subsequently accessed with the DEFAULT
or MAKE_COLD
cache mode.
This cache mode is normally used when the application intends to access this record again soon.
public static final CacheMode MAKE_COLD
The record will have the same hotness as other records accessed with
this cache mode. It is very likely that this record will be evicted
from the cache if space is needed. It can only become warmer over time
if it is subsequently accessed with the DEFAULT
or
KEEP_HOT
cache mode.
This cache mode is normally used when the application does not intend to access this record again soon.
public static final CacheMode EVICT_LN
MAKE_COLD
were used.
This cache mode is normally used when the application prefers to read the record from the log file when it is accessed again, rather than have it take up space in the JE cache and potentially cause expensive Java GC.
Method Detail |
---|
public static final CacheMode[] values()
for(CacheMode c : CacheMode.values()) System.out.println(c);
public static CacheMode valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
|
Berkeley DB Java Edition version 3.3.98 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |