|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.terracotta.toolkit.builder.ToolkitCacheConfigBuilder
public final class ToolkitCacheConfigBuilder
A helper to build a Configuration
for ToolkitCache
. Builds up configuration based on
ToolkitConfigFields
Constructor Summary | |
---|---|
ToolkitCacheConfigBuilder()
|
Method Summary | |
---|---|
protected void |
addFieldToApply(String name,
Serializable value)
|
void |
apply(ToolkitCache cache)
Applies the current changes from the builder to the ToolkitCache . |
void |
apply(ToolkitStore store)
Apply changes of this builder to the ToolkitStore parameter. |
Configuration |
build()
Builds a Configuration for ToolkitCache by filling in appropriate mappings. |
ToolkitCacheConfigBuilder |
compressionEnabled(boolean compressionEnabledParam)
Sets compression enabled |
ToolkitCacheConfigBuilder |
concurrency(int concurrencyParam)
Sets the concurrency config to the new value and returns this |
ToolkitCacheConfigBuilder |
configField(String fieldName,
Serializable value)
|
ToolkitCacheConfigBuilder |
consistency(ToolkitConfigFields.Consistency consistencyParam)
Sets the ToolkitConfigFields.Consistency of the key-value store |
ToolkitCacheConfigBuilder |
copyOnReadEnabled(boolean copyOnReadEnabledParam)
Sets copy on read enabled |
ToolkitCacheConfigBuilder |
evictionEnabled(boolean evictionEnabledParam)
Sets eviction enabled/disabled |
int |
getConcurrency()
Concurrency of the store |
ToolkitConfigFields.Consistency |
getConsistency()
Getter for consistency |
long |
getMaxBytesLocalHeap()
Gets the max bytes local heap |
long |
getMaxBytesLocalOffheap()
Gets the max bytes local offheap |
long |
getMaxCountLocalHeap()
Gets the max count local heap |
int |
getMaxTotalCount()
Returns max total count |
int |
getMaxTTISeconds()
Max TTI in seconds for the map. |
int |
getMaxTTLSeconds()
Max TTL in seconds for the map. |
boolean |
isCompressionEnabled()
Compression enabled or not getter |
boolean |
isCopyOnReadEnabled()
copy-on-read enabled or not getter |
boolean |
isEvictionEnabled()
Returns eviction enabled |
boolean |
isLocalCacheEnabled()
Query whether local cache is enabled or not |
boolean |
isOffheapEnabled()
Returns true if offheap is enabled |
boolean |
isPinnedInLocalMemory()
|
ToolkitCacheConfigBuilder |
localCacheEnabled(boolean localCacheEnabledParam)
Sets local cache enabled |
ToolkitCacheConfigBuilder |
maxBytesLocalHeap(long maxBytesLocalHeapParam)
Sets the maxBytesLocalHeap |
ToolkitCacheConfigBuilder |
maxBytesLocalOffheap(long maxBytesLocalOffheapParam)
Sets the max bytes local offheap |
ToolkitCacheConfigBuilder |
maxCountLocalHeap(int maxCountLocalHeapParam)
Sets the max count local heap |
ToolkitCacheConfigBuilder |
maxTotalCount(int maxTotalCountParam)
Sets max total count |
ToolkitCacheConfigBuilder |
maxTTISeconds(int maxTTISecondsParam)
Sets the TTI in seconds for the config to the new value and returns this. |
ToolkitCacheConfigBuilder |
maxTTLSeconds(int maxTTLSecondsParam)
Sets the TTL in seconds for the config to the new value and returns this. |
ToolkitCacheConfigBuilder |
offheapEnabled(boolean offheapEnabledParam)
Sets offheap enabled |
ToolkitCacheConfigBuilder |
pinnedInLocalMemory(boolean pinnedInLocalMemory)
Sets whether entries should be pinned in local memory |
protected void |
setCompressionEnabled(boolean compressionEnabledParam)
Sets compression enabled |
protected void |
setConcurrency(int concurrencyParam)
|
protected void |
setConfigField(String fieldName,
Serializable value)
|
protected void |
setConsistency(ToolkitConfigFields.Consistency consistencyParam)
Sets the ToolkitConfigFields.Consistency of the key-value store |
protected void |
setCopyOnReadEnabled(boolean copyOnReadEnabledParam)
Sets copy on read enabled |
protected void |
setLocalCacheEnabled(boolean localCacheEnabledParam)
Sets local cache enabled |
protected void |
setMaxBytesLocalHeap(long maxBytesLocalHeapParam)
Sets the maxBytesLocalHeap |
protected void |
setMaxBytesLocalOffheap(long maxBytesLocalOffheapParam)
Sets the max bytes local offheap |
protected void |
setMaxCountLocalHeap(int maxCountLocalHeapParam)
Sets the max count local heap |
protected void |
setOffheapEnabled(boolean offheapEnabledParam)
Sets offheap enabled |
void |
setPinnedInLocalMemory(boolean pinnedInLocalMemory)
Sets whether entries should be pinned in local memory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ToolkitCacheConfigBuilder()
Method Detail |
---|
public ToolkitCacheConfigBuilder concurrency(int concurrencyParam) throws IllegalArgumentException
this
concurrencyParam
- new value of concurrency.
IllegalArgumentException
- for non-positive concurrency paramspublic ToolkitCacheConfigBuilder consistency(ToolkitConfigFields.Consistency consistencyParam)
ToolkitConfigFields.Consistency
of the key-value store
public ToolkitCacheConfigBuilder maxBytesLocalHeap(long maxBytesLocalHeapParam) throws IllegalArgumentException
IllegalArgumentException
- for negative valuespublic ToolkitCacheConfigBuilder maxBytesLocalOffheap(long maxBytesLocalOffheapParam) throws IllegalArgumentException
IllegalArgumentException
- for negative valuespublic ToolkitCacheConfigBuilder maxCountLocalHeap(int maxCountLocalHeapParam) throws IllegalArgumentException
IllegalArgumentException
- for negative valuespublic ToolkitCacheConfigBuilder offheapEnabled(boolean offheapEnabledParam)
public ToolkitCacheConfigBuilder localCacheEnabled(boolean localCacheEnabledParam)
public ToolkitCacheConfigBuilder compressionEnabled(boolean compressionEnabledParam)
public ToolkitCacheConfigBuilder copyOnReadEnabled(boolean copyOnReadEnabledParam)
public ToolkitCacheConfigBuilder pinnedInLocalMemory(boolean pinnedInLocalMemory)
public int getMaxTTISeconds()
public ToolkitCacheConfigBuilder maxTTISeconds(int maxTTISecondsParam) throws IllegalArgumentException
IllegalArgumentException
- for negative parameterspublic int getMaxTTLSeconds()
public ToolkitCacheConfigBuilder maxTTLSeconds(int maxTTLSecondsParam) throws IllegalArgumentException
IllegalArgumentException
- for negative parameterspublic int getMaxTotalCount()
public ToolkitCacheConfigBuilder maxTotalCount(int maxTotalCountParam) throws IllegalArgumentException
IllegalArgumentException
- for negative parameterspublic boolean isEvictionEnabled()
public ToolkitCacheConfigBuilder evictionEnabled(boolean evictionEnabledParam)
public ToolkitCacheConfigBuilder configField(String fieldName, Serializable value)
public Configuration build()
Configuration
for ToolkitCache
by filling in appropriate mappings. Only adds mappings for
values which were set explicitly in this builder, and doesn’t fills in default values in the returned config.
Consult ToolkitConfigFields
, ToolkitConfigFields
for the various configs supported and its default
values
public void apply(ToolkitCache cache)
ToolkitCache
. The changes are the ones between each
apply.
protected void addFieldToApply(String name, Serializable value)
public int getConcurrency()
public ToolkitConfigFields.Consistency getConsistency()
ToolkitConfigFields.Consistency
of the key-value storepublic long getMaxBytesLocalHeap()
public long getMaxBytesLocalOffheap()
public long getMaxCountLocalHeap()
public boolean isOffheapEnabled()
public boolean isLocalCacheEnabled()
public boolean isCompressionEnabled()
public void setPinnedInLocalMemory(boolean pinnedInLocalMemory)
public boolean isPinnedInLocalMemory()
public boolean isCopyOnReadEnabled()
protected void setConcurrency(int concurrencyParam) throws IllegalArgumentException
IllegalArgumentException
protected void setConsistency(ToolkitConfigFields.Consistency consistencyParam)
ToolkitConfigFields.Consistency
of the key-value store
protected void setMaxBytesLocalHeap(long maxBytesLocalHeapParam) throws IllegalArgumentException
IllegalArgumentException
- for negative valuesprotected void setMaxBytesLocalOffheap(long maxBytesLocalOffheapParam) throws IllegalArgumentException
IllegalArgumentException
- for negative valuesprotected void setMaxCountLocalHeap(int maxCountLocalHeapParam) throws IllegalArgumentException
IllegalArgumentException
- for negative valuesprotected void setOffheapEnabled(boolean offheapEnabledParam)
protected void setLocalCacheEnabled(boolean localCacheEnabledParam)
protected void setCompressionEnabled(boolean compressionEnabledParam)
protected void setCopyOnReadEnabled(boolean copyOnReadEnabledParam)
protected void setConfigField(String fieldName, Serializable value)
public void apply(ToolkitStore store)
ToolkitStore
parameter. The changes are the ones between each apply.
If the store's configuration has ToolkitConfigFields.MAX_BYTES_LOCAL_HEAP_FIELD_NAME
property set then
AbstractToolkitStoreCacheConfigBuilder.setMaxCountLocalHeap(int)
would result in an error.
If the store's configuration has ToolkitConfigFields.MAX_COUNT_LOCAL_HEAP_FIELD_NAME
property set then
AbstractToolkitStoreCacheConfigBuilder.setMaxBytesLocalHeap(long)
would result in an error.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |