|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.terracotta.cache.ImmutableConfig
public final class ImmutableConfig
An immutable configuration that can be handed to a DistributedMap implementation. It has no predefined
default configuration - hence all parameters must be supplied at construction.
| Constructor Summary | |
|---|---|
ImmutableConfig(CacheConfig config)
Constructs an immutable configuration as a value-based copy of the supplied configuration. |
|
ImmutableConfig(String name,
boolean loggingEnabled,
int maxTTISeconds,
int maxTTLSeconds,
boolean orphanEvictionEnabled,
int orphanEvictionPeriod,
int targetMaxInMemoryCount,
int targetMaxTotalCount,
CapacityEvictionPolicyData.Factory capacityEvictionPolicyDataFactory,
boolean serverMap)
Constructs an Immutable configuration with the given explicit properties. |
|
ImmutableConfig(String name,
boolean loggingEnabled,
int maxTTISeconds,
int maxTTLSeconds,
boolean orphanEvictionEnabled,
int orphanEvictionPeriod,
int targetMaxInMemoryCount,
int targetMaxTotalCount,
CapacityEvictionPolicyData.Factory capacityEvictionPolicyDataFactory,
boolean serverMap,
boolean localCacheEnabled)
Constructs an Immutable configuration with the given explicit properties. |
|
| Method Summary | ||
|---|---|---|
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()
|
|
boolean |
isEvictionEnabled()
|
|
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 cache instance based on this config's settings. |
|
boolean |
refresh()
Take a new snapshot of the current state of the config. |
|
CacheConfig |
setCapacityEvictionPolicyDataFactory(CapacityEvictionPolicyData.Factory type)
Set the CapacityEvictionPolicyData.Factory to use for creating CapacityEvictionPolicyData |
|
CacheConfig |
setLocalCacheEnabled(boolean localCacheEnabled)
|
|
CacheConfig |
setLoggingEnabled(boolean loggingEnabled)
Set distributed cache logging on or off. |
|
CacheConfig |
setMaxTTISeconds(int maxTTISeconds)
Set max "time to idle" in seconds. |
|
CacheConfig |
setMaxTTLSeconds(int maxTTLSeconds)
Set max "time to live" in seconds. |
|
CacheConfig |
setName(String name)
Set distributed cache name, used solely for logging and thread naming purposes. |
|
CacheConfig |
setOrphanEvictionEnabled(boolean orphanEvictionEnabled)
Turn orphan eviction on or off. |
|
CacheConfig |
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 |
|
CacheConfig |
setTargetMaxBytesLocalHeap(long maxBytesLocalHeap)
|
|
CacheConfig |
setTargetMaxInMemoryCount(int targetMaxInMemoryCount)
Set the current target for maximum in-memory number of entries. |
|
CacheConfig |
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 ImmutableConfig(String name,
boolean loggingEnabled,
int maxTTISeconds,
int maxTTLSeconds,
boolean orphanEvictionEnabled,
int orphanEvictionPeriod,
int targetMaxInMemoryCount,
int targetMaxTotalCount,
CapacityEvictionPolicyData.Factory capacityEvictionPolicyDataFactory,
boolean serverMap)
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 elementstargetMaxTotalCount - maximum number of elementscapacityEvictionPolicyDataFactory - factory for capacity eviction data typesserverMap - true if the DCV2 server side storage policy should be used
public ImmutableConfig(String name,
boolean loggingEnabled,
int maxTTISeconds,
int maxTTLSeconds,
boolean orphanEvictionEnabled,
int orphanEvictionPeriod,
int targetMaxInMemoryCount,
int targetMaxTotalCount,
CapacityEvictionPolicyData.Factory capacityEvictionPolicyDataFactory,
boolean serverMap,
boolean localCacheEnabled)
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 elementstargetMaxTotalCount - maximum number of elementscapacityEvictionPolicyDataFactory - factory for capacity eviction data typesserverMap - true if the DCV2 server side storage policy should be usedlocalCacheEnabled - true if local cache should be enabledpublic ImmutableConfig(CacheConfig config)
config - configuration to copy from| Method Detail |
|---|
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 boolean isEvictionEnabled()
public 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 boolean isServerMap()
CacheConfig
isServerMap in interface CacheConfigpublic boolean refresh()
CacheConfig
refresh in interface CacheConfigtrue if the config has changed due to the refreshpublic CapacityEvictionPolicyData.Factory getCapacityEvictionPolicyDataFactory()
CacheConfig
getCapacityEvictionPolicyDataFactory in interface CacheConfigpublic boolean isLocalCacheEnabled()
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 int hashCode()
hashCode in class Objectpublic boolean equals(Object o)
equals in class Objectpublic <K,V> DistributedCache<K,V> newCache()
CacheConfig
newCache in interface CacheConfigK - Key typeV - Value type
public CacheConfig setLoggingEnabled(boolean loggingEnabled)
CacheConfig
setLoggingEnabled in interface CacheConfigloggingEnabled - Change logging to on (true) or off (false)
public CacheConfig 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 CacheConfig 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 CacheConfig setName(String name)
CacheConfig
setName in interface CacheConfigname - Distributed cache instance name
public CacheConfig setOrphanEvictionEnabled(boolean orphanEvictionEnabled)
CacheConfig
setOrphanEvictionEnabled in interface CacheConfigCacheConfig.isOrphanEvictionEnabled()public CacheConfig setOrphanEvictionPeriod(int orphanEvictionPeriod)
CacheConfig
setOrphanEvictionPeriod in interface CacheConfigpublic CacheConfig 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 CacheConfig 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 CacheConfig setCapacityEvictionPolicyDataFactory(CapacityEvictionPolicyData.Factory type)
CacheConfig
setCapacityEvictionPolicyDataFactory in interface CacheConfigpublic CacheConfig setServerMap(boolean serverMap)
CacheConfig
setServerMap in interface CacheConfigpublic CacheConfig setLocalCacheEnabled(boolean localCacheEnabled)
public CacheConfig setTargetMaxBytesLocalHeap(long maxBytesLocalHeap)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||