public class GridCacheConfiguration extends Object
GridConfiguration.getCacheConfiguration() method. It defines all configuration
parameters required to start a cache within grid instance. You can have multiple caches
configured with different names within one grid.
Cache configuration is set on GridConfiguration.setCacheConfiguration(GridCacheConfiguration...) method. This adapter is a simple bean and
can be configured from Spring XML files (or other DI frameworks).
Note that absolutely all configuration properties are optional, so users should only change what they need.
| Modifier and Type | Field and Description |
|---|---|
static int |
DFLT_ATOMIC_SEQUENCE_RESERVE_SIZE
Default atomic sequence reservation size.
|
static int |
DFLT_BACKUPS
Default number of backups.
|
static GridCacheAtomicityMode |
DFLT_CACHE_ATOMICITY_MODE
Default atomicity mode.
|
static GridCacheMode |
DFLT_CACHE_MODE
Default caching mode.
|
static int |
DFLT_CACHE_SIZE
Default cache size to use with eviction policy.
|
static int |
DFLT_CONT_QUERY_MAX_BUF_SIZE
Deprecated.
|
static int |
DFLT_CONT_QUERY_QUEUE_SIZE
Deprecated.
|
static long |
DFLT_DGC_FREQUENCY
Default distributed garbage collection frequency.
|
static boolean |
DFLT_DGC_REMOVE_LOCKS
Default value for whether DGC should remove long running locks, or only report them.
|
static long |
DFLT_DGC_SUSPECT_LOCK_TIMEOUT
Default timeout for lock not to be considered as suspicious.
|
static GridCacheDistributionMode |
DFLT_DISTRIBUTION_MODE
Default value for cache distribution mode.
|
static boolean |
DFLT_EAGER_TTL
Default value for eager ttl flag.
|
static int |
DFLT_EVICT_KEY_BUFFER_SIZE
Default eviction key buffer size for batching synchronized evicts.
|
static boolean |
DFLT_EVICT_NEAR_SYNCHRONIZED
Default near nodes eviction synchronized flag.
|
static boolean |
DFLT_EVICT_SYNCHRONIZED
Default eviction synchronized flag.
|
static int |
DFLT_EVICT_SYNCHRONIZED_CONCURRENCY_LEVEL
Default synchronous eviction concurrency level.
|
static long |
DFLT_EVICT_SYNCHRONIZED_TIMEOUT
Default synchronous eviction timeout in milliseconds.
|
static boolean |
DFLT_INVALIDATE
Default value for 'invalidate' flag that indicates if this is invalidation-based cache.
|
static long |
DFLT_LOCK_TIMEOUT
Default lock timeout.
|
static int |
DFLT_MAX_CONCURRENT_ASYNC_OPS
Default value for 'maxConcurrentAsyncOps'.
|
static float |
DFLT_MAX_EVICTION_OVERFLOW_RATIO
Default maximum eviction queue ratio.
|
static int |
DFLT_MAX_QUERY_ITERATOR_CNT
Default maximum number of query iterators that can be stored.
|
static GridCacheMemoryMode |
DFLT_MEMORY_MODE
Default memory mode.
|
static int |
DFLT_NEAR_START_SIZE
Initial default near cache size.
|
static long |
DFLT_OFFHEAP_MEMORY
Default off-heap storage size is
-1 which means that off-heap storage is disabled. |
static int |
DFLT_PESSIMISTIC_TX_LOG_LINGER
Default size of pessimistic transactions log.
|
static int |
DFLT_PRELOAD_BATCH_SIZE
Default preload batch size in bytes.
|
static GridCachePreloadMode |
DFLT_PRELOAD_MODE
Default preload mode for distributed cache.
|
static int |
DFLT_PRELOAD_THREAD_POOL_SIZE
Default size of preload thread pool.
|
static long |
DFLT_PRELOAD_THROTTLE
Time in milliseconds to wait between preload messages to avoid overloading CPU.
|
static long |
DFLT_PRELOAD_TIMEOUT
Default preload timeout (ms).
|
static boolean |
DFLT_QUERY_INDEX_ENABLED
Default value for 'swapEnabled' flag.
|
static long |
DFLT_QUERY_TIMEOUT
Default query timeout.
|
static int |
DFLT_START_SIZE
Initial default cache size.
|
static boolean |
DFLT_STORE_VALUE_BYTES
Default value for 'storeValueBytes' flag indicating if value bytes should be stored.
|
static boolean |
DFLT_SWAP_ENABLED
Default value for 'swapEnabled' flag.
|
static long |
DFLT_TIME_TO_LIVE
Default time to live.
|
static long |
DFLT_TRANSACTION_TIMEOUT
Default transaction timeout.
|
static boolean |
DFLT_TX_BATCH_UPDATE
Default value for 'txBatchUpdate' flag.
|
static GridCacheTxConcurrency |
DFLT_TX_CONCURRENCY
Default concurrency mode.
|
static GridCacheTxIsolation |
DFLT_TX_ISOLATION
Default transaction isolation level.
|
static boolean |
DFLT_TX_SERIALIZABLE_ENABLED
Default value for 'txSerializableEnabled' flag.
|
static int |
DFLT_WRITE_BEHIND_BATCH_SIZE
Default batch size for write-behind cache store.
|
static int |
DFLT_WRITE_BEHIND_CRITICAL_SIZE
Default critical size used when flush size is not specified.
|
static boolean |
DFLT_WRITE_BEHIND_ENABLED
Default value for 'writeBehindEnabled' flag.
|
static long |
DFLT_WRITE_BEHIND_FLUSH_FREQUENCY
Default flush frequency for write-behind cache store in milliseconds.
|
static int |
DFLT_WRITE_BEHIND_FLUSH_SIZE
Default flush size for write-behind cache store.
|
static int |
DFLT_WRITE_FROM_BEHIND_FLUSH_THREAD_CNT
Default count of flush threads for write-behind cache store.
|
static String |
DGC_TRACE_LOGGER_NAME
DGC tracing logger name.
|
| Constructor and Description |
|---|
GridCacheConfiguration()
Empty constructor (all values are initialized to their defaults).
|
GridCacheConfiguration(GridCacheConfiguration cc)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
GridCacheAffinityFunction |
getAffinity()
Gets key topology resolver to provide mapping from keys to nodes.
|
GridCacheAffinityKeyMapper |
getAffinityMapper()
Affinity key mapper used to provide custom affinity key for any given key.
|
GridCacheAtomicityMode |
getAtomicityMode()
Gets cache atomicity mode.
|
int |
getAtomicSequenceReserveSize()
Gets default number of sequence values reserved for
GridCacheAtomicSequence instances. |
GridCacheAtomicWriteOrderMode |
getAtomicWriteOrderMode()
Gets cache write ordering mode.
|
int |
getBackups()
Gets number of nodes used to back up single partition for
GridCacheMode.PARTITIONED cache. |
GridCacheMode |
getCacheMode()
Gets caching mode to use.
|
GridCacheCloner |
getCloner()
Cloner to be used for cloning values that are returned to user only if
GridCacheFlag.CLONE
is set on GridCacheProjection. |
int |
getContinuousQueryMaximumBufferSize()
Deprecated.
Ignored in current version.
|
int |
getContinuousQueryQueueSize()
Deprecated.
Ignored in current version.
|
long |
getDefaultLockTimeout()
Gets default lock acquisition timeout.
|
long |
getDefaultQueryTimeout()
Gets default query timeout.
|
long |
getDefaultTimeToLive()
Gets time to live for all objects in cache.
|
GridCacheTxConcurrency |
getDefaultTxConcurrency()
Default cache transaction concurrency to use when one is not explicitly
specified.
|
GridCacheTxIsolation |
getDefaultTxIsolation()
Default cache transaction isolation to use when one is not explicitly
specified.
|
long |
getDefaultTxTimeout()
Gets default transaction timeout.
|
long |
getDgcFrequency()
Gets frequency at which distributed garbage collector will
check other nodes if there are any zombie locks left over.
|
long |
getDgcSuspectLockTimeout()
Gets timeout after which locks are considered to be suspicious.
|
GridCacheDistributionMode |
getDistributionMode()
Gets cache distribution mode.
|
GridDrReceiverCacheConfiguration |
getDrReceiverConfiguration()
Gets data center replication receive configuration.
|
GridDrSenderCacheConfiguration |
getDrSenderConfiguration()
Gets data center replication send configuration.
|
<K,V> GridCacheEvictionFilter<K,V> |
getEvictionFilter()
Gets eviction filter to specify which entries should not be evicted
(except explicit evict by calling
GridCacheEntry.evict()). |
<K,V> GridCacheEvictionPolicy<K,V> |
getEvictionPolicy()
Gets cache eviction policy.
|
float |
getEvictMaxOverflowRatio()
This value denotes the maximum size of eviction queue in percents of cache
size in case of distributed cache (replicated and partitioned) and using
synchronized eviction (that is if
isEvictSynchronized() returns
true). |
int |
getEvictSynchronizedConcurrencyLevel()
Gets concurrency level for synchronized evictions.
|
int |
getEvictSynchronizedKeyBufferSize()
Gets size of the key buffer for synchronized evictions.
|
long |
getEvictSynchronizedTimeout()
Gets timeout for synchronized evictions.
|
String |
getIndexingSpiName()
Gets name of the SPI to use for indexing.
|
<K,V> GridCacheInterceptor<K,V> |
getInterceptor()
Gets cache interceptor.
|
int |
getMaxConcurrentAsyncOperations()
Gets maximum number of allowed concurrent asynchronous operations.
|
int |
getMaximumQueryIteratorCount()
Gets maximum number of query iterators that can be stored.
|
GridCacheMemoryMode |
getMemoryMode()
Gets memory mode for cache.
|
String |
getName()
Cache name.
|
<K,V> GridCacheEvictionPolicy<K,V> |
getNearEvictionPolicy()
Gets eviction policy for
near cache which is different from the one used for
partitioned cache. |
int |
getNearStartSize()
Gets initial cache size for near cache which will be used to pre-create internal
hash table after start.
|
long |
getOffHeapMaxMemory()
Gets maximum amount of memory available to off-heap storage.
|
int |
getPessimisticTxLogLinger()
Gets delay, in milliseconds, after which pessimistic recovery entries will be cleaned up for failed node.
|
int |
getPessimisticTxLogSize()
Gets size of pessimistic transactions log stored on node in order to recover transaction commit if originating
node has left grid before it has sent all messages to transaction nodes.
|
int |
getPreloadBatchSize()
Gets size (in number bytes) to be loaded within a single preload message.
|
GridCachePreloadMode |
getPreloadMode()
Gets preload mode for distributed cache.
|
int |
getPreloadOrder()
Gets cache preload order.
|
long |
getPreloadPartitionedDelay()
Gets delay in milliseconds upon a node joining or leaving topology (or crash) after which preloading
should be started automatically.
|
int |
getPreloadThreadPoolSize()
Gets size of preloading thread pool.
|
long |
getPreloadThrottle()
Time in milliseconds to wait between preload messages to avoid overloading of CPU or network.
|
long |
getPreloadTimeout()
Gets preload timeout (ms).
|
double |
getRefreshAheadRatio()
Gets refresh-ahead ratio.
|
int |
getStartSize()
Gets initial cache size which will be used to pre-create internal
hash table after start.
|
<K,V> GridCacheStore<K,V> |
getStore()
Gets underlying persistent storage for read-through and write-through operations.
|
String |
getTransactionManagerLookupClassName()
Gets class name of transaction manager finder for integration for JEE app servers.
|
int |
getWriteBehindBatchSize()
Maximum batch size for write-behind cache store operations.
|
long |
getWriteBehindFlushFrequency()
Frequency with which write-behind cache is flushed to the cache store in milliseconds.
|
int |
getWriteBehindFlushSize()
Maximum size of the write-behind cache.
|
int |
getWriteBehindFlushThreadCount()
Number of threads that will perform cache flushing.
|
GridCacheWriteSynchronizationMode |
getWriteSynchronizationMode()
Gets write synchronization mode.
|
boolean |
isBatchUpdateOnCommit()
If
true, then all transactional values will be written to persistent
storage at GridCacheTx.commit() phase. |
boolean |
isDgcRemoveLocks()
Gets system-wide flag indicating whether DGC manager should remove locks in question or only
report them.
|
boolean |
isEagerTtl()
Gets flag indicating whether expired cache entries will be eagerly removed from cache.
|
boolean |
isEvictNearSynchronized()
Gets flag indicating whether eviction on primary node is synchronized with
near nodes where entry is kept.
|
boolean |
isEvictSynchronized()
Gets flag indicating whether eviction is synchronized between primary and
backup nodes on partitioned cache.
|
boolean |
isInvalidate()
Invalidation flag.
|
boolean |
isQueryIndexEnabled()
Flag indicating whether GridGain should attempt to index value and/or key instances
stored in cache.
|
boolean |
isStoreValueBytes()
Flag indicating if cached values should be additionally stored in serialized form.
|
boolean |
isSwapEnabled()
Flag indicating whether GridGain should use swap storage by default.
|
boolean |
isTxSerializableEnabled()
Gets flag to enable/disable
GridCacheTxIsolation.SERIALIZABLE isolation
level for cache transactions. |
boolean |
isWriteBehindEnabled()
Flag indicating whether GridGain should use write-behind behaviour for the cache store.
|
void |
setAffinity(GridCacheAffinityFunction aff)
Sets affinity for cache keys.
|
void |
setAffinityMapper(GridCacheAffinityKeyMapper affMapper)
Sets custom affinity mapper.
|
void |
setAtomicityMode(GridCacheAtomicityMode atomicityMode)
Sets cache atomicity mode.
|
void |
setAtomicSequenceReserveSize(int seqReserveSize)
Sets default number of sequence values reserved for
GridCacheAtomicSequence instances. |
void |
setAtomicWriteOrderMode(GridCacheAtomicWriteOrderMode atomicWriteOrderMode)
Sets cache write ordering mode.
|
void |
setBackups(int backups)
Sets number of nodes used to back up single partition for
GridCacheMode.PARTITIONED cache. |
void |
setBatchUpdateOnCommit(boolean txBatchUpdate)
Sets flag indicating if persistent store should be updated after every cache operation or once at commit time.
|
void |
setCacheMode(GridCacheMode cacheMode)
Sets caching mode.
|
void |
setCloner(GridCacheCloner cloner)
Sets cloner to be used if
GridCacheFlag.CLONE flag is set on projection. |
void |
setContinuousQueryMaximumBufferSize(int contQryMaxBufSize)
Deprecated.
Ignored in current version.
|
void |
setContinuousQueryQueueSize(int contQryQueueSize)
Deprecated.
Ignored in current version.
|
void |
setDefaultLockTimeout(long dfltLockTimeout)
Sets default lock timeout in milliseconds.
|
void |
setDefaultQueryTimeout(long dfltQryTimeout)
Sets default query timeout,
0 for never. |
void |
setDefaultTimeToLive(long ttl)
Sets time to live for all objects in cache.
|
void |
setDefaultTxConcurrency(GridCacheTxConcurrency dfltConcurrency)
Sets default transaction concurrency.
|
void |
setDefaultTxIsolation(GridCacheTxIsolation dfltIsolation)
Sets default transaction isolation.
|
void |
setDefaultTxTimeout(long dfltTxTimeout)
Sets default transaction timeout in milliseconds.
|
void |
setDgcFrequency(long dgcFreq)
Sets frequency in milliseconds for internal distributed garbage collector.
|
void |
setDgcRemoveLocks(boolean dgcRmvLocks)
Sets DGC remove locks flag.
|
void |
setDgcSuspectLockTimeout(long dgcSuspectLockTimeout)
Sets suspect lock timeout in milliseconds for internal distributed garbage collector.
|
void |
setDistributionMode(GridCacheDistributionMode distro)
Sets cache distribution mode.
|
void |
setDrReceiverConfiguration(GridDrReceiverCacheConfiguration drRcvCacheCfg)
Sets data center replication receive configuration.
|
void |
setDrSenderConfiguration(GridDrSenderCacheConfiguration drSndCacheCfg)
Sets data center replication send configuration.
|
void |
setEagerTtl(boolean eagerTtl)
Sets eager ttl flag.
|
<K,V> void |
setEvictionFilter(GridCacheEvictionFilter<K,V> evictFilter)
Sets eviction filter.
|
void |
setEvictionPolicy(GridCacheEvictionPolicy evictPlc)
Sets cache eviction policy.
|
void |
setEvictMaxOverflowRatio(float evictMaxOverflowRatio)
Sets maximum eviction overflow ratio.
|
void |
setEvictNearSynchronized(boolean evictNearSync)
Sets flag indicating whether eviction is synchronized with near nodes.
|
void |
setEvictSynchronized(boolean evictSync)
Sets flag indicating whether eviction is synchronized with backup nodes (or the rest of the nodes for replicated
cache).
|
void |
setEvictSynchronizedConcurrencyLevel(int evictSyncConcurrencyLvl)
Sets concurrency level for synchronized evictions.
|
void |
setEvictSynchronizedKeyBufferSize(int evictKeyBufSize)
Sets eviction key buffer size.
|
void |
setEvictSynchronizedTimeout(long evictSyncTimeout)
Sets timeout for synchronized evictions.
|
void |
setIndexingSpiName(String indexingSpiName)
Sets name of the SPI to use for indexing.
|
<K,V> void |
setInterceptor(GridCacheInterceptor<K,V> interceptor)
Sets cache interceptor.
|
void |
setInvalidate(boolean invalidate)
Sets invalidation flag for near cache entries in this transaction.
|
void |
setMaxConcurrentAsyncOperations(int maxConcurrentAsyncOps)
Sets maximum number of concurrent asynchronous operations.
|
void |
setMaximumQueryIteratorCount(int maxQryIterCnt)
Sets maximum number of query iterators that can be stored.
|
void |
setMemoryMode(GridCacheMemoryMode memMode)
Sets memory mode for cache.
|
void |
setName(String name)
Sets cache name.
|
void |
setNearEvictionPolicy(GridCacheEvictionPolicy nearEvictPlc)
Sets eviction policy for near cache.
|
void |
setNearStartSize(int nearStartSize)
Start size for near cache.
|
void |
setOffHeapMaxMemory(long offHeapMaxMem)
Sets maximum amount of memory available to off-heap storage.
|
void |
setPessimisticTxLogLinger(int pessimisticTxLogLinger)
Sets cleanup delay for pessimistic transaction recovery log for failed node, in milliseconds.
|
void |
setPessimisticTxLogSize(int pessimisticTxLogSize)
Sets pessimistic transactions log size.
|
void |
setPreloadBatchSize(int preloadBatchSize)
Sets preload batch size.
|
void |
setPreloadMode(GridCachePreloadMode preloadMode)
Sets cache preload mode.
|
void |
setPreloadOrder(int preloadOrder)
Sets cache preload order.
|
void |
setPreloadPartitionedDelay(long preloadDelay)
Sets preload delay (see
getPreloadPartitionedDelay() for more information). |
void |
setPreloadThreadPoolSize(int preloadPoolSize)
Sets size of preloading thread pool.
|
void |
setPreloadThrottle(long preloadThrottle)
Time in milliseconds to wait between preload messages to avoid overloading of CPU or network.
|
void |
setPreloadTimeout(long preloadTimeout)
Sets preload timeout (ms).
|
void |
setQueryIndexEnabled(boolean qryIdxEnabled)
Flag indicating whether query indexing is enabled or not.
|
void |
setRefreshAheadRatio(double refreshAheadRatio)
Sets refresh-ahead ratio for cache entries.
|
void |
setStartSize(int startSize)
Initial size for internal hash map.
|
<K,V> void |
setStore(GridCacheStore<K,V> store)
Sets persistent storage for cache data.
|
void |
setStoreValueBytes(boolean storeValBytes)
Flag indicating if cached values should be additionally stored in serialized form.
|
void |
setSwapEnabled(boolean swapEnabled)
Flag indicating whether swap storage is enabled or not.
|
void |
setTransactionManagerLookupClassName(String tmLookupClsName)
Sets look up mechanism for available
TransactionManager implementation, if any. |
void |
setTxSerializableEnabled(boolean txSerEnabled)
Enables/disables serializable cache transactions.
|
void |
setWriteBehindBatchSize(int writeBehindBatchSize)
Sets maximum batch size for write-behind cache.
|
void |
setWriteBehindEnabled(boolean writeBehindEnabled)
Sets flag indicating whether write-behind is enabled.
|
void |
setWriteBehindFlushFrequency(long writeBehindFlushFreq)
Sets write-behind flush frequency.
|
void |
setWriteBehindFlushSize(int writeBehindFlushSize)
Sets write-behind flush size.
|
void |
setWriteBehindFlushThreadCount(int writeBehindFlushThreadCnt)
Sets flush thread count for write-behind cache.
|
void |
setWriteSynchronizationMode(GridCacheWriteSynchronizationMode writeSync)
Sets write synchronization mode.
|
String |
toString() |
public static final String DGC_TRACE_LOGGER_NAME
public static final int DFLT_ATOMIC_SEQUENCE_RESERVE_SIZE
public static final int DFLT_PRELOAD_THREAD_POOL_SIZE
public static final long DFLT_PRELOAD_TIMEOUT
public static final long DFLT_PRELOAD_THROTTLE
public static final long DFLT_TIME_TO_LIVE
public static final int DFLT_BACKUPS
public static final GridCacheMode DFLT_CACHE_MODE
public static final GridCacheAtomicityMode DFLT_CACHE_ATOMICITY_MODE
public static final GridCacheDistributionMode DFLT_DISTRIBUTION_MODE
public static final long DFLT_TRANSACTION_TIMEOUT
public static final long DFLT_QUERY_TIMEOUT
public static final long DFLT_LOCK_TIMEOUT
public static final GridCacheTxConcurrency DFLT_TX_CONCURRENCY
public static final GridCacheTxIsolation DFLT_TX_ISOLATION
public static final int DFLT_START_SIZE
public static final int DFLT_CACHE_SIZE
public static final int DFLT_NEAR_START_SIZE
public static final boolean DFLT_TX_SERIALIZABLE_ENABLED
public static final boolean DFLT_TX_BATCH_UPDATE
public static final boolean DFLT_INVALIDATE
public static final boolean DFLT_STORE_VALUE_BYTES
public static final int DFLT_PESSIMISTIC_TX_LOG_LINGER
public static final GridCachePreloadMode DFLT_PRELOAD_MODE
public static final int DFLT_PRELOAD_BATCH_SIZE
public static final long DFLT_DGC_FREQUENCY
public static final long DFLT_DGC_SUSPECT_LOCK_TIMEOUT
public static final boolean DFLT_DGC_REMOVE_LOCKS
public static final float DFLT_MAX_EVICTION_OVERFLOW_RATIO
public static final boolean DFLT_EVICT_SYNCHRONIZED
public static final boolean DFLT_EVICT_NEAR_SYNCHRONIZED
public static final int DFLT_EVICT_KEY_BUFFER_SIZE
public static final long DFLT_EVICT_SYNCHRONIZED_TIMEOUT
public static final int DFLT_EVICT_SYNCHRONIZED_CONCURRENCY_LEVEL
public static final boolean DFLT_EAGER_TTL
public static final long DFLT_OFFHEAP_MEMORY
-1 which means that off-heap storage is disabled.public static final boolean DFLT_SWAP_ENABLED
public static final int DFLT_MAX_CONCURRENT_ASYNC_OPS
public static final boolean DFLT_QUERY_INDEX_ENABLED
public static final boolean DFLT_WRITE_BEHIND_ENABLED
public static final int DFLT_WRITE_BEHIND_FLUSH_SIZE
public static final int DFLT_WRITE_BEHIND_CRITICAL_SIZE
public static final long DFLT_WRITE_BEHIND_FLUSH_FREQUENCY
public static final int DFLT_WRITE_FROM_BEHIND_FLUSH_THREAD_CNT
public static final int DFLT_WRITE_BEHIND_BATCH_SIZE
public static final int DFLT_MAX_QUERY_ITERATOR_CNT
@Deprecated public static final int DFLT_CONT_QUERY_QUEUE_SIZE
public static final GridCacheMemoryMode DFLT_MEMORY_MODE
@Deprecated public static final int DFLT_CONT_QUERY_MAX_BUF_SIZE
public GridCacheConfiguration()
public GridCacheConfiguration(GridCacheConfiguration cc)
cc - Configuration to copy.public String getName()
null, then this will be considered a default
cache which can be accessed via Grid.cache(null) method. Otherwise, if name
is provided, the cache will be accessed via Grid.cache(String) method.public void setName(String name)
name - Cache name. May be null, but may not be empty string.public long getDefaultTimeToLive()
0 which means that objects never expire.public void setDefaultTimeToLive(long ttl)
ttl - Time to live for all objects in cache.@Nullable public <K,V> GridCacheEvictionPolicy<K,V> getEvictionPolicy()
null
which means that evictions are disabled for cache.null if evictions should be disabled.public void setEvictionPolicy(@Nullable GridCacheEvictionPolicy evictPlc)
evictPlc - Cache expiration policy.public GridCacheDistributionMode getDistributionMode()
getCacheMode() is set to GridCacheMode.PARTITIONED or GridCacheMode.REPLICATED mode.
If not set, default value is DFLT_DISTRIBUTION_MODE.
public void setDistributionMode(GridCacheDistributionMode distro)
distro - Distribution mode.public GridCacheWriteSynchronizationMode getWriteSynchronizationMode()
public void setWriteSynchronizationMode(GridCacheWriteSynchronizationMode writeSync)
writeSync - Write synchronization mode.@Nullable public <K,V> GridCacheEvictionPolicy<K,V> getNearEvictionPolicy()
near cache which is different from the one used for
partitioned cache. By default, returns null
which means that evictions are disabled for near cache.null if evictions should be disabled.public void setNearEvictionPolicy(@Nullable GridCacheEvictionPolicy nearEvictPlc)
GridCacheMode.PARTITIONED caching
mode.nearEvictPlc - Eviction policy for near cache.public boolean isEvictSynchronized()
true and
swap is disabled then GridCacheProjection.evict(Object)
and all its variations will involve all nodes where an entry is kept -
this is a group of nodes responsible for partition to which
corresponding key belongs. If this property is set to false then
eviction is done independently on cache nodes.
Default value is defined by DFLT_EVICT_SYNCHRONIZED.
Note that it's not recommended to set this value to true if cache
store is configured since it will allow to significantly improve cache
performance.
true If eviction is synchronized with backup nodes (or the
rest of the nodes in case of replicated cache), false if not.public void setEvictSynchronized(boolean evictSync)
evictSync - true if synchronized, false if not.public void setEvictNearSynchronized(boolean evictNearSync)
evictNearSync - true if synchronized, false if not.public boolean isEvictNearSynchronized()
true and
is defined by DFLT_EVICT_NEAR_SYNCHRONIZED.
Note that in most cases this property should be set to true to keep
cache consistency. But there may be the cases when user may use some
special near eviction policy to have desired control over near cache
entry set.
true If eviction is synchronized with near nodes in
partitioned cache, false if not.public int getEvictSynchronizedKeyBufferSize()
Default value is defined by DFLT_EVICT_KEY_BUFFER_SIZE.
public void setEvictSynchronizedKeyBufferSize(int evictKeyBufSize)
evictKeyBufSize - Eviction key buffer size.public int getEvictSynchronizedConcurrencyLevel()
isEvictNearSynchronized() or isEvictSynchronized() set
to true. When synchronized evictions are enabled, it is possible that
local eviction policy will try to evict entries faster than evictions can be
synchronized with backup or near nodes. This value specifies how many concurrent
synchronous eviction sessions should be allowed before the system is forced to
wait and let synchronous evictions catch up with the eviction policy.
Note that if synchronous evictions start lagging, it is possible that you have either
too big or too small eviction key buffer size or small eviction timeout. In that case
you will need to adjust getEvictSynchronizedKeyBufferSize() or
getEvictSynchronizedTimeout() values as well.
Default value is defined by DFLT_EVICT_SYNCHRONIZED_CONCURRENCY_LEVEL.
public void setEvictSynchronizedConcurrencyLevel(int evictSyncConcurrencyLvl)
evictSyncConcurrencyLvl - Concurrency level for synchronized evictions.public long getEvictSynchronizedTimeout()
Node that initiates eviction waits for responses from remote nodes within this timeout.
Default value is defined by DFLT_EVICT_SYNCHRONIZED_TIMEOUT.
public void setEvictSynchronizedTimeout(long evictSyncTimeout)
evictSyncTimeout - Timeout for synchronized evictions.public float getEvictMaxOverflowRatio()
isEvictSynchronized() returns
true).
That queue is used internally as a buffer to decrease network costs for synchronized eviction. Once queue size reaches specified value all required requests for all entries in the queue are sent to remote nodes and the queue is cleared.
Default value is defined by DFLT_MAX_EVICTION_OVERFLOW_RATIO and
equals to 10%.
public void setEvictMaxOverflowRatio(float evictMaxOverflowRatio)
evictMaxOverflowRatio - Maximum eviction overflow ratio.public <K,V> GridCacheEvictionFilter<K,V> getEvictionFilter()
GridCacheEntry.evict()).
If GridCacheEvictionFilter.evictAllowed(GridCacheEntry) method returns
false then eviction policy will not be notified and entry will
never be evicted.
If not provided, any entry may be evicted depending on
eviction policy configuration.
null.public <K,V> void setEvictionFilter(GridCacheEvictionFilter<K,V> evictFilter)
evictFilter - Eviction filter.public boolean isEagerTtl()
false, expired entries will be removed on next entry access.
When not set, default value is DFLT_EAGER_TTL.
Note that this flag only matters for entries expiring based on
GridCacheEntry.timeToLive() value and should not be confused with entry
evictions based on configured GridCacheEvictionPolicy.
public void setEagerTtl(boolean eagerTtl)
eagerTtl - True if GridGain should eagerly remove expired cache entries.isEagerTtl()public GridCacheTxConcurrency getDefaultTxConcurrency()
DFLT_TX_CONCURRENCY.GridCacheTxpublic void setDefaultTxConcurrency(GridCacheTxConcurrency dfltConcurrency)
dfltConcurrency - Default cache transaction concurrency.public boolean isTxSerializableEnabled()
GridCacheTxIsolation.SERIALIZABLE isolation
level for cache transactions. Serializable level does carry certain overhead and
if not used, should be disabled. Default value is false.True if serializable transactions are enabled, false otherwise.public void setTxSerializableEnabled(boolean txSerEnabled)
isTxSerializableEnabled() for more information.txSerEnabled - Flag to enable/disable serializable cache transactions.public GridCacheTxIsolation getDefaultTxIsolation()
DFLT_TX_ISOLATION.GridCacheTxpublic void setDefaultTxIsolation(GridCacheTxIsolation dfltIsolation)
dfltIsolation - Default cache transaction isolation.public int getStartSize()
DFLT_START_SIZE.public void setStartSize(int startSize)
startSize - Cache start size.public int getNearStartSize()
DFLT_NEAR_START_SIZE.public void setNearStartSize(int nearStartSize)
GridCacheMode.PARTITIONED caching mode.nearStartSize - Start size for near cache.public <K,V> GridCacheStore<K,V> getStore()
public <K,V> void setStore(GridCacheStore<K,V> store)
store - Persistent cache store.public GridCacheAffinityFunction getAffinity()
public void setAffinity(GridCacheAffinityFunction aff)
aff - Cache key affinity.public GridCacheMode getCacheMode()
GridCacheMode.REPLICATED
mode will be used by default (defined by DFLT_CACHE_MODE constant).True if cache is local.public void setCacheMode(GridCacheMode cacheMode)
cacheMode - Caching mode.public GridCacheAtomicityMode getAtomicityMode()
Default value is defined by DFLT_CACHE_ATOMICITY_MODE.
public void setAtomicityMode(GridCacheAtomicityMode atomicityMode)
atomicityMode - Cache atomicity mode.public GridCacheAtomicWriteOrderMode getAtomicWriteOrderMode()
GridCacheAtomicityMode.ATOMIC
cache (for other atomicity modes it will be ignored).public void setAtomicWriteOrderMode(GridCacheAtomicWriteOrderMode atomicWriteOrderMode)
GridCacheAtomicityMode.ATOMIC
cache (for other atomicity modes it will be ignored).atomicWriteOrderMode - Cache write ordering mode.public int getBackups()
GridCacheMode.PARTITIONED cache.
If not set, default value is DFLT_BACKUPS.
public void setBackups(int backups)
GridCacheMode.PARTITIONED cache.
If not set, default value is DFLT_BACKUPS.
backups - Number of backup nodes for one partition.public boolean isBatchUpdateOnCommit()
true, then all transactional values will be written to persistent
storage at GridCacheTx.commit() phase. If false, then values
will be persisted after every operation. Default value is true.public void setBatchUpdateOnCommit(boolean txBatchUpdate)
true.txBatchUpdate - True if updates should be batched at the end of transaction, false if
updates should be propagated to persistent store individually as they occur (without waiting to the end of
transaction).public long getDefaultTxTimeout()
DFLT_TRANSACTION_TIMEOUT
which is 0 and means that transactions will never time out.public void setDefaultTxTimeout(long dfltTxTimeout)
DFLT_TRANSACTION_TIMEOUT.dfltTxTimeout - Default transaction timeout.public long getDefaultLockTimeout()
DFLT_LOCK_TIMEOUT
which is 0 and means that lock acquisition will never timeout.public void setDefaultLockTimeout(long dfltLockTimeout)
DFLT_LOCK_TIMEOUT.dfltLockTimeout - Default lock timeout.public long getDefaultQueryTimeout()
DFLT_QUERY_TIMEOUT. 0 (zero)
means that the query will never timeout and will wait for completion.0 for never.public void setDefaultQueryTimeout(long dfltQryTimeout)
0 for never. For more information see getDefaultQueryTimeout().dfltQryTimeout - Default query timeout.public boolean isInvalidate()
true, values will be invalidated (nullified) upon commit in near cache.public void setInvalidate(boolean invalidate)
false.invalidate - Flag to set this cache into invalidation-based mode. Default value is false.public void setStoreValueBytes(boolean storeValBytes)
storeValBytes - true if cached values should be additionally stored in serialized form, false otherwise.public boolean isStoreValueBytes()
true by default.true if cached values should be additionally stored in
serialized form, false otherwise.public double getRefreshAheadRatio()
For example, if refresh ratio is set to 0.75 and entry's time-to-live is
1 minute, then if this entry is accessed any time after 45 seconds
(which is 0.75 of a minute), the cached value will be immediately returned, but
entry will be automatically reloaded from persistent store in the background.
public void setRefreshAheadRatio(double refreshAheadRatio)
refreshAheadRatio - Refresh-ahead ratio.public int getPessimisticTxLogSize()
If not set, default value is 0 which means unlimited log size.
public void setPessimisticTxLogSize(int pessimisticTxLogSize)
pessimisticTxLogSize - Pessimistic transactions log size.getPessimisticTxLogSize()public int getPessimisticTxLogLinger()
If not set, default value is DFLT_PESSIMISTIC_TX_LOG_LINGER.
public void setPessimisticTxLogLinger(int pessimisticTxLogLinger)
pessimisticTxLogLinger - Pessimistic log cleanup delay.getPessimisticTxLogLinger()public String getTransactionManagerLookupClassName()
public void setTransactionManagerLookupClassName(String tmLookupClsName)
TransactionManager implementation, if any.tmLookupClsName - Name of class implementing GridCacheTmLookup interface that is used to
receive JTA transaction manager.public void setPreloadMode(GridCachePreloadMode preloadMode)
preloadMode - Preload mode.public GridCachePreloadMode getPreloadMode()
Default is defined by DFLT_PRELOAD_MODE.
public int getPreloadOrder()
SYNC or ASYNC preload modes only.
If cache preload order is positive, preloading for this cache will be started only when preloading for
all caches with smaller preload order (except caches with preload order 0) will be completed.
Note that cache with order 0 does not participate in ordering. This means that cache with
preload order 1 will never wait for any other caches. All caches with order 0 will
be preloaded right away concurrently with each other and ordered preload processes.
If not set, cache order is 0, i.e. preloading is not ordered.public void setPreloadOrder(int preloadOrder)
preloadOrder - Cache preload order.getPreloadOrder()public int getPreloadBatchSize()
DFLT_PRELOAD_BATCH_SIZE.public void setPreloadBatchSize(int preloadBatchSize)
preloadBatchSize - Preload batch size.public long getDgcFrequency()
If not provided, default value is DFLT_DGC_FREQUENCY.
0 to disable GC).public void setDgcFrequency(long dgcFreq)
0 to disable distributed
garbage collection. If not provided, default value is DFLT_DGC_FREQUENCY.
dgcFreq - Frequency of distributed GC in milliseconds (0 to disable GC).public long getDgcSuspectLockTimeout()
If not provided, default value is DFLT_DGC_SUSPECT_LOCK_TIMEOUT.
public void setDgcSuspectLockTimeout(long dgcSuspectLockTimeout)
If not provided, default value is DFLT_DGC_SUSPECT_LOCK_TIMEOUT.
dgcSuspectLockTimeout - Timeout in milliseconds.public boolean isDgcRemoveLocks()
GridCache.dgc(long, boolean, boolean) method.
If false DGC manager will not release the locks that are not owned by any other node.
This may be useful for debugging purposes. You may also enable DGC tracing by enabling DEBUG
on DGC_TRACE_LOGGER_NAME category.
If not provided, default value is DFLT_DGC_REMOVE_LOCKS.
True if DGC should remove locks.DGC_TRACE_LOGGER_NAMEpublic void setDgcRemoveLocks(boolean dgcRmvLocks)
dgcRmvLocks - True to remove locks.isDgcRemoveLocks()public boolean isSwapEnabled()
DFLT_SWAP_ENABLED constant.
Note that this flag may be overridden for cache projection created with flag
GridCacheFlag.SKIP_SWAP.
True if swap storage is enabled.public void setSwapEnabled(boolean swapEnabled)
swapEnabled - True if swap storage is enabled.public int getMaxConcurrentAsyncOperations()
If not set, default value is DFLT_MAX_CONCURRENT_ASYNC_OPS.
If user threads do not wait for asynchronous operations to complete, it is possible to overload a system. This property enables back-pressure control by limiting number of scheduled asynchronous cache operations.
0 if unlimited.public void setMaxConcurrentAsyncOperations(int maxConcurrentAsyncOps)
maxConcurrentAsyncOps - Maximum number of concurrent asynchronous operations.getMaxConcurrentAsyncOperations()public boolean isQueryIndexEnabled()
false, then all indexing annotations
inside of any class will be ignored. By default query indexing is disabled and
defined via DFLT_QUERY_INDEX_ENABLED constant.
Note that indexing is not supported when values are stored off-heap.
True if query indexing is enabled.getMemoryMode()public void setQueryIndexEnabled(boolean qryIdxEnabled)
qryIdxEnabled - True if query indexing is enabled.public boolean isWriteBehindEnabled()
DFLT_WRITE_BEHIND_ENABLED
constant.True if write-behind is enabled.public void setWriteBehindEnabled(boolean writeBehindEnabled)
writeBehindEnabled - true if write-behind is enabled.public int getWriteBehindFlushSize()
DFLT_WRITE_BEHIND_FLUSH_SIZE.
If this value is 0, then flush is performed according to the flush frequency interval.
Note that you cannot set both, flush size and flush frequency, to 0.public void setWriteBehindFlushSize(int writeBehindFlushSize)
writeBehindFlushSize - Write-behind cache flush size.getWriteBehindFlushSize()public long getWriteBehindFlushFrequency()
If not provided, default value is DFLT_WRITE_BEHIND_FLUSH_FREQUENCY.
If this value is 0, then flush is performed according to the flush size.
Note that you cannot set both, flush size and flush frequency, to 0.
public void setWriteBehindFlushFrequency(long writeBehindFlushFreq)
writeBehindFlushFreq - Write-behind flush frequency in milliseconds.getWriteBehindFlushFrequency()public int getWriteBehindFlushThreadCount()
getWriteBehindFlushSize(), or flush interval defined by
getWriteBehindFlushFrequency() is elapsed.
If not provided, default value is DFLT_WRITE_FROM_BEHIND_FLUSH_THREAD_CNT.public void setWriteBehindFlushThreadCount(int writeBehindFlushThreadCnt)
writeBehindFlushThreadCnt - Count of flush threads.getWriteBehindFlushThreadCount()public int getWriteBehindBatchSize()
GridCacheStore.putAll(GridCacheTx, Map) or
GridCacheStore.removeAll(GridCacheTx, Collection) methods.
If not provided, default value is DFLT_WRITE_BEHIND_BATCH_SIZE.public void setWriteBehindBatchSize(int writeBehindBatchSize)
writeBehindBatchSize - Maximum batch size.getWriteBehindBatchSize()public GridCacheCloner getCloner()
GridCacheFlag.CLONE
is set on GridCacheProjection. Cloning values is useful when it is needed to get value from
cache, change it and put it back (if the value was not cloned, then user would be updating the
cached reference which would violate cache integrity).
NOTE: by default, cache uses GridCacheBasicCloner implementation which will clone only objects
implementing Cloneable interface. You can also configure cache to use
GridCacheDeepCloner which will perform deep-cloning of all objects returned from cache,
regardless of the Cloneable interface. If none of the above cloners fit your
logic, you can also provide your own implementation of GridCacheCloner interface.
GridCacheFlag.CLONE flag is set on cache projection.public void setCloner(GridCacheCloner cloner)
GridCacheFlag.CLONE flag is set on projection.cloner - Cloner to use.getCloner()public int getAtomicSequenceReserveSize()
GridCacheAtomicSequence instances. After
a certain number has been reserved, consequent increments of sequence will happen locally,
without communication with other nodes, until the next reservation has to be made.
Default value is DFLT_ATOMIC_SEQUENCE_RESERVE_SIZE.
public void setAtomicSequenceReserveSize(int seqReserveSize)
GridCacheAtomicSequence instances. After a certain
number has been reserved, consequent increments of sequence will happen locally, without communication with other
nodes, until the next reservation has to be made.seqReserveSize - Atomic sequence reservation size.getAtomicSequenceReserveSize()public int getPreloadThreadPoolSize()
Default value is DFLT_PRELOAD_THREAD_POOL_SIZE.
public void setPreloadThreadPoolSize(int preloadPoolSize)
preloadPoolSize - Size of preloading thread pool.public long getPreloadTimeout()
Default value is DFLT_PRELOAD_TIMEOUT.
public void setPreloadTimeout(long preloadTimeout)
preloadTimeout - Preload timeout (ms).public long getPreloadPartitionedDelay()
Delayed preloading is applied to GridCacheMode.PARTITIONED caches only.
For better efficiency user should usually make sure that new nodes get placed on
the same place of consistent hash ring as the left nodes, and that nodes are
restarted before this delay expires. To place nodes on the same place in consistent hash ring,
use GridCacheConsistentHashAffinityFunction.setHashIdResolver(GridCacheAffinityNodeHashResolver)
to make sure that a node maps to the same hash ID event if restarted. As an example,
node IP address and port combination may be used in this case.
Default value is 0 which means that repartitioning and preloading will start
immediately upon node leaving topology. If -1 is returned, then preloading
will only be started manually by calling GridCache.forceRepartition() method or
from management console.
0 to start preloading immediately, -1 to
start preloading manually, or positive value to specify delay in milliseconds
after which preloading should start automatically.public void setPreloadPartitionedDelay(long preloadDelay)
getPreloadPartitionedDelay() for more information).preloadDelay - Preload delay to set.public long getPreloadThrottle()
Value of 0 means that throttling is disabled. By default throttling is disabled -
the default is defined by DFLT_PRELOAD_THROTTLE constant.
0 to disable throttling.public void setPreloadThrottle(long preloadThrottle)
Value of 0 means that throttling is
disabled. By default throttling is disabled - the default is defined by DFLT_PRELOAD_THROTTLE constant.
preloadThrottle - Time in milliseconds to wait between preload messages to avoid overloading of CPU, 0 to disable throttling.public GridCacheAffinityKeyMapper getAffinityMapper()
If not provided, then default implementation will be used. The default behavior
is described in GridCacheAffinityKeyMapper documentation.
public void setAffinityMapper(GridCacheAffinityKeyMapper affMapper)
GridCacheAffinityKeyMapper documentation.affMapper - Affinity mapper.public String getIndexingSpiName()
This property becomes useful in rare cases when more than one indexing SPI is configured. In majority of the cases default value should be used.
GridIndexingSpipublic void setIndexingSpiName(String indexingSpiName)
This property becomes useful in rare cases when more than one indexing SPI is configured. In majority of the cases default value should be used.
indexingSpiName - Name.GridIndexingSpipublic long getOffHeapMaxMemory()
-1 - Means that off-heap storage is disabled.0 - GridGain will not limit off-heap storage (it's up to user to properly
add and remove entries from cache to ensure that off-heap storage does not grow
indefinitely.
-1, specified by DFLT_OFFHEAP_MEMORY constant
which means that off-heap storage is disabled by default.
Use off-heap storage to load gigabytes of data in memory without slowing down Garbage Collection. Essentially in this case you should allocate very small amount of memory to JVM and GridGain will cache most of the data in off-heap space without affecting JVM performance at all.
Note that GridGain will throw an exception if max memory is set to -1 and
offHeapValuesOnly flag is set to true.
public void setOffHeapMaxMemory(long offHeapMaxMem)
-1 - Means that
off-heap storage is disabled.0 - GridGain will not limit off-heap storage (it's up to user to
properly add and remove entries from cache to ensure that off-heap storage does not grow infinitely. -1,
specified by DFLT_OFFHEAP_MEMORY constant which means that off-heap storage is disabled by default. Use off-heap storage to load gigabytes of data in memory without slowing down Garbage Collection. Essentially in this case you should allocate very small amount of memory to JVM and GridGain will cache most of the data in off-heap space without affecting JVM performance at all.
offHeapMaxMem - Maximum memory in bytes available to off-heap memory space.public int getMaximumQueryIteratorCount()
Default value is DFLT_MAX_QUERY_ITERATOR_CNT.
public void setMaximumQueryIteratorCount(int maxQryIterCnt)
maxQryIterCnt - Maximum number of query iterators that can be stored.@Deprecated public int getContinuousQueryQueueSize()
Default value is DFLT_CONT_QUERY_QUEUE_SIZE.
@Deprecated public void setContinuousQueryQueueSize(int contQryQueueSize)
contQryQueueSize - Continuous query queue size.public GridCacheMemoryMode getMemoryMode()
GridCacheMemoryMode for more info.
Default value is DFLT_MEMORY_MODE.
public void setMemoryMode(GridCacheMemoryMode memMode)
memMode - Memory mode.@Deprecated public int getContinuousQueryMaximumBufferSize()
Default value is either DFLT_CONT_QUERY_MAX_BUF_SIZE or
GG_CONT_QUERY_MAX_BUF_SIZE system property value (if specified).
@Deprecated public void setContinuousQueryMaximumBufferSize(int contQryMaxBufSize)
contQryMaxBufSize - Maximum buffer size for continuous queries.@Nullable public GridDrSenderCacheConfiguration getDrSenderConfiguration()
public void setDrSenderConfiguration(GridDrSenderCacheConfiguration drSndCacheCfg)
getDrSenderConfiguration() for more information.drSndCacheCfg - Data center replication send configuration.@Nullable public GridDrReceiverCacheConfiguration getDrReceiverConfiguration()
public void setDrReceiverConfiguration(GridDrReceiverCacheConfiguration drRcvCacheCfg)
getDrReceiverConfiguration() for more information.drRcvCacheCfg - Data center replication receive configuration.@Nullable public <K,V> GridCacheInterceptor<K,V> getInterceptor()
public <K,V> void setInterceptor(GridCacheInterceptor<K,V> interceptor)
interceptor - Cache interceptor.Copyright © 2014. All rights reserved.