|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface CacheConfig
Defines the configuration for a DistributedCache. Most parameters can be changed dynamically after the cache is constructed. Exceptions will be noted in the javadoc for the property.
Config implementations are permitted to return out-of-date results from getters; that is, a change made to a
DynamicConfig may not immediately be visible. This permits clustered Configs to be accessed without locking. In order
to ensure that values are up to date, the user should periodically call refresh().
| Method Summary | ||
|---|---|---|
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. |
|
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 factory)
Set the CapacityEvictionPolicyData.Factory to use for creating CapacityEvictionPolicyData |
|
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 |
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. |
|
| Method Detail |
|---|
String getName()
CacheConfig setName(String name)
name - Distributed cache instance name
IllegalStateException - If called after cache is constructedint getMaxTTISeconds()
CacheConfig setMaxTTISeconds(int maxTTISeconds)
Set 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.
maxTTISeconds - Max TTI in seconds, must be >= 0, 0 = no TTI
int getMaxTTLSeconds()
boolean isServerMap()
CacheConfig setServerMap(boolean serverMap)
CacheConfig setMaxTTLSeconds(int maxTTLSeconds)
Set 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.
maxTTLSeconds - Max TTL in seconds, must be >= 0, 0 = no TTL
boolean isLoggingEnabled()
CacheConfig setLoggingEnabled(boolean loggingEnabled)
loggingEnabled - Change logging to on (true) or off (false)
boolean isOrphanEvictionEnabled()
CacheConfig setOrphanEvictionEnabled(boolean orphanEvictionEnabled)
isOrphanEvictionEnabled()int getOrphanEvictionPeriod()
CacheConfig setOrphanEvictionPeriod(int orphanEvictionPeriod)
int getTargetMaxInMemoryCount()
Get 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.
CacheConfig setTargetMaxInMemoryCount(int targetMaxInMemoryCount)
Set 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.
targetMaxInMemoryCount - Target max in-memory count, must be >= 0, 0 = no max
int getTargetMaxTotalCount()
Get 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.
CacheConfig setTargetMaxTotalCount(int targetMaxTotalCount)
Set 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.
targetMaxTotalCount - Target max total count, >= 0, 0 = no max
<K,V> DistributedCache<K,V> newCache()
K - Key typeV - Value type
boolean refresh()
true if the config has changed due to the refreshvoid 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
maxWait - maximum time to wait (in milliseconds)CapacityEvictionPolicyData.Factory getCapacityEvictionPolicyDataFactory()
CacheConfig setCapacityEvictionPolicyDataFactory(CapacityEvictionPolicyData.Factory factory)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||