public class CacheRecordHashMap extends SampleableConcurrentHashMap<Data,CacheRecord> implements SampleableCacheRecordMap<Data,CacheRecord>
SampleableConcurrentHashMap.SamplingEntry<K,V>
ConcurrentReferenceHashMap.Option, ConcurrentReferenceHashMap.ReferenceType, ConcurrentReferenceHashMap.SimpleEntry<K,V>, ConcurrentReferenceHashMap.WriteThroughEntry
AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
CacheRecordHashMap(SerializationService serializationService,
int initialCapacity,
CacheContext cacheContext) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all of the mappings from this map.
|
protected com.hazelcast.cache.impl.record.CacheRecordHashMap.CacheEvictableSamplingEntry |
createSamplingEntry(Data key,
CacheRecord value) |
CacheEntryIterationResult |
fetchEntries(int nextTableIndex,
int size)
Fetches entries in bulk as specified size at most.
|
CacheKeyIterationResult |
fetchKeys(int nextTableIndex,
int size)
Fetches keys in bulk as specified size at most.
|
CacheRecord |
put(Data key,
CacheRecord value)
Maps the specified key to the specified value in this table.
|
CacheRecord |
putIfAbsent(Data key,
CacheRecord value) |
CacheRecord |
remove(Object key)
Removes the key (and its corresponding value) from this map.
|
boolean |
remove(Object key,
Object value) |
Iterable<com.hazelcast.cache.impl.record.CacheRecordHashMap.CacheEvictableSamplingEntry> |
sample(int sampleCount)
The sample method is used to sample a number of entries (defined by the samples parameter) from
the internal data structure.
|
void |
setEntryCounting(boolean enable)
Sets the entry counting behaviour.
|
<C extends EvictionCandidate<Data,CacheRecord>> |
tryEvict(C evictionCandidate,
EvictionListener<Data,CacheRecord> evictionListener)
The evict method is called by the
EvictionStrategy to eventually evict, by the policy, selected
candidate from the internal data structures. |
fetchEntries, fetchKeys, getRandomSamples, isValidForFetching, isValidForSampling
applyIfAbsent, applyIfPresent, contains, containsKey, containsValue, elements, entrySet, get, isEmpty, keys, keySet, purgeStaleEntries, putAll, replace, replace, size, values
clone, equals, hashCode, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, putAll, replace, replace, replaceAll, size, values
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
public CacheRecordHashMap(SerializationService serializationService, int initialCapacity, CacheContext cacheContext)
public void setEntryCounting(boolean enable)
CacheRecordMap
setEntryCounting
in interface CacheRecordMap<Data,CacheRecord>
enable
- enables the entry counting behaviour if it is true, otherwise disables.public CacheRecord put(Data key, CacheRecord value)
ConcurrentReferenceHashMap
The value can be retrieved by calling the get method with a key that is equal to the original key.
put
in interface Map<Data,CacheRecord>
put
in class ConcurrentReferenceHashMap<Data,CacheRecord>
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keypublic CacheRecord putIfAbsent(Data key, CacheRecord value)
ConcurrentReferenceHashMap
putIfAbsent
in interface ConcurrentMap<Data,CacheRecord>
putIfAbsent
in interface Map<Data,CacheRecord>
putIfAbsent
in class ConcurrentReferenceHashMap<Data,CacheRecord>
public CacheRecord remove(Object key)
ConcurrentReferenceHashMap
remove
in interface Map<Data,CacheRecord>
remove
in class ConcurrentReferenceHashMap<Data,CacheRecord>
key
- the key that needs to be removedpublic boolean remove(Object key, Object value)
ConcurrentReferenceHashMap
remove
in interface ConcurrentMap<Data,CacheRecord>
remove
in interface Map<Data,CacheRecord>
remove
in class ConcurrentReferenceHashMap<Data,CacheRecord>
public void clear()
ConcurrentReferenceHashMap
clear
in interface Map<Data,CacheRecord>
clear
in class ConcurrentReferenceHashMap<Data,CacheRecord>
protected com.hazelcast.cache.impl.record.CacheRecordHashMap.CacheEvictableSamplingEntry createSamplingEntry(Data key, CacheRecord value)
createSamplingEntry
in class SampleableConcurrentHashMap<Data,CacheRecord>
public CacheKeyIterationResult fetchKeys(int nextTableIndex, int size)
CacheRecordMap
fetchKeys
in interface CacheRecordMap<Data,CacheRecord>
nextTableIndex
- starting point for fetchingsize
- maximum bulk size to fetch the keysCacheKeyIterationResult
instance contains fetched keyspublic CacheEntryIterationResult fetchEntries(int nextTableIndex, int size)
CacheRecordMap
fetchEntries
in interface CacheRecordMap<Data,CacheRecord>
nextTableIndex
- starting point for fetchingsize
- maximum bulk size to fetch the entriesCacheEntryIterationResult
instance contains fetched keyspublic <C extends EvictionCandidate<Data,CacheRecord>> boolean tryEvict(C evictionCandidate, EvictionListener<Data,CacheRecord> evictionListener)
EvictableStore
EvictionStrategy
to eventually evict, by the policy, selected
candidate from the internal data structures.
It could be the selected evicted candidate cannot be evicted. For example it might be gone at the time when
the method is executed. In this case it will indicate this condition by returning false.tryEvict
in interface EvictableStore<Data,CacheRecord>
evictionCandidate
- EvictionCandidate
to be evictedevictionListener
- EvictionListener
to listen evicted entriestrue
if the candidate was evicted, otherwise returns false
public Iterable<com.hazelcast.cache.impl.record.CacheRecordHashMap.CacheEvictableSamplingEntry> sample(int sampleCount)
SampleableEvictableStore
sample
in interface SampleableEvictableStore<Data,CacheRecord>
sampleCount
- Entry count to be sampledEvictionCandidate
to be evictedCopyright © 2018 Hazelcast, Inc.. All Rights Reserved.