Class ReadWriteBackingMapScheme

    • Constructor Detail

      • ReadWriteBackingMapScheme

        public ReadWriteBackingMapScheme()
    • Method Detail

      • getCacheStoreScheme

        public CacheStoreScheme getCacheStoreScheme()
        Return the CacheStoreScheme used to create a CacheStore or CacheLoader.
        Returns:
        the builder
      • getCacheStoreTimeout

        public Millis getCacheStoreTimeout​(ParameterResolver resolver)
        Return the timeout interval to use for CacheStore read and write operations. If a CacheStore operation times out, the executing thread is interrupted and may ultimately lead to the termination of the cache service. Timeouts of asynchronous CacheStore operations (for example, refresh-ahead, write-behind) do not result in service termination.
        Parameters:
        resolver - the ParameterResolver
        Returns:
        the timeout
      • setCacheStoreTimeout

        @Injectable("cachestore-timeout")
        public void setCacheStoreTimeout​(Expression<Millis> expr)
        Set the timeout interval to use for CacheStore/CacheLoader read and write operations.
        Parameters:
        expr - the timeout interval expression
      • getInternalScheme

        public CachingScheme getInternalScheme()
        Return the scheme which the specifies the map used to cache entries.
        Returns:
        the scheme for the internal map
      • setInternalScheme

        @Injectable("internal-cache-scheme")
        public void setInternalScheme​(CachingScheme scheme)
        Set the internal scheme.
        Parameters:
        scheme - the internal scheme
      • getInternalMap

        public ObservableMap getInternalMap()
        Return the internal map which is set by the backing map manager when the partitioned flag is true. Otherwise the map will be null.
        Returns:
        the internal map
      • setInternalMap

        public void setInternalMap​(ObservableMap map)
        Set the internal map.
        Parameters:
        map - the internal map
      • getMissCacheScheme

        public LocalScheme getMissCacheScheme()
        Return the Scheme for the cache used to maintain information on cache misses. The miss-cache is used track keys which were not found in the cache store. The knowledge that a key is not in the cache store allows some operations to perform faster, as they can avoid querying the potentially slow cache store. A size-limited scheme may be used to control how many misses are cached. If unspecified no cache-miss data is maintained.
        Returns:
        the miss cache scheme
      • setMissCacheScheme

        @Injectable("miss-cache-scheme")
        public void setMissCacheScheme​(LocalScheme scheme)
        Set the miss cache Scheme.
        Parameters:
        scheme - the miss cache scheme
      • isReadOnly

        public boolean isReadOnly​(ParameterResolver resolver)
        Returns true if the cache is read only. A read-only cache loads data from cache store for read operations and does not perform any writing to the cache store when the cache is updated.
        Parameters:
        resolver - the ParameterResolver
        Returns:
        true if the cache is read only
      • setReadOnly

        @Injectable
        public void setReadOnly​(Expression<Boolean> expr)
        Set the read-only flag.
        Parameters:
        expr - true if the cache is read-only
      • getRefreshAheadFactor

        public double getRefreshAheadFactor​(ParameterResolver resolver)
        Return refresh-ahead-factor used to calculate the "soft-expiration" time for cache entries. Soft-expiration is the point in time before the actual expiration after which any access request for an entry schedules an asynchronous load request for the entry. This attribute is only applicable if the internal cache is a LocalCache, with a non-zero expiry delay. The value is expressed as a percentage of the internal LocalCache expiration interval. If zero, refresh-ahead scheduling is disabled. If 1.0, then any get operation immediately triggers an asynchronous reload. Legal values are nonnegative doubles less than or equal to 1.0.
        Parameters:
        resolver - the ParameterResolver
        Returns:
        the refresh-ahead factor
      • setRefreshAheadFactor

        @Injectable
        public void setRefreshAheadFactor​(Expression<Double> expr)
        Set the refresh ahead factor.
        Parameters:
        expr - the refresh ahead factor
      • isRollbackCacheStoreFailures

        public boolean isRollbackCacheStoreFailures​(ParameterResolver resolver)
        Return true if exceptions caught during synchronous cachestore operations are rethrown to the calling thread (possibly over the network to a remote member). Legal values are true or false. If the value of this element is false, an exception caught during a synchronous cachestore operation is logged locally and the internal cache is updated. If the value is true, the exception is rethrown to the calling thread and the internal cache is not changed. If the operation was called within a transactional context, this would have the effect of rolling back the current transaction.
        Parameters:
        resolver - the ParameterResolver
        Returns:
        the rollback cachestore failures flag
      • setRollbackCacheStoreFailures

        @Injectable("rollback-cachestore-failures")
        public void setRollbackCacheStoreFailures​(Expression<Boolean> expr)
        Set the flag to indicate that cache store failures should be rolled back.
        Parameters:
        expr - true if failures should be rolled back
      • getWriteBatchFactor

        public double getWriteBatchFactor​(ParameterResolver resolver)
        Return the write-batch-factor element is used to calculate the "soft-ripe" time for write-behind queue entries. A queue entry is considered to be "ripe" for a write operation if it has been in the write-behind queue for no less than the write-delay interval. The "soft-ripe" time is the point in time before the actual ripe time after which an entry is included in a batched asynchronous write operation to the CacheStore (along with all other ripe and soft-ripe entries).
        Parameters:
        resolver - the ParameterResolver
        Returns:
        the write batch factor
      • setWriteBatchFactor

        @Injectable
        public void setWriteBatchFactor​(Expression<Double> expr)
        Set the write batch factor.
        Parameters:
        expr - the write batch factor
      • getWriteDelay

        public Seconds getWriteDelay​(ParameterResolver resolver)
        Return the time interval to defer asynchronous writes to the cache store for a write-behind queue. If zero, synchronous writes to the cache store (without queuing) take place, otherwise the writes are asynchronous and deferred by specified time interval after the last update to the value in the cache.
        Parameters:
        resolver - the ParameterResolver
        Returns:
        the write behind delay
      • setWriteDelay

        @Injectable
        public void setWriteDelay​(Expression<Seconds> expr)
        Set the write behind delay.
        Parameters:
        expr - the write behind delay
      • getWriteDelaySeconds

        public int getWriteDelaySeconds​(ParameterResolver resolver)
        Return the write behind delay in seconds.
        Parameters:
        resolver - the ParameterResolver
        Returns:
        the write behind delay in seconds
      • setWriteDelaySeconds

        @Injectable
        public void setWriteDelaySeconds​(Expression<Integer> expr)
        Set the write behind delay seconds.
        Parameters:
        expr - the write behind delay in seconds
      • getWriteMaxBatchSize

        public int getWriteMaxBatchSize​(ParameterResolver resolver)
        Return the maximum number of entries to write in a single storeAll operation. Valid values are positive integers or zero. The default value is 128 entries. This value has no effect if write behind is disabled.
        Parameters:
        resolver - the ParameterResolver
        Returns:
        the write maximum batch size
      • setWriteMaxBatchSize

        @Injectable
        public void setWriteMaxBatchSize​(Expression<Integer> expr)
        Set the write max batch size.
        Parameters:
        expr - the write max batch size
      • getWriteRequeueThreshold

        public int getWriteRequeueThreshold​(ParameterResolver resolver)
        Return the size of the write-behind queue at which additional actions could be taken. If zero, write-behind re-queuing is disabled. Otherwise, this value controls the frequency of the corresponding log messages. For example, a value of 100 produces a log message every time the size of the write queue is a multiple of 100. Legal values are positive integers or zero.
        Parameters:
        resolver - the ParameterResolver
        Returns:
        the write re-queue threshold
      • setWriteRequeueThreshold

        @Injectable
        public void setWriteRequeueThreshold​(Expression<Integer> expr)
        Set the size of the write-behind queue at which additional actions could be taken.
        Parameters:
        expr - the write re-queue threshold
      • instantiateReadWriteBackingMap

        protected ReadWriteBackingMap instantiateReadWriteBackingMap​(BackingMapManagerContext context,
                                                                     ObservableMap mapInternal,
                                                                     Map mapMisses,
                                                                     CacheLoader store,
                                                                     boolean fReadOnly,
                                                                     int cWriteBehindSeconds,
                                                                     double dflRefreshAheadFactor)
        Construct a ReadWriteBackingMap using the specified parameters.

        This method exposes a corresponding ReadWriteBackingMap constructor and is provided for the express purpose of allowing its override.

        Parameters:
        context - the context provided by the CacheService which is using this backing map
        mapInternal - the ObservableMap used to store the data internally in this backing map
        mapMisses - the Map used to cache CacheStore misses (optional)
        store - the object responsible for the persistence of the cached data (optional)
        fReadOnly - pass true is the specified loader is in fact a CacheStore that needs to be used only for read operations; changes to the cache will not be persisted
        cWriteBehindSeconds - number of seconds to write if there is a CacheStore; zero disables write-behind caching, which (combined with !fReadOnly) implies write-through
        dflRefreshAheadFactor - the interval before an entry expiration time (expressed as a percentage of the internal cache expiration interval) during which an asynchronous load request for the entry will be scheduled; zero disables refresh-ahead; only applicable when the mapInternal parameter is an instance of ConfigurableCacheMap
        Returns:
        the instantiated ReadWriteBackingMap
      • instantiateReadWriteBackingMap

        protected ReadWriteBackingMap instantiateReadWriteBackingMap​(BackingMapManagerContext context,
                                                                     ObservableMap mapInternal,
                                                                     Map mapMisses,
                                                                     BinaryEntryStore storeBinary,
                                                                     boolean fReadOnly,
                                                                     int cWriteBehindSeconds,
                                                                     double dflRefreshAheadFactor)
        Construct a ReadWriteBackingMap using the specified parameters.

        This method exposes a corresponding ReadWriteBackingMap constructor and is provided for the express purpose of allowing its override.

        Parameters:
        context - the context provided by the CacheService which is using this backing map
        mapInternal - the ObservableMap used to store the data internally in this backing map
        mapMisses - the Map used to cache CacheStore misses (optional)
        storeBinary - the BinaryEntryStore responsible for the persistence of the cached data (optional)
        fReadOnly - pass true is the specified loader is in fact a CacheStore that needs to be used only for read operations; changes to the cache will not be persisted
        cWriteBehindSeconds - number of seconds to write if there is a CacheStore; zero disables write-behind caching, which (combined with !fReadOnly) implies write-through
        dflRefreshAheadFactor - the interval before an entry expiration time (expressed as a percentage of the internal cache expiration interval) during which an asynchronous load request for the entry will be scheduled; zero disables refresh-ahead; only applicable when the mapInternal parameter is an instance of ConfigurableCacheMap
        Returns:
        the instantiated ReadWriteBackingMap
      • instantiateReadWriteBackingMap

        protected ReadWriteBackingMap instantiateReadWriteBackingMap​(BackingMapManagerContext context,
                                                                     ObservableMap mapInternal,
                                                                     Map mapMisses,
                                                                     NonBlockingEntryStore storeBinary,
                                                                     boolean fReadOnly,
                                                                     int cWriteBehindSeconds,
                                                                     double dflRefreshAheadFactor)
        Construct a ReadWriteBackingMap using the specified parameters.

        This method exposes a corresponding ReadWriteBackingMap constructor and is provided for the express purpose of allowing its override.

        Parameters:
        context - the context provided by the CacheService which is using this backing map
        mapInternal - the ObservableMap used to store the data internally in this backing map
        mapMisses - the Map used to cache CacheStore misses (optional)
        storeBinary - the NonBlockingEntryStore responsible for the persistence of the cached data (optional)
        fReadOnly - pass true is the specified loader is in fact a CacheStore that needs to be used only for read operations; changes to the cache will not be persisted
        cWriteBehindSeconds - number of seconds to write if there is a CacheStore; zero disables write-behind caching, which (combined with !fReadOnly) implies write-through
        dflRefreshAheadFactor - the interval before an entry expiration time (expressed as a percentage of the internal cache expiration interval) during which an asynchronous load request for the entry will be scheduled; zero disables refresh-ahead; only applicable when the mapInternal parameter is an instance of ConfigurableCacheMap
        Returns:
        the instantiated ReadWriteBackingMap
      • instantiateReadWriteSplittingBackingMap

        protected ReadWriteSplittingBackingMap instantiateReadWriteSplittingBackingMap​(BackingMapManagerContext context,
                                                                                       PartitionAwareBackingMap mapInternal,
                                                                                       Map mapMisses,
                                                                                       CacheLoader store,
                                                                                       boolean fReadOnly,
                                                                                       int cWriteBehindSeconds,
                                                                                       double dflRefreshAheadFactor)
        Construct a ReadWriteSplittingBackingMap using the specified parameters.

        This method exposes a corresponding ReadWriteSplittingBackingMap constructor and is provided for the express purpose of allowing its override.

        Parameters:
        context - the context provided by the CacheService which is using this backing map
        mapInternal - the ObservableMap used to store the data internally in this backing map
        mapMisses - the Map used to cache CacheStore misses (optional)
        store - the object responsible for the persistence of the cached data (optional)
        fReadOnly - pass true is the specified loader is in fact a CacheStore that needs to be used only for read operations; changes to the cache will not be persisted
        cWriteBehindSeconds - number of seconds to write if there is a CacheStore; zero disables write-behind caching, which (combined with !fReadOnly) implies write-through
        dflRefreshAheadFactor - the interval before an entry expiration time (expressed as a percentage of the internal cache expiration interval) during which an asynchronous load request for the entry will be scheduled; zero disables refresh-ahead; only applicable when the mapInternal parameter is an instance of ConfigurableCacheMap
        Returns:
        the instantiated ReadWriteSplittingBackingMap
      • instantiateReadWriteSplittingBackingMap

        protected ReadWriteSplittingBackingMap instantiateReadWriteSplittingBackingMap​(BackingMapManagerContext context,
                                                                                       PartitionAwareBackingMap mapInternal,
                                                                                       Map mapMisses,
                                                                                       BinaryEntryStore storeBinary,
                                                                                       boolean fReadOnly,
                                                                                       int cWriteBehindSeconds,
                                                                                       double dflRefreshAheadFactor)
        Construct a ReadWriteSplittingBackingMap using the specified parameters.

        This method exposes a corresponding ReadWriteSplittingBackingMap constructor and is provided for the express purpose of allowing its override.

        Parameters:
        context - the context provided by the CacheService which is using this backing map
        mapInternal - the ObservableMap used to store the data internally in this backing map
        mapMisses - the Map used to cache CacheStore misses (optional)
        storeBinary - the BinaryEntryStore responsible for the persistence of the cached data (optional)
        fReadOnly - pass true is the specified loader is in fact a CacheStore that needs to be used only for read operations; changes to the cache will not be persisted
        cWriteBehindSeconds - number of seconds to write if there is a CacheStore; zero disables write-behind caching, which (combined with !fReadOnly) implies write-through
        dflRefreshAheadFactor - the interval before an entry expiration time (expressed as a percentage of the internal cache expiration interval) during which an asynchronous load request for the entry will be scheduled; zero disables refresh-ahead; only applicable when the mapInternal parameter is an instance of ConfigurableCacheMap
        Returns:
        the instantiated ReadWriteSplittingBackingMap
      • instantiateReadWriteSplittingBackingMap

        protected ReadWriteSplittingBackingMap instantiateReadWriteSplittingBackingMap​(BackingMapManagerContext context,
                                                                                       PartitionAwareBackingMap mapInternal,
                                                                                       Map mapMisses,
                                                                                       NonBlockingEntryStore storeBinary,
                                                                                       boolean fReadOnly,
                                                                                       int cWriteBehindSeconds,
                                                                                       double dflRefreshAheadFactor)
        Construct a ReadWriteSplittingBackingMap using the specified parameters.

        This method exposes a corresponding ReadWriteSplittingBackingMap constructor and is provided for the express purpose of allowing its override.

        Parameters:
        context - the context provided by the CacheService which is using this backing map
        mapInternal - the ObservableMap used to store the data internally in this backing map
        mapMisses - the Map used to cache CacheStore misses (optional)
        storeBinary - the NonBlockingEntryStore responsible for the persistence of the cached data (optional)
        fReadOnly - pass true is the specified loader is in fact a CacheStore that needs to be used only for read operations; changes to the cache will not be persisted
        cWriteBehindSeconds - number of seconds to write if there is a CacheStore; zero disables write-behind caching, which (combined with !fReadOnly) implies write-through
        dflRefreshAheadFactor - the interval before an entry expiration time (expressed as a percentage of the internal cache expiration interval) during which an asynchronous load request for the entry will be scheduled; zero disables refresh-ahead; only applicable when the mapInternal parameter is an instance of ConfigurableCacheMap
        Returns:
        the instantiated ReadWriteSplittingBackingMap