|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.terracotta.cache.MutableConfig
public class MutableConfig
Initialized with default configuration values. The default values are:
| Field Summary | |
|---|---|
static String |
CAPACITY_EVICTION_POLICY_DATA_FACTORY
|
static String |
LOCAL_CACHE_ENABLED
|
static String |
LOGGING_ENABLED
|
static String |
MAX_TTI_SECONDS
|
static String |
MAX_TTL_SECONDS
|
static String |
NAME
|
static String |
ORPHAN_EVICTION_ENABLED
|
static String |
ORPHAN_EVICTION_PERIOD
|
static String |
TARGET_MAX_ENTRIES_LOCAL_HEAP
|
static String |
TARGET_MAX_TOTAL_COUNT
|
| Constructor Summary | |
|---|---|
MutableConfig()
Constructs a mutable cache configuration with all default values. |
|
MutableConfig(String name,
boolean loggingEnabled,
int maxTTISeconds,
int maxTTLSeconds,
boolean orphanEvictionEnabled,
int orphanEvictionPeriod,
int targetMaxInMemoryCount,
int targetMaxTotalCount,
CapacityEvictionPolicyData.Factory capacityEvictionPolicyDataFactory)
Constructs a mutable cache configuration with the given initial values. |
|
| Method Summary | ||
|---|---|---|
void |
addConfigChangeListener(ConfigChangeListener ccl)
Register the supplied listener to receive notifications when this configuration changes. |
|
boolean |
equals(Object o)
|
|
CapacityEvictionPolicyData.Factory |
getCapacityEvictionPolicyDataFactory()
Get the CapacityEvictionPolicyData.Factory to use for creating CapacityEvictionPolicyData |
|
int |
getMaxTTISeconds()
Max "time to idle" in seconds. |
|
int |
getMaxTTLSeconds()
Max "time to live" in seconds. |
|
String |
getName()
Get distributed cache name, used solely for logging, thread naming, and identification purposes. |
|
int |
getOrphanEvictionPeriod()
Get frequency at which orphan eviction will occur. |
|
int |
getTargetMaxInMemoryCount()
Get the current target for maximum in-memory number of entries. |
|
int |
getTargetMaxTotalCount()
Get the current target for maximum total number of entries. |
|
int |
hashCode()
|
|
void |
initializeOnLoad()
|
|
boolean |
isLocalCacheEnabled()
|
|
boolean |
isLoggingEnabled()
Return true if distributed cache logging is enabled |
|
boolean |
isOrphanEvictionEnabled()
Indicates whether orphan eviction is turned on. |
|
boolean |
isServerMap()
Returns true if Cache should have a server map backend |
|
|
newCache()
Construct a new cache instance based on the configuration changes specified in this instance of the builder so far. |
|
boolean |
refresh()
Take a new snapshot of the current state of the config. |
|
void |
removeConfigChangeListener(ConfigChangeListener ccl)
Remove the supplied listener from this configurations list of listeners. |
|
CacheConfig |
setCapacityEvictionPolicyDataFactory(CapacityEvictionPolicyData.Factory factory)
Set the CapacityEvictionPolicyData.Factory to use for creating CapacityEvictionPolicyData |
|
CacheConfig |
setLocalCacheEnabled(boolean localCacheEnabled)
|
|
MutableConfig |
setLoggingEnabled(boolean loggingEnabled)
Set distributed cache logging on or off. |
|
MutableConfig |
setMaxTTISeconds(int maxTTISeconds)
Set max "time to idle" in seconds. |
|
MutableConfig |
setMaxTTLSeconds(int maxTTLSeconds)
Set max "time to live" in seconds. |
|
MutableConfig |
setName(String name)
Set distributed cache name, used solely for logging and thread naming purposes. |
|
MutableConfig |
setOrphanEvictionEnabled(boolean orphanEvictionEnabled)
Turn orphan eviction on or off. |
|
MutableConfig |
setOrphanEvictionPeriod(int orphanEvictionPeriod)
Set frequency at which orphan eviction will occur. |
|
CacheConfig |
setServerMap(boolean serverMap)
Sets whether to use server map or not for the backend |
|
MutableConfig |
setTargetMaxInMemoryCount(int targetMaxInMemoryCount)
Set the current target for maximum in-memory number of entries. |
|
MutableConfig |
setTargetMaxTotalCount(int targetMaxTotalCount)
Set the current target for maximum total number of entries. |
|
void |
waitForChange(long maxWait)
Causes the current thread to wait for this configuration object to change. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String LOCAL_CACHE_ENABLED
public static final String CAPACITY_EVICTION_POLICY_DATA_FACTORY
public static final String TARGET_MAX_TOTAL_COUNT
public static final String TARGET_MAX_ENTRIES_LOCAL_HEAP
public static final String ORPHAN_EVICTION_PERIOD
public static final String ORPHAN_EVICTION_ENABLED
public static final String MAX_TTL_SECONDS
public static final String MAX_TTI_SECONDS
public static final String LOGGING_ENABLED
public static final String NAME
| Constructor Detail |
|---|
public MutableConfig()
public MutableConfig(String name,
boolean loggingEnabled,
int maxTTISeconds,
int maxTTLSeconds,
boolean orphanEvictionEnabled,
int orphanEvictionPeriod,
int targetMaxInMemoryCount,
int targetMaxTotalCount,
CapacityEvictionPolicyData.Factory capacityEvictionPolicyDataFactory)
name - the cache nameloggingEnabled - true if logging should be enabledmaxTTISeconds - maximum time-to-live in secondsmaxTTLSeconds - maximum time-to-idle in secondsorphanEvictionEnabled - true if orphan eviction should be enabledorphanEvictionPeriod - number of local eviction cycles between orphan evictionstargetMaxInMemoryCount - maximum number of local in-heap elementstargetMaxBytesLocalHeap - maximum bytes in local heaptargetMaxTotalCount - maximum number of elementscapacityEvictionPolicyDataFactory - factory for capacity eviction data types| Method Detail |
|---|
public void initializeOnLoad()
public String getName()
CacheConfig
getName in interface CacheConfigpublic int getMaxTTISeconds()
CacheConfig
getMaxTTISeconds in interface CacheConfigpublic int getMaxTTLSeconds()
CacheConfig
getMaxTTLSeconds in interface CacheConfigpublic boolean isOrphanEvictionEnabled()
CacheConfig
isOrphanEvictionEnabled in interface CacheConfigpublic int getOrphanEvictionPeriod()
CacheConfig
getOrphanEvictionPeriod in interface CacheConfigpublic boolean isLoggingEnabled()
CacheConfig
isLoggingEnabled in interface CacheConfigpublic int getTargetMaxInMemoryCount()
CacheConfigGet the current target for maximum in-memory number of entries. If the target is crossed, the evictor will start flushing values from the cache back to the Terracotta server array. "Flushing" is a Terracotta concept where an object reference is removed from a JVM but can be reconstituted from the Terracotta server state on demand. Flushed values are NOT evicted from the cache (although they are still eligible to be evicted for other reasons).
A value of 0 indicates that there is no in-memory limit.
getTargetMaxInMemoryCount in interface CacheConfigpublic int getTargetMaxTotalCount()
CacheConfigGet the current target for maximum total number of entries. If the target is crossed, items will be evicted from the cache. For eviction, a preference will be given to items that are not currently in use in any node - these are likely not recently used and also can be removed without causing a Terracotta "fault" into memory.
A value of 0 indicates that there is no limit.
getTargetMaxTotalCount in interface CacheConfigpublic CapacityEvictionPolicyData.Factory getCapacityEvictionPolicyDataFactory()
CacheConfig
getCapacityEvictionPolicyDataFactory in interface CacheConfigpublic boolean isServerMap()
CacheConfig
isServerMap in interface CacheConfigpublic boolean isLocalCacheEnabled()
public CacheConfig setServerMap(boolean serverMap)
CacheConfig
setServerMap in interface CacheConfigpublic MutableConfig setMaxTTISeconds(int maxTTISeconds)
CacheConfigSet max "time to idle" in seconds. If the Max TTI is dynamically changed from UNUSED (0) to some value, items in the cache may expire immediately.
The background eviction thread sleep interval is based on this value and the Max TTL, so a side effect of changing this value is to change the sleep interval of the eviction thread.
setMaxTTISeconds in interface CacheConfigmaxTTISeconds - Max TTI in seconds, must be >= 0, 0 = no TTI
public MutableConfig setMaxTTLSeconds(int maxTTLSeconds)
CacheConfigSet max "time to live" in seconds. If the Max TTL is dynamically changed from UNUSED (0) to some value, items in the cache may expire immediately.
The background eviction thread sleep interval is based on this value and the Max TTL, so a side effect of changing this value is to change the sleep interval of the eviction thread.
setMaxTTLSeconds in interface CacheConfigmaxTTLSeconds - Max TTL in seconds, must be >= 0, 0 = no TTL
public MutableConfig setOrphanEvictionEnabled(boolean orphanEvictionEnabled)
CacheConfig
setOrphanEvictionEnabled in interface CacheConfigCacheConfig.isOrphanEvictionEnabled()public MutableConfig setOrphanEvictionPeriod(int orphanEvictionPeriod)
CacheConfig
setOrphanEvictionPeriod in interface CacheConfigpublic MutableConfig setLoggingEnabled(boolean loggingEnabled)
CacheConfig
setLoggingEnabled in interface CacheConfigloggingEnabled - Change logging to on (true) or off (false)
public MutableConfig setTargetMaxInMemoryCount(int targetMaxInMemoryCount)
CacheConfigSet the current target for maximum in-memory number of entries. If the target is crossed, the evictor will start flushing values from the cache back to the Terracotta server array. "Flushing" is a Terracotta concept where an object reference is removed from a JVM but can be reconstituted from the Terracotta server state on demand. Flushed values are NOT evicted from the cache (although they are still eligible to be evicted for other reasons).
A value of 0 indicates that there is no in-memory limit.
setTargetMaxInMemoryCount in interface CacheConfigtargetMaxInMemoryCount - Target max in-memory count, must be >= 0, 0 = no max
public MutableConfig setTargetMaxTotalCount(int targetMaxTotalCount)
CacheConfigSet the current target for maximum total number of entries. If the target is crossed, items will be evicted from the cache. For eviction, a preference will be given to items that are not currently in use in any node - these are likely not recently used and also can be removed without causing a Terracotta "fault" into memory.
A value of 0 indicates that there is no limit.
setTargetMaxTotalCount in interface CacheConfigtargetMaxTotalCount - Target max total count, >= 0, 0 = no max
public MutableConfig setName(String name)
CacheConfig
setName in interface CacheConfigname - Distributed cache instance name
public CacheConfig setCapacityEvictionPolicyDataFactory(CapacityEvictionPolicyData.Factory factory)
CacheConfig
setCapacityEvictionPolicyDataFactory in interface CacheConfigpublic CacheConfig setLocalCacheEnabled(boolean localCacheEnabled)
public void waitForChange(long maxWait)
maxWait milliseconds then the method will return regardless.
This operation can be interrupted using Thread.interrupt(). The interrupt status of the thread will be set
on return from this method if interrupted. Interrupting this method will not throw InterruptedException
waitForChange in interface CacheConfigmaxWait - maximum time to wait (in milliseconds)public boolean refresh()
CacheConfig
refresh in interface CacheConfigtrue if the config has changed due to the refreshpublic <K,V> DistributedCache<K,V> newCache()
newCache in interface CacheConfigK - Key typeV - Value type
public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic void addConfigChangeListener(ConfigChangeListener ccl)
public void removeConfigChangeListener(ConfigChangeListener ccl)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||