Interface CacheSettings


@PublicApi public interface CacheSettings
An immutable representation of settings for a Cache. The property getters will return null to indicate that no setting is specified. The caller is responsible for handling that null may be returned.
Since:
2.0
  • Method Details

    • getExpireAfterAccess

      @Nullable Long getExpireAfterAccess()
      Returns:
      how long to retain entries (in milliseconds) from when they were last accessed, or null.
    • getExpireAfterAccess

      long getExpireAfterAccess(long defaultValue)
      Convenience method that returns getExpireAfterAccess() if it is not null, otherwise returns the supplied defaultValue.
    • getExpireAfterWrite

      @Nullable Long getExpireAfterWrite()
      Returns:
      how long to retain entries (in milliseconds) from when they were created, or null.
    • getExpireAfterWrite

      long getExpireAfterWrite(long defaultValue)
      Convenience method that returns getExpireAfterWrite() if it is not null, otherwise returns the supplied defaultValue.
    • getFlushable

      @Nullable Boolean getFlushable()
      Returns:
      whether this cache can be flushed by the cache manager when desired, or null.
    • getFlushable

      boolean getFlushable(boolean defaultValue)
      Convenience method that returns getFlushable() if it is not null, otherwise returns the supplied defaultValue.
    • getLocal

      @Nullable Boolean getLocal()
      Returns:
      whether this cache should be local to the node (jvm) where the cache is created, or null.
    • getLocal

      boolean getLocal(boolean defaultValue)
      Convenience method that returns getLocal() if it is not null, otherwise returns the supplied defaultValue.
    • getMaxEntries

      @Nullable Integer getMaxEntries()
      Returns:
      the maximum number of entries in the cache, or null.
    • getMaxEntries

      int getMaxEntries(int defaultValue)
      Convenience method that returns getMaxEntries() if it is not null, otherwise returns the supplied defaultValue.
    • getReplicateAsynchronously

      @Nullable Boolean getReplicateAsynchronously()
      Returns:
      whether this cache should replicate asynchronously, or null.
    • getReplicateAsynchronously

      boolean getReplicateAsynchronously(boolean defaultValue)
      Convenience method that returns getReplicateAsynchronously() if it is not null, otherwise returns the supplied defaultValue.
    • getReplicateViaCopy

      @Nullable Boolean getReplicateViaCopy()
      Returns:
      whether this cache should replicate put and update operations by copying the relevant key and value across the wire, or null.
    • getReplicateViaCopy

      boolean getReplicateViaCopy(boolean defaultValue)
      Convenience method that returns getReplicateViaCopy() if it is not null, otherwise returns the supplied defaultValue.
    • getStatisticsEnabled

      @Nullable Boolean getStatisticsEnabled()
      Returns:
      whether this cache should record statistics or not, or null.
    • getStatisticsEnabled

      boolean getStatisticsEnabled(boolean defaultValue)
      Convenience method that returns getStatisticsEnabled() ()} if it is not null, otherwise returns the supplied defaultValue.
    • override

      @Nonnull CacheSettings override(@Nonnull CacheSettings overrides)
      Returns a new CacheSettings instance where the current settings are overridden with settings specified in overrides. Only properties in overrides that are not null will be applied.
      Parameters:
      overrides - contains the settings to override
      Returns:
      a new CacheSettings instance with the overrides settings applied.