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,
AbstractCacheOperationAbstractCacheRecordStore.MaxSizeEvictionChecker| Modifier and Type | Field and Description |
|---|---|
protected CacheRecordFactory |
cacheRecordFactory |
protected SerializationService |
serializationService |
batchEvent, cacheConfig, cacheContext, cacheLoader, cacheService, cacheWriter, DEFAULT_INITIAL_CAPACITY, defaultExpiryPolicy, disablePerEntryInvalidationEvents, eventsBatchingEnabled, eventsEnabled, evictionChecker, evictionConfig, evictionPolicyEvaluator, evictionStrategy, maxSizeChecker, name, nodeEngine, partitionCount, partitionId, primary, records, SOURCE_NOT_AVAILABLE, statistics, wanReplicationEnabledUNIT_PERCENTAGENO_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)
Creates an instance for checking if the maximum cache size has been reached.
|
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, fetchEntries, fetchKeys, get, getAll, getAndPut, getAndRemove, getAndRemove, getAndReplace, getCacheStats, getConfig, getExpiryPolicy, getName, getReadOnlyRecords, getRecord, init, instrument, invalidateAllEntries, invalidateAllEntries, invalidateEntry, invalidateEntry, invoke, isEventsEnabled, isEvictionEnabled, isInvalidationEnabled, isReadThrough, isStatisticsEnabled, isWanReplicationEnabled, isWriteThrough, loadAll, loadAllCacheEntry, 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, writeThroughCacheclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclear, close, contains, destroy, evictIfRequired, fetchEntries, fetchKeys, get, getAll, getAndPut, getAndRemove, getAndReplace, getCacheStats, getConfig, getName, getReadOnlyRecords, getRecord, init, invoke, isWanReplicationEnabled, loadAll, put, putIfAbsent, putRecord, remove, remove, removeAll, removeRecord, replace, replace, sizeprotected SerializationService serializationService
protected CacheRecordFactory cacheRecordFactory
public CacheRecordStore(String name, int partitionId, NodeEngine nodeEngine, AbstractCacheService cacheService)
protected MaxSizeChecker createCacheMaxSizeChecker(int size, EvictionConfig.MaxSizePolicy maxSizePolicy)
EvictionConfig.MaxSizePolicy.ENTRY_COUNT policy. Throws an IllegalArgumentException if other maxSizePolicy is
used.createCacheMaxSizeChecker in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>size - the maximum number of entriesmaxSizePolicy - the way in which the size is interpreted, only the EvictionConfig.MaxSizePolicy.ENTRY_COUNT
maxSizePolicy is supported.IllegalArgumentException - if the policy is not EvictionConfig.MaxSizePolicy.ENTRY_COUNT or if the maxSizePolicy
is nullprotected 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)
SplitBrainAwareCacheRecordStoreCacheEntryView) with the existing record as given CacheMergePolicy.merge in interface SplitBrainAwareCacheRecordStorecacheEntryView - the CacheEntryView instance that wraps key/value for merging and existing entrymergePolicy - the CacheMergePolicy instance for handling merge policyCacheRecord if merge is applied, otherwise nullCopyright © 2017 Hazelcast, Inc.. All Rights Reserved.