com.hazelcast.cache.impl
Class CacheRecordStore

java.lang.Object
  extended by com.hazelcast.cache.impl.AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>
      extended by com.hazelcast.cache.impl.CacheRecordStore
All Implemented Interfaces:
ICacheRecordStore

public class CacheRecordStore
extends AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>

On-Heap implementation of the 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.

See Also:
CachePartitionSegment, CacheService, AbstractCacheOperation

Nested Class Summary
 
Nested classes/interfaces inherited from class com.hazelcast.cache.impl.AbstractCacheRecordStore
AbstractCacheRecordStore.MaxSizeEvictionChecker
 
Field Summary
protected  CacheRecordFactory cacheRecordFactory
           
protected  SerializationService serializationService
           
 
Fields inherited from class com.hazelcast.cache.impl.AbstractCacheRecordStore
batchEvent, cacheConfig, cacheLoader, cacheService, cacheWriter, DEFAULT_INITIAL_CAPACITY, defaultExpiryPolicy, evictionChecker, evictionConfig, evictionPolicyEvaluator, evictionStrategy, hasExpiringEntry, isEventBatchingEnabled, isEventsEnabled, maxSizeChecker, name, nodeEngine, partitionCount, partitionId, records, statistics
 
Fields inherited from interface com.hazelcast.cache.impl.ICacheRecordStore
ONE_HUNDRED_PERCENT
 
Constructor Summary
CacheRecordStore(String name, int partitionId, NodeEngine nodeEngine, AbstractCacheService cacheService)
           
 
Method Summary
protected  CacheEntryProcessorEntry createCacheEntryProcessorEntry(Data key, CacheRecord record, long now, int completionId)
           
protected  CacheMaxSizeChecker createCacheMaxSizeChecker(int size, CacheEvictionConfig.CacheMaxSizePolicy maxSizePolicy)
           
protected  CacheRecordFactory createCacheRecordFactory()
           
protected
<T> CacheRecord
createRecord(T value, long creationTime, long expiryTime)
           
protected  CacheRecordHashMap createRecordCacheMap()
           
protected  CacheRecord dataToRecord(Data data)
           
protected
<T> T
dataToValue(Data data)
           
protected  Data recordToData(CacheRecord record)
           
protected
<T> T
recordToValue(CacheRecord record)
           
protected  Data toHeapData(Object obj)
           
protected
<T> Data
valueToData(T value)
           
protected
<T> CacheRecord
valueToRecord(T value)
           
 
Methods inherited from class com.hazelcast.cache.impl.AbstractCacheRecordStore
accessRecord, clear, closeListeners, closeResources, compare, contains, createEvictionChecker, createRecord, createRecord, createRecord, createRecordWithExpiry, creatEvictionPolicyEvaluator, creatEvictionStrategy, deleteAllCacheEntry, deleteCacheEntry, deleteRecord, destroy, evictIfRequired, expiryPolicyToTTL, get, getAll, getAndPut, getAndRemove, getAndReplace, getCacheStats, getConfig, getExpiryPolicy, getName, getReadOnlyRecords, getRecord, invoke, isEvictionEnabled, isEvictionRequired, isReadThrough, isStatisticsEnabled, isWriteThrough, iterator, loadAll, loadAllCacheEntry, onDeleteRecord, onDeleteRecordError, onGet, onGetError, onPut, onPutError, onPutIfAbsent, onPutIfAbsentError, onRecordAccess, onRemove, onRemoveError, onReplace, onReplaceError, onUpdateRecord, onUpdateRecordError, processExpiredEntry, processExpiredEntry, publishBatchedEvents, publishEvent, put, put, put, putIfAbsent, putIfAbsent, putRecord, readThroughCache, readThroughRecord, remove, remove, removeAll, removeRecord, replace, replace, setRecord, size, toData, toEventData, toRecord, toValue, ttlToExpirePolicy, updateAccessDuration, updateGetAndPutStat, updateHasExpiringEntry, updateRecord, updateRecordWithExpiry, updateReplaceStat, writeThroughCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serializationService

protected SerializationService serializationService

cacheRecordFactory

protected CacheRecordFactory cacheRecordFactory
Constructor Detail

CacheRecordStore

public CacheRecordStore(String name,
                        int partitionId,
                        NodeEngine nodeEngine,
                        AbstractCacheService cacheService)
Method Detail

createCacheMaxSizeChecker

protected CacheMaxSizeChecker createCacheMaxSizeChecker(int size,
                                                        CacheEvictionConfig.CacheMaxSizePolicy maxSizePolicy)
Overrides:
createCacheMaxSizeChecker in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>

createRecordCacheMap

protected CacheRecordHashMap createRecordCacheMap()
Specified by:
createRecordCacheMap in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>

createCacheEntryProcessorEntry

protected CacheEntryProcessorEntry createCacheEntryProcessorEntry(Data key,
                                                                  CacheRecord record,
                                                                  long now,
                                                                  int completionId)
Specified by:
createCacheEntryProcessorEntry in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>

createCacheRecordFactory

protected CacheRecordFactory createCacheRecordFactory()

createRecord

protected <T> CacheRecord createRecord(T value,
                                       long creationTime,
                                       long expiryTime)
Specified by:
createRecord in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>

valueToData

protected <T> Data valueToData(T value)
Specified by:
valueToData in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>

dataToValue

protected <T> T dataToValue(Data data)
Specified by:
dataToValue in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>

valueToRecord

protected <T> CacheRecord valueToRecord(T value)
Specified by:
valueToRecord in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>

recordToValue

protected <T> T recordToValue(CacheRecord record)
Specified by:
recordToValue in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>

recordToData

protected Data recordToData(CacheRecord record)
Specified by:
recordToData in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>

dataToRecord

protected CacheRecord dataToRecord(Data data)
Specified by:
dataToRecord in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>

toHeapData

protected Data toHeapData(Object obj)
Specified by:
toHeapData in class AbstractCacheRecordStore<CacheRecord,CacheRecordHashMap>


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.