Package com.atlassian.cache
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 Summary
Modifier and TypeMethodDescriptionlonggetExpireAfterAccess(long defaultValue) Convenience method that returnsgetExpireAfterAccess()if it is notnull, otherwise returns the supplieddefaultValue.longgetExpireAfterWrite(long defaultValue) Convenience method that returnsgetExpireAfterWrite()if it is notnull, otherwise returns the supplieddefaultValue.booleangetFlushable(boolean defaultValue) Convenience method that returnsgetFlushable()if it is notnull, otherwise returns the supplieddefaultValue.getLocal()booleangetLocal(boolean defaultValue) Convenience method that returnsgetLocal()if it is notnull, otherwise returns the supplieddefaultValue.intgetMaxEntries(int defaultValue) Convenience method that returnsgetMaxEntries()if it is notnull, otherwise returns the supplieddefaultValue.booleangetReplicateAsynchronously(boolean defaultValue) Convenience method that returnsgetReplicateAsynchronously()if it is notnull, otherwise returns the supplieddefaultValue.booleangetReplicateViaCopy(boolean defaultValue) Convenience method that returnsgetReplicateViaCopy()if it is notnull, otherwise returns the supplieddefaultValue.booleangetStatisticsEnabled(boolean defaultValue) Convenience method that returnsgetStatisticsEnabled()()} if it is notnull, otherwise returns the supplieddefaultValue.override(CacheSettings overrides) Returns a newCacheSettingsinstance where the current settings are overridden with settings specified inoverrides.
-
Method Details
-
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 returnsgetExpireAfterAccess()if it is notnull, otherwise returns the supplieddefaultValue. -
getExpireAfterWrite
- Returns:
- how long to retain entries (in milliseconds) from when they were created, or
null.
-
getExpireAfterWrite
long getExpireAfterWrite(long defaultValue) Convenience method that returnsgetExpireAfterWrite()if it is notnull, otherwise returns the supplieddefaultValue. -
getFlushable
- Returns:
- whether this cache can be flushed by the cache manager when desired, or
null.
-
getFlushable
boolean getFlushable(boolean defaultValue) Convenience method that returnsgetFlushable()if it is notnull, otherwise returns the supplieddefaultValue. -
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 returnsgetLocal()if it is notnull, otherwise returns the supplieddefaultValue. -
getMaxEntries
- Returns:
- the maximum number of entries in the cache, or
null.
-
getMaxEntries
int getMaxEntries(int defaultValue) Convenience method that returnsgetMaxEntries()if it is notnull, otherwise returns the supplieddefaultValue. -
getReplicateAsynchronously
- Returns:
- whether this cache should replicate asynchronously, or
null.
-
getReplicateAsynchronously
boolean getReplicateAsynchronously(boolean defaultValue) Convenience method that returnsgetReplicateAsynchronously()if it is notnull, otherwise returns the supplieddefaultValue. -
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 returnsgetReplicateViaCopy()if it is notnull, otherwise returns the supplieddefaultValue. -
getStatisticsEnabled
- Returns:
- whether this cache should record statistics or not, or
null.
-
getStatisticsEnabled
boolean getStatisticsEnabled(boolean defaultValue) Convenience method that returnsgetStatisticsEnabled()()} if it is notnull, otherwise returns the supplieddefaultValue. -
override
Returns a newCacheSettingsinstance where the current settings are overridden with settings specified inoverrides. Only properties inoverridesthat are notnullwill be applied.- Parameters:
overrides- contains the settings to override- Returns:
- a new
CacheSettingsinstance with theoverridessettings applied.
-