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 . |
InMemoryFormat |
getInMemoryFormat()
Gets the
InMemoryFormat of the storage for internal records. |
String |
getName()
Gets the name of this
NearCache instance. |
NearCacheStats |
getNearCacheStats()
Get the
NearCacheStats instance to monitor this store. |
NearCachePreloaderConfig |
getPreloaderConfig()
Gets the
NearCachePreloaderConfig of this Near Cache. |
void |
invalidate(K key)
Removes the value associated with the given
key
and increases the invalidation statistics. |
boolean |
isAvailable() |
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)
Puts (associates) a value with the given
key . |
Object |
selectToSave(Object... candidates)
Selects the best candidate object to store from the given
candidates . |
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)
key
.key
- the key of the value will be storedkeyData
- the key as Data
of the value will be storedvalue
- the value will be storedvoid invalidate(K key)
key
and increases the invalidation statistics.key
- the key of the value will be invalidatedvoid clear()
void destroy()
int size()
boolean isAvailable()
InMemoryFormat getInMemoryFormat()
InMemoryFormat
of the storage for internal records.InMemoryFormat
of the storage for internal recordsNearCachePreloaderConfig getPreloaderConfig()
NearCachePreloaderConfig
of this Near Cache.NearCachePreloaderConfig
of this Near CacheNearCacheStats 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.Object selectToSave(Object... candidates)
candidates
.candidates
- the candidates from which the best candidate object will be selected.candidates
.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.
T
- the type of the class modeled by this Class objectclazz
- the type of returning object.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 © 2018 Hazelcast, Inc.. All Rights Reserved.