K
- the type of the keyV
- the type of the valuepublic interface NearCache<K,V> extends InitializingObject
NearCache
is the contract point to store keys and values in underlying
NearCacheRecordStore
.Modifier and Type | Field and Description |
---|---|
static Object |
CACHED_AS_NULL
NULL Object
|
static int |
DEFAULT_EXPIRATION_TASK_INITIAL_DELAY_SECONDS
Default expiration task initial delay time as seconds
|
static int |
DEFAULT_EXPIRATION_TASK_PERIOD_SECONDS
Default expiration task delay time as seconds
|
static Object |
NOT_CACHED
NOT_CACHED Object
|
static String |
PROP_EXPIRATION_TASK_INITIAL_DELAY_SECONDS |
static String |
PROP_EXPIRATION_TASK_PERIOD_SECONDS |
static HazelcastProperty |
TASK_INITIAL_DELAY_SECONDS |
static HazelcastProperty |
TASK_PERIOD_SECONDS |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all stored values.
|
void |
destroy()
Clears the record store and destroys it.
|
V |
get(K key)
Gets the value associated with the given
key . |
String |
getName()
Gets the name of this
NearCache instance. |
NearCacheStats |
getNearCacheStats()
Get the
NearCacheStats instance to
monitor this store. |
void |
invalidate(K key)
Removes the value associated with the given
key
and increases the invalidation statistics. |
boolean |
isPreloadDone()
Checks if the pre-loading of the Near Cache is done.
|
boolean |
isSerializeKeys()
Checks if the Near Cache key is stored in serialized format or
by-reference.
|
void |
preload(DataStructureAdapter<Object,?> adapter)
Executes the Near Cache pre-loader on the given
DataStructureAdapter . |
void |
put(K key,
Data keyData,
V value,
Data valueData)
Puts (associates) a value with the given
key . |
int |
size()
Gets the count of stored records.
|
void |
storeKeys()
Stores the keys of the Near Cache.
|
V |
tryPublishReserved(K key,
V value,
long reservationId,
boolean deserialize)
Tries to update reserved key with supplied value.
|
long |
tryReserveForUpdate(K key,
Data keyData)
Tries to reserve supplied key for update.
|
<T> T |
unwrap(Class<T> clazz)
Used to access non-standard methods of an implementation.
|
initialize
static final int DEFAULT_EXPIRATION_TASK_INITIAL_DELAY_SECONDS
static final int DEFAULT_EXPIRATION_TASK_PERIOD_SECONDS
static final String PROP_EXPIRATION_TASK_INITIAL_DELAY_SECONDS
static final String PROP_EXPIRATION_TASK_PERIOD_SECONDS
static final HazelcastProperty TASK_INITIAL_DELAY_SECONDS
static final HazelcastProperty TASK_PERIOD_SECONDS
static final Object CACHED_AS_NULL
static final Object NOT_CACHED
String getName()
NearCache
instance.NearCache
instanceV get(K key)
key
.key
- the key of the requested valuekey
void put(K key, Data keyData, V value, Data valueData)
key
.void invalidate(K key)
key
and increases the invalidation statistics.key
- the key of the value will be invalidatedvoid clear()
void destroy()
int size()
NearCacheStats getNearCacheStats()
NearCacheStats
instance to
monitor this store.NearCacheStats
instance
to monitor this storeboolean isSerializeKeys()
true
if the key is stored in serialized format,
false
if stored by-reference.void preload(DataStructureAdapter<Object,?> adapter)
DataStructureAdapter
.void storeKeys()
boolean isPreloadDone()
true
if the pre-loading is done, false
otherwise.<T> T unwrap(Class<T> clazz)
If this method is called on a wrapper object, result is wrapped object.
clazz
- the type of returning object. @param IllegalArgumentException
- if no implementation found for the supplied clazz type.long tryReserveForUpdate(K key, Data keyData)
If one thread takes reservation, only that thread can update the key.
key
- key to be reserved for updatekeyData
- key to be reserved for update as Data
NearCacheRecord.NOT_RESERVED
V tryPublishReserved(K key, V value, long reservationId, boolean deserialize)
key
- reserved key for updatevalue
- value to be associated with reserved keyreservationId
- ID for this reservationdeserialize
- eagerly deserialize
returning valuetrue
and update succeeds, otherwise returns nullCopyright © 2020 Hazelcast, Inc.. All Rights Reserved.