Class IgniteCacheOptions


  • public class IgniteCacheOptions
    extends Object
    Author:
    Lukas Prettenthaler
    • 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. If false always get data from primary node (never from backup).
        Returns:
        true if data can be read from backup node or false if 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 - true to 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 to true, Ignite will create a single thread to clean up expired entries in background. When flag is set to false, 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 - True if 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:
        True if this cache persistent data is encrypted.
      • setEncryptionEnabled

        public IgniteCacheOptions setEncryptionEnabled​(boolean encryptionEnabled)
        Sets encrypted flag.
        Parameters:
        encryptionEnabled - True if 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. If true, 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 is false.
        Parameters:
        invalidate - Flag to set this cache into invalidation-based mode. Default value is false.
        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 0 if 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 - True if 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 with SYNC or ASYNC rebalance 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 order 0 does not participate in ordering. This means that cache with rebalance order 0 will never wait for any other caches. All caches with order 0 will 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 is 0 which means that repartitioning and rebalancing will start immediately upon node leaving topology. If -1 is returned, then rebalancing will only be started manually by calling rebalance() method or from management console.
        Returns:
        Rebalancing delay, 0 to start rebalancing immediately, -1 to 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
      • toJson

        public JsonObject toJson()
        Convert to JSON
        Returns:
        the JSON