K
- the type of the keyV
- the type of the valuepublic interface NearCacheRecordStore<K,V> extends InitializingObject
NearCacheRecordStore
is the contract point to store keys and values as
NearCacheRecord
internally and to serve them.Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all stored values.
|
void |
destroy()
Clears the record store and destroys it.
|
void |
doEviction(boolean withoutMaxSizeCheck)
Does eviction as specified configuration
EvictionConfig
in NearCacheConfig . |
void |
doExpiration()
Performs expiration and evicts expired records.
|
V |
get(K key)
Gets the value associated with the given
key . |
NearCacheStats |
getNearCacheStats()
Get the
NearCacheStats instance to monitor this record store. |
NearCacheRecord |
getRecord(K key)
Gets the record associated with the given
key . |
void |
invalidate(K key)
Removes the value associated with the given
key
and increases the invalidation statistics. |
void |
loadKeys(DataStructureAdapter<Object,?> adapter)
Loads the keys into the Near Cache.
|
void |
put(K key,
Data keyData,
V value,
Data valueData)
Puts (associates) a value with the given
key . |
void |
setStaleReadDetector(StaleReadDetector detector) |
int |
size()
Gets the number of stored records.
|
void |
storeKeys()
Persists the key set 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.
|
initialize
V get(K key)
key
.key
- the key from which to get the associated value.key
.void put(K key, Data keyData, V value, Data valueData)
key
.key
- the key to which the given value will be associated.keyData
- the key as Data
to which the given value will be associated.value
- the value that will be associated with the key.valueData
- 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 nullvoid invalidate(K key)
key
and increases the invalidation statistics.key
- the key of the value will be invalidatedvoid clear()
void destroy()
int size()
NearCacheRecord getRecord(K key)
key
.key
- the key from which to get the associated NearCacheRecord
.NearCacheRecord
associated with the given key
.NearCacheStats getNearCacheStats()
NearCacheStats
instance to monitor this record store.NearCacheStats
instance to monitor this record store.void doExpiration()
void doEviction(boolean withoutMaxSizeCheck)
EvictionConfig
in NearCacheConfig
.withoutMaxSizeCheck
- set true
to evict regardless of a max
size check, otherwise set false
to evict
after a max size check.void loadKeys(DataStructureAdapter<Object,?> adapter)
void storeKeys()
void setStaleReadDetector(StaleReadDetector detector)
StaleReadDetector
Copyright © 2022 Hazelcast, Inc.. All Rights Reserved.