Package io.vertx.spi.cluster.ignite
Class IgniteCacheOptions
- java.lang.Object
-
- io.vertx.spi.cluster.ignite.IgniteCacheOptions
-
public class IgniteCacheOptions extends Object
- Author:
- Lukas Prettenthaler
-
-
Constructor Summary
Constructors Constructor Description IgniteCacheOptions()Default constructorIgniteCacheOptions(JsonObject options)Constructor from JSONIgniteCacheOptions(IgniteCacheOptions options)Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description StringgetAtomicityMode()Gets cache atomicity mode.intgetBackups()Gets number of nodes used to back up single partition for PARTITIONED cache.StringgetCacheMode()Gets caching mode to use.JsonObjectgetEvictionPolicy()Gets on-heap cache eviction policy object.JsonObjectgetExpiryPolicy()Gets cache expiry policy object.StringgetGroupName()Gets the cache group name.intgetMaxConcurrentAsyncOperations()Gets maximum number of allowed concurrent asynchronous operations.intgetMaxQueryInteratorsCount()Gets maximum number of query iterators that can be stored.StringgetName()Cache name.StringgetPartitionLossPolicy()Gets partition loss policy.longgetRebalanceDelay()Deprecated.Use baseline topology feature instead.StringgetRebalanceMode()Gets rebalance mode for distributed cache.intgetRebalanceOrder()Gets cache rebalance order.StringgetWriteSynchronizationMode()Gets write synchronization mode.booleanisCopyOnRead()Gets the flag indicating whether a copy of the value stored in the on-heap cache should be created for a cache operation return the value.booleanisEagerTtl()Gets flag indicating whether expired cache entries will be eagerly removed from cache.booleanisEncryptionEnabled()Gets flag indicating whether data must be encrypted.booleanisEventsDisabled()Checks whether events are disabled for this cache.booleanisInvalidate()Invalidation flag.booleanisMetricsEnabled()booleanisOnheapCacheEnabled()Checks if the on-heap cache is enabled for the off-heap based page memory.booleanisReadFromBackup()Gets flag indicating whether data can be read from backup.IgniteCacheOptionssetAtomicityMode(String atomicityMode)Sets cache atomicity mode.IgniteCacheOptionssetBackups(int backups)Sets number of nodes used to back up single partition for PARTITIONED cache.IgniteCacheOptionssetCacheMode(String cacheMode)Sets caching mode.IgniteCacheOptionssetCopyOnRead(boolean copyOnRead)Sets copy on read flag.IgniteCacheOptionssetEagerTtl(boolean eagerTtl)Sets eager ttl flag.IgniteCacheOptionssetEncryptionEnabled(boolean encryptionEnabled)Sets encrypted flag.IgniteCacheOptionssetEventsDisabled(boolean eventsDisabled)Sets events disabled flag.IgniteCacheOptionssetEvictionPolicy(JsonObject evictionPolicy)Sets on-heap cache eviction policy object.IgniteCacheOptionssetExpiryPolicy(JsonObject expiryPolicy)Sets cache expiry policy object.IgniteCacheOptionssetGroupName(String groupName)Sets the cache group name.IgniteCacheOptionssetInvalidate(boolean invalidate)Sets invalidation flag for near cache entries in this transaction.IgniteCacheOptionssetMaxConcurrentAsyncOperations(int maxConcurrentAsyncOperations)Sets maximum number of concurrent asynchronous operations.IgniteCacheOptionssetMaxQueryInteratorsCount(int maxQueryInteratorsCount)Sets maximum number of query iterators that can be stored.IgniteCacheOptionssetMetricsEnabled(boolean metricsEnabled)Sets cache metrics enabled/disabled.IgniteCacheOptionssetName(String name)Sets cache name.IgniteCacheOptionssetOnheapCacheEnabled(boolean onheapCacheEnabled)Configures on-heap cache for the off-heap based page memory.IgniteCacheOptionssetPartitionLossPolicy(String partitionLossPolicy)Sets partition loss policy.IgniteCacheOptionssetReadFromBackup(boolean readFromBackup)Sets read from backup flag.IgniteCacheOptionssetRebalanceDelay(long rebalanceDelay)Deprecated.Use baseline topology feature instead.IgniteCacheOptionssetRebalanceMode(String rebalanceMode)Sets cache rebalance mode.IgniteCacheOptionssetRebalanceOrder(int rebalanceOrder)Sets cache rebalance order.IgniteCacheOptionssetWriteSynchronizationMode(String writeSynchronizationMode)Sets write synchronization mode.JsonObjecttoJson()Convert to JSON
-
-
-
Constructor Detail
-
IgniteCacheOptions
public IgniteCacheOptions()
Default constructor
-
IgniteCacheOptions
public IgniteCacheOptions(IgniteCacheOptions options)
Copy constructor- Parameters:
options- the one to copy
-
IgniteCacheOptions
public IgniteCacheOptions(JsonObject options)
Constructor from JSON- Parameters:
options- the JSON
-
-
Method Detail
-
getName
public String getName()
Cache name.- Returns:
- Cache name.
-
setName
public IgniteCacheOptions setName(String name)
Sets cache name.- Parameters:
name- Cache name. Can not be null or empty.- Returns:
- reference to this, for fluency
-
getCacheMode
public String getCacheMode()
Gets caching mode to use. You can configure cache either to be local-only, fully replicated, partitioned, or near. If not provided, PARTITIONED mode will be used by default.- Returns:
- Caching mode.
-
setCacheMode
public IgniteCacheOptions setCacheMode(String cacheMode)
Sets caching mode.- Parameters:
cacheMode- Caching mode.- Returns:
- reference to this, for fluency
-
getBackups
public int getBackups()
Gets number of nodes used to back up single partition for PARTITIONED cache.- Returns:
- Number of backup nodes for one partition.
-
setBackups
public IgniteCacheOptions setBackups(int backups)
Sets number of nodes used to back up single partition for PARTITIONED cache.- Parameters:
backups- Number of backup nodes for one partition.- Returns:
- reference to this, for fluency
-
isReadFromBackup
public boolean isReadFromBackup()
Gets flag indicating whether data can be read from backup. Iffalsealways get data from primary node (never from backup).- Returns:
trueif data can be read from backup node orfalseif data always should be read from primary node and never from backup.
-
setReadFromBackup
public IgniteCacheOptions setReadFromBackup(boolean readFromBackup)
Sets read from backup flag.- Parameters:
readFromBackup-trueto allow reads from backups.- Returns:
- reference to this, for fluency
-
getAtomicityMode
public String getAtomicityMode()
Gets cache atomicity mode.- Returns:
- Cache atomicity mode.
-
setAtomicityMode
public IgniteCacheOptions setAtomicityMode(String atomicityMode)
Sets cache atomicity mode.- Parameters:
atomicityMode- Cache atomicity mode.- Returns:
- reference to this, for fluency
-
getWriteSynchronizationMode
public String getWriteSynchronizationMode()
Gets write synchronization mode. This mode controls whether the main caller should wait for update on other nodes to complete or not.- Returns:
- Write synchronization mode.
-
setWriteSynchronizationMode
public IgniteCacheOptions setWriteSynchronizationMode(String writeSynchronizationMode)
Sets write synchronization mode.- Parameters:
writeSynchronizationMode- Write synchronization mode.- Returns:
- reference to this, for fluency
-
isCopyOnRead
public boolean isCopyOnRead()
Gets the flag indicating whether a copy of the value stored in the on-heap cache should be created for a cache operation return the value. If the on-heap cache is disabled then this flag is of no use.- Returns:
- Copy on read flag.
-
setCopyOnRead
public IgniteCacheOptions setCopyOnRead(boolean copyOnRead)
Sets copy on read flag.- Parameters:
copyOnRead- Copy on get flag.- Returns:
- reference to this, for fluency
-
isEagerTtl
public boolean isEagerTtl()
Gets flag indicating whether expired cache entries will be eagerly removed from cache. If there is at least one cache configured with this flag set totrue, Ignite will create a single thread to clean up expired entries in background. When flag is set tofalse, expired entries will be removed on next entry access.- Returns:
- Flag indicating whether Ignite will eagerly remove expired entries.
-
setEagerTtl
public IgniteCacheOptions setEagerTtl(boolean eagerTtl)
Sets eager ttl flag.- Parameters:
eagerTtl-Trueif Ignite should eagerly remove expired cache entries.- Returns:
- reference to this, for fluency
-
isEncryptionEnabled
public boolean isEncryptionEnabled()
Gets flag indicating whether data must be encrypted.- Returns:
Trueif this cache persistent data is encrypted.
-
setEncryptionEnabled
public IgniteCacheOptions setEncryptionEnabled(boolean encryptionEnabled)
Sets encrypted flag.- Parameters:
encryptionEnabled-Trueif this cache persistent data should be encrypted.- Returns:
- reference to this, for fluency
-
getGroupName
public String getGroupName()
Gets the cache group name. Caches with the same group name share single underlying 'physical' cache (partition set), but are logically isolated. Grouping caches reduces overall overhead, since internal data structures are shared.- Returns:
- Cache group name.
-
setGroupName
public IgniteCacheOptions setGroupName(String groupName)
Sets the cache group name. Caches with the same group name share single underlying 'physical' cache (partition set), but are logically isolated. Grouping caches reduces overall overhead, since internal data structures are shared.- Parameters:
groupName- Cache group name.- Returns:
- reference to this, for fluency
-
isInvalidate
public boolean isInvalidate()
Invalidation flag. Iftrue, values will be invalidated (nullified) upon commit in near cache.- Returns:
- Invalidation flag.
-
setInvalidate
public IgniteCacheOptions setInvalidate(boolean invalidate)
Sets invalidation flag for near cache entries in this transaction. Default isfalse.- Parameters:
invalidate- Flag to set this cache into invalidation-based mode. Default value isfalse.- Returns:
- reference to this, for fluency
-
getMaxConcurrentAsyncOperations
public int getMaxConcurrentAsyncOperations()
Gets maximum number of allowed concurrent asynchronous operations. If 0 returned then number of concurrent asynchronous operations is unlimited. 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.- Returns:
- Maximum number of concurrent asynchronous operations or
0if unlimited.
-
setMaxConcurrentAsyncOperations
public IgniteCacheOptions setMaxConcurrentAsyncOperations(int maxConcurrentAsyncOperations)
Sets maximum number of concurrent asynchronous operations.- Parameters:
maxConcurrentAsyncOperations- Maximum number of concurrent asynchronous operations.- Returns:
- reference to this, for fluency
-
isOnheapCacheEnabled
public boolean isOnheapCacheEnabled()
Checks if the on-heap cache is enabled for the off-heap based page memory.- Returns:
- On-heap cache enabled flag.
-
setOnheapCacheEnabled
public IgniteCacheOptions setOnheapCacheEnabled(boolean onheapCacheEnabled)
Configures on-heap cache for the off-heap based page memory.- Parameters:
onheapCacheEnabled-Trueif on-heap cache should be enabled.- Returns:
- reference to this, for fluency
-
getPartitionLossPolicy
public String getPartitionLossPolicy()
Gets partition loss policy. This policy defines how Ignite will react to a situation when all nodes for some partition leave the cluster.- Returns:
- Partition loss policy.
-
setPartitionLossPolicy
public IgniteCacheOptions setPartitionLossPolicy(String partitionLossPolicy)
Sets partition loss policy. This policy defines how Ignite will react to a situation when all nodes for some partition leave the cluster.- Parameters:
partitionLossPolicy- Partition loss policy.- Returns:
- reference to this, for fluency
-
getRebalanceMode
public String getRebalanceMode()
Gets rebalance mode for distributed cache.- Returns:
- Rebalance mode.
-
setRebalanceMode
public IgniteCacheOptions setRebalanceMode(String rebalanceMode)
Sets cache rebalance mode.- Parameters:
rebalanceMode- Rebalance mode.- Returns:
- reference to this, for fluency
-
getRebalanceOrder
public int getRebalanceOrder()
Gets cache rebalance order. Rebalance order can be set to non-zero value for caches withSYNCorASYNCrebalance modes only. If cache rebalance order is positive, rebalancing for this cache will be started only when rebalancing for all caches with smaller rebalance order will be completed. Note that cache with order0does not participate in ordering. This means that cache with rebalance order0will never wait for any other caches. All caches with order0will be rebalanced right away concurrently with each other and ordered rebalance processes. If not set, cache order is 0, i.e. rebalancing is not ordered.- Returns:
- Cache rebalance order.
-
setRebalanceOrder
public IgniteCacheOptions setRebalanceOrder(int rebalanceOrder)
Sets cache rebalance order.- Parameters:
rebalanceOrder- Cache rebalance order.- Returns:
- reference to this, for fluency
-
getRebalanceDelay
@Deprecated public long getRebalanceDelay()
Deprecated.Use baseline topology feature instead. Please, be aware this API will be removed in the next releases.Gets delay in milliseconds upon a node joining or leaving topology (or crash) after which rebalancing should be started automatically. Rebalancing should be delayed if you plan to restart nodes after they leave topology, or if you plan to start multiple nodes at once or one after another and don't want to repartition and rebalance until all nodes are started. 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. As an example, node IP address and port combination may be used in this case. Default value is0which means that repartitioning and rebalancing will start immediately upon node leaving topology. If-1is returned, then rebalancing will only be started manually by calling rebalance() method or from management console.- Returns:
- Rebalancing delay,
0to start rebalancing immediately,-1to start rebalancing manually, or positive value to specify delay in milliseconds after which rebalancing should start automatically.
-
setRebalanceDelay
@Deprecated public IgniteCacheOptions setRebalanceDelay(long rebalanceDelay)
Deprecated.Use baseline topology feature instead. Please, be aware this API will be removed in the next releases.Sets rebalance delay.- Parameters:
rebalanceDelay- Rebalance delay to set.- Returns:
- reference to this, for fluency
-
getMaxQueryInteratorsCount
public int getMaxQueryInteratorsCount()
Gets maximum number of query iterators that can be stored. Iterators are stored to support query pagination when each page of data is sent to user's node only on demand. Increase this property if you are running and processing lots of queries in parallel.- Returns:
- Maximum number of query iterators that can be stored.
-
setMaxQueryInteratorsCount
public IgniteCacheOptions setMaxQueryInteratorsCount(int maxQueryInteratorsCount)
Sets maximum number of query iterators that can be stored.- Parameters:
maxQueryInteratorsCount- Maximum number of query iterators that can be stored.- Returns:
- reference to this, for fluency
-
isEventsDisabled
public boolean isEventsDisabled()
Checks whether events are disabled for this cache.- Returns:
- Events disabled flag.
-
setEventsDisabled
public IgniteCacheOptions setEventsDisabled(boolean eventsDisabled)
Sets events disabled flag.- Parameters:
eventsDisabled- Events disabled flag.- Returns:
- reference to this, for fluency
-
getExpiryPolicy
public JsonObject getExpiryPolicy()
Gets cache expiry policy object.- Returns:
- Json representation of expiry policy.
-
setExpiryPolicy
public IgniteCacheOptions setExpiryPolicy(JsonObject expiryPolicy)
Sets cache expiry policy object. Requires a duration in milliseconds and an optional type which defaults to "created" Valid type values are: accessed, modified, touched and created- Parameters:
expiryPolicy- Json representation of expiry policys.- Returns:
- reference to this, for fluency
-
isMetricsEnabled
public boolean isMetricsEnabled()
-
setMetricsEnabled
public IgniteCacheOptions setMetricsEnabled(boolean metricsEnabled)
Sets cache metrics enabled/disabled. Defaults to false- Parameters:
metricsEnabled- to set.- Returns:
- reference to this, for fluency
-
getEvictionPolicy
public JsonObject getEvictionPolicy()
Gets on-heap cache eviction policy object.- Returns:
- Json representation of eviction policy.
-
setEvictionPolicy
public IgniteCacheOptions setEvictionPolicy(JsonObject evictionPolicy)
Sets on-heap cache eviction policy object. Requires a type which defaults to "lru" and an optional maxSize, batchSize and maxMemSize in bytes maxSize defaults to 100000, batchSize to 1 and maxMemSize to 0 (unlimited) Valid type values are: lru, fifo and sorted- Parameters:
evictionPolicy- Json representation of eviction policy.- Returns:
- reference to this, for fluency
-
toJson
public JsonObject toJson()
Convert to JSON- Returns:
- the JSON
-
-