|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.terracotta.cache.impl.MutableConfig
public class MutableConfig
Initialized with default configuration values. The default values are:
| Constructor Summary | |
|---|---|
MutableConfig()
|
|
MutableConfig(String name,
boolean loggingEnabled,
int maxTTISeconds,
int maxTTLSeconds,
boolean orphanEvictionEnabled,
int orphanEvictionPeriod,
int targetMaxInMemoryCount,
int targetMaxTotalCount,
CapacityEvictionPolicyData.Factory capacityEvictionPolicyDataFactory)
|
|
| Method Summary | ||
|---|---|---|
void |
addConfigChangeListener(ConfigChangeListener ccl)
Register listener for changes in the config |
|
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 |
isLoggingEnabled()
Return true if distributed cache logging is enabled |
|
boolean |
isOrphanEvictionEnabled()
Indicates whether orphan eviction is turned on. |
|
|
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 a config listener |
|
CacheConfig |
setCapacityEvictionPolicyDataFactory(CapacityEvictionPolicyData.Factory factory)
Set the CapacityEvictionPolicyData.Factory to use for creating CapacityEvictionPolicyData |
|
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. |
|
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 |
| 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)
| 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 reconstitued 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 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 reconstitued 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 void waitForChange(long maxWait)
CacheConfigmaxWait milliseconds then the method will return regardless.
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 | |||||||||