public class CacheRecordStore extends AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap> implements SplitBrainAwareCacheRecordStore
ICacheRecordStore
Hazelcast splits data homogeneously to partitions using keys. CacheRecordStore represents a named ICache on-heap
data store for a single partition.
This data structure is responsible for CRUD operations, entry processing, statistics, publishing events, cache
loader and writer and internal data operations like backup.
CacheRecordStore is accessed through CachePartitionSegment and CacheService.
CacheRecordStore is managed by CachePartitionSegment.Sample code accessing a CacheRecordStore and getting a value. Typical operation implementation:
CacheService service = getService();
ICacheRecordStore cache = service.getOrCreateCache(name, partitionId);
cache.get(key, expiryPolicy);
See AbstractCacheOperation
subclasses for actual examples.
CachePartitionSegment
,
CacheService
,
AbstractCacheOperation
AbstractCacheRecordStore.MaxSizeEvictionChecker
Modifier and Type | Field and Description |
---|---|
protected CacheRecordFactory |
cacheRecordFactory |
protected SerializationService |
serializationService |
batchEvent, cacheConfig, cacheContext, cacheLoader, cacheService, cacheWriter, DEFAULT_INITIAL_CAPACITY, defaultExpiryPolicy, eventsBatchingEnabled, eventsEnabled, evictionChecker, evictionConfig, evictionPolicyEvaluator, evictionStrategy, maxSizeChecker, name, nodeEngine, partitionCount, partitionId, primary, records, SOURCE_NOT_AVAILABLE, statistics, wanReplicationEnabled
UNIT_PERCENTAGE
NO_LISTENER
Constructor and Description |
---|
CacheRecordStore(String name,
int partitionId,
NodeEngine nodeEngine,
AbstractCacheService cacheService) |
Modifier and Type | Method and Description |
---|---|
protected CacheEntryProcessorEntry |
createCacheEntryProcessorEntry(Data key,
CacheRecord record,
long now,
int completionId) |
protected MaxSizeChecker |
createCacheMaxSizeChecker(int size,
EvictionConfig.MaxSizePolicy maxSizePolicy) |
protected CacheRecordFactory |
createCacheRecordFactory() |
protected CacheRecord |
createRecord(Object value,
long creationTime,
long expiryTime) |
protected CacheRecordHashMap |
createRecordCacheMap() |
protected Object |
dataToValue(Data data) |
CacheRecord |
merge(CacheEntryView<Data,Data> cacheEntryView,
CacheMergePolicy mergePolicy)
Merges given record (inside given
CacheEntryView ) with the existing record as given CacheMergePolicy . |
protected Data |
recordToData(CacheRecord record) |
protected Object |
recordToValue(CacheRecord record) |
protected Data |
toHeapData(Object obj) |
protected Data |
valueToData(Object value) |
accessRecord, clear, close, closeListeners, compare, contains, createEvictionChecker, createEvictionPolicyEvaluator, createEvictionStrategy, createRecord, createRecord, createRecord, createRecord, createRecordWithExpiry, createRecordWithExpiry, createRecordWithExpiry, createRecordWithExpiry, deleteAllCacheEntry, deleteCacheEntry, deleteRecord, deleteRecord, deleteRecord, destroy, doPutRecord, doPutRecord, doRemoveRecord, doRemoveRecord, evictIfRequired, get, getAll, getAndPut, getAndRemove, getAndRemove, getAndReplace, getCacheStats, getConfig, getExpiryPolicy, getName, getReadOnlyRecords, getRecord, init, invalidateAllEntries, invalidateAllEntries, invalidateEntry, invalidateEntry, invoke, isEventsEnabled, isEvictionEnabled, isInvalidationEnabled, isReadThrough, isStatisticsEnabled, isWanReplicationEnabled, isWriteThrough, iterator, loadAll, loadAllCacheEntry, onClear, onCreateRecordError, onDeleteRecord, onDeleteRecordError, onDestroy, onEvict, onGet, onGetError, onProcessExpiredEntry, onPut, onPutError, onPutIfAbsent, onPutIfAbsentError, onRecordAccess, onRemove, onRemoveError, onReplace, onReplaceError, onUpdateRecord, onUpdateRecordError, processExpiredEntry, processExpiredEntry, processExpiredEntry, processExpiredEntry, processExpiredEntry, publishBatchedEvents, publishEvent, put, put, put, putIfAbsent, putIfAbsent, putRecord, readThroughCache, readThroughRecord, remove, remove, remove, remove, removeAll, removeRecord, replace, replace, size, toData, toEventData, toStorageValue, toValue, updateAccessDuration, updateGetAndPutStat, updateRecord, updateRecordValue, updateRecordWithExpiry, updateRecordWithExpiry, updateRecordWithExpiry, updateRecordWithExpiry, updateRecordWithExpiry, updateRecordWithExpiry, updateReplaceStat, writeThroughCache
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clear, close, contains, destroy, evictIfRequired, get, getAll, getAndPut, getAndRemove, getAndReplace, getCacheStats, getConfig, getName, getReadOnlyRecords, getRecord, init, invoke, isWanReplicationEnabled, iterator, loadAll, put, putIfAbsent, putRecord, remove, remove, removeAll, removeRecord, replace, replace, size
protected SerializationService serializationService
protected CacheRecordFactory cacheRecordFactory
public CacheRecordStore(String name, int partitionId, NodeEngine nodeEngine, AbstractCacheService cacheService)
protected MaxSizeChecker createCacheMaxSizeChecker(int size, EvictionConfig.MaxSizePolicy maxSizePolicy)
createCacheMaxSizeChecker
in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>
protected CacheRecordHashMap createRecordCacheMap()
createRecordCacheMap
in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>
protected CacheEntryProcessorEntry createCacheEntryProcessorEntry(Data key, CacheRecord record, long now, int completionId)
createCacheEntryProcessorEntry
in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>
protected CacheRecordFactory createCacheRecordFactory()
protected CacheRecord createRecord(Object value, long creationTime, long expiryTime)
createRecord
in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>
protected Data valueToData(Object value)
valueToData
in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>
protected Object dataToValue(Data data)
dataToValue
in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>
protected Object recordToValue(CacheRecord record)
recordToValue
in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>
protected Data recordToData(CacheRecord record)
recordToData
in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>
protected Data toHeapData(Object obj)
toHeapData
in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>
public CacheRecord merge(CacheEntryView<Data,Data> cacheEntryView, CacheMergePolicy mergePolicy)
SplitBrainAwareCacheRecordStore
CacheEntryView
) with the existing record as given CacheMergePolicy
.merge
in interface SplitBrainAwareCacheRecordStore
cacheEntryView
- the CacheEntryView
instance that wraps key/value for merging and existing entrymergePolicy
- the CacheMergePolicy
instance for handling merge policyCacheRecord
if merge is applied, otherwise null
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.