Class CacheConfigurationImpl

java.lang.Object
org.wso2.carbon.caching.impl.CacheConfigurationImpl
All Implemented Interfaces:
CacheConfiguration

public final class CacheConfigurationImpl extends Object implements CacheConfiguration
TODO: class description
  • Field Details

    • readThrough

      protected boolean readThrough
      read through
    • writeThrough

      protected boolean writeThrough
      write through
    • statisticsEnabled

      protected boolean statisticsEnabled
      statistics enabled
    • timeToLive

      protected CacheConfiguration.Duration[] timeToLive
      duration
    • storeByValue

      protected boolean storeByValue
      store by value
    • isolationLevel

      protected IsolationLevel isolationLevel
      isolation level
    • transactionMode

      protected Mode transactionMode
      transaction mode
  • Constructor Details

    • CacheConfigurationImpl

      public CacheConfigurationImpl()
    • CacheConfigurationImpl

      public CacheConfigurationImpl(boolean readThrough, boolean writeThrough, boolean storeByValue, boolean statisticsEnabled, IsolationLevel isolationLevel, Mode transactionMode, CacheConfiguration.Duration[] timeToLive)
  • Method Details

    • isReadThrough

      public boolean isReadThrough()
      Whether the cache is a read-through cache. A CacheLoader should be configured for read through caches which is called by the cache for what without the loader would have been misses on Cache.get(Object) and
      invalid @link
      {@link Cache#getAll(java.util.Set
      }.

      Default value is false.

      Specified by:
      isReadThrough in interface CacheConfiguration
      Returns:
      true if the cache is read-through
    • isWriteThrough

      public boolean isWriteThrough()
      Whether the cache is a write-through cache. If so a CacheWriter should be configured.

      Default value is false.

      Specified by:
      isWriteThrough in interface CacheConfiguration
      Returns:
      true if the cache is write-through
    • isStoreByValue

      public boolean isStoreByValue()
      Whether storeByValue (true) or storeByReference (false). When true, both keys and values are stored by value.

      When false, both keys and values are stored by reference. Caches stored by reference are capable of mutation by any threads holding the reference. The effects are:

      • if the key is mutated, then the key may not be retrievable or removable
      • if the value is mutated, then all threads in the JVM can potentially observe those mutations, subject to the normal Java Memory Model rules.
      Storage by reference only applies to the local heap. If an entry is moved off heap it will need to be transformed into a representation. Any mutations that occur after transformation may not be reflected in the cache.

      The default value is true.

      When a cache is storeByValue, any mutation to the key or value does not affect the key of value stored in the cache.

      Specified by:
      isStoreByValue in interface CacheConfiguration
      Returns:
      true if the cache is store by value
    • isStatisticsEnabled

      public boolean isStatisticsEnabled()
      Checks whether statistics collection is enabled in this cache.

      The default value is false.

      Specified by:
      isStatisticsEnabled in interface CacheConfiguration
      Returns:
      true if statistics collection is enabled
    • setStatisticsEnabled

      public void setStatisticsEnabled(boolean enableStatistics)
      Sets whether statistics gathering is enabled on this cache. This may be changed at runtime.
      Specified by:
      setStatisticsEnabled in interface CacheConfiguration
      Parameters:
      enableStatistics - true to enable statistics, false to disable.
    • getExpiry

      Description copied from interface: CacheConfiguration
      Gets the cache's time to live setting,Sets how long cache entries should live. If expiry is not set entries are eternal.

      Default value is CacheConfiguration.Duration.ETERNAL.

      Specified by:
      getExpiry in interface CacheConfiguration
      Parameters:
      type - the type of the expiration
      Returns:
      how long, in milliseconds, the specified units, the entry should live. 0 means eternal.
    • isTransactionEnabled

      public boolean isTransactionEnabled()
      Checks whether transaction are enabled for this cache.

      Default value is false.

      Specified by:
      isTransactionEnabled in interface CacheConfiguration
      Returns:
      true if transaction are enabled
    • getTransactionIsolationLevel

      public IsolationLevel getTransactionIsolationLevel()
      Description copied from interface: CacheConfiguration
      Gets the transaction isolation level.
      Specified by:
      getTransactionIsolationLevel in interface CacheConfiguration
      Returns:
      the isolation level. IsolationLevel.NONE if this cache is not transactional.
    • getTransactionMode

      public Mode getTransactionMode()
      Description copied from interface: CacheConfiguration
      Gets the transaction mode.
      Specified by:
      getTransactionMode in interface CacheConfiguration
      Returns:
      the the mode of the cache. Mode.NONE if this cache is not transactional.
    • getCacheLoader

      public CacheLoader getCacheLoader()
      Description copied from interface: CacheConfiguration
      Gets the registered CacheLoader, if any.
      Specified by:
      getCacheLoader in interface CacheConfiguration
      Returns:
      the CacheLoader or null if none has been set.
    • getCacheWriter

      public CacheWriter getCacheWriter()
      Description copied from interface: CacheConfiguration
      Gets the registered CacheWriter, if any.
      Specified by:
      getCacheWriter in interface CacheConfiguration
      Returns:
      the CacheWriter or null if none has been set.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object