K - Key typeV - Value typepublic interface TriavaCacheConfiguration<K,V,B extends TriavaCacheConfiguration<K,V,B>>
extends javax.cache.configuration.CompleteConfiguration<K,V>
| Modifier and Type | Interface and Description |
|---|---|
static class |
TriavaCacheConfiguration.PropsType |
| Modifier and Type | Method and Description |
|---|---|
void |
addCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> listenerConfiguration) |
Properties |
asProperties(TriavaCacheConfiguration.PropsType propsType)
Returns a representation of the Configuration as Properties.
|
boolean |
equals(Object obj) |
Iterable<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> |
getCacheEntryListenerConfigurations() |
javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>> |
getCacheLoaderFactory() |
CacheWriteMode |
getCacheWriteMode() |
javax.cache.configuration.Factory<javax.cache.integration.CacheWriter<? super K,? super V>> |
getCacheWriterFactory() |
long |
getCleanUpIntervalMillis()
Returns the proposed cleanup interval in ms.
|
int |
getConcurrencyLevel() |
EvictionInterface<K,V> |
getEvictionClass() |
EvictionPolicy |
getEvictionPolicy() |
javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy> |
getExpiryPolicyFactory() |
HashImplementation |
getHashImplementation() |
String |
getId() |
JamPolicy |
getJamPolicy() |
Class<K> |
getKeyType() |
CacheLoader<K,V> |
getLoader() |
int |
getMapConcurrencyLevel() |
long |
getMaxCacheTime() |
long |
getMaxCacheTimeSpread() |
int |
getMaxElements() |
long |
getMaxIdleTime() |
boolean |
getStatistics()
Returns whether statistics are enabled
|
Class<V> |
getValueType() |
int |
hashCode() |
boolean |
isManagementEnabled() |
boolean |
isReadThrough() |
boolean |
isStatisticsEnabled() |
boolean |
isStoreByValue() |
boolean |
isStrictJSR107()
Returns whether the Cache behaves strictly JSR107 compliant
|
boolean |
isWriteThrough() |
void |
removeCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> listenerConfiguration) |
B |
setCacheLoaderFactory(javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>> loaderFactory) |
B |
setCacheWriteMode(CacheWriteMode writeMode) |
B |
setCacheWriterFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<? super K,? super V>> factory) |
B |
setCleanupInterval(int cleanupInterval,
TimeUnit timeUnit)
Sets the proposed cleanup interval for expiring cache entries.
|
B |
setConcurrencyLevel(int concurrencyLevel)
Sets the expected concurrency level.
|
B |
setEvictionClass(EvictionInterface<K,V> clazz)
Sets a custom eviction policy.
|
B |
setEvictionPolicy(EvictionPolicy evictionPolicy)
Sets the eviction policy, for example LFU or LRU.
|
B |
setExpiryPolicyFactory(javax.cache.configuration.Factory<? extends javax.cache.expiry.ExpiryPolicy> factory)
Sets the ExpiryPolicyFactory.
|
B |
setHashImplementation(HashImplementation hashImplementation)
Set the StorageBackend for the underlying ConcurrentMap.
|
B |
setId(String id)
Sets the id of this Cache.
|
B |
setJamPolicy(JamPolicy jamPolicy)
Sets the policy, how a Thread that calls put() will behave the cache is full.
|
void |
setKeyType(Class<K> keyType) |
B |
setLoader(CacheLoader<K,V> loader) |
B |
setManagement(boolean management)
Sets whether management should be enabled.
|
B |
setMaxCacheTime(int maxCacheTime,
int interval,
TimeUnit timeUnit)
Sets the interval within a cache entry expires.
|
B |
setMaxCacheTime(int maxCacheTime,
TimeUnit timeUnit)
Sets the default expiration time for entries in this cache.
|
B |
setMaxElements(int maxElements)
Sets the expected number of elements to be stored.
|
B |
setMaxIdleTime(int maxIdleTime,
TimeUnit timeUnit)
Sets the maximum time of an unused (idle) cache entry.
|
B |
setReadThrough(boolean isReadThrough) |
B |
setStatistics(boolean statistics)
Sets whether statistics should be gathered.
|
void |
setStrictJSR107(boolean strictJSR107) |
void |
setValueType(Class<V> valueType) |
B |
setWriteThrough(boolean isWriteThrough) |
StorageBackend<K,V> |
storageFactory() |
B setId(String id)
id - The cache nameB setMaxIdleTime(int maxIdleTime, TimeUnit timeUnit)
setExpiryPolicyFactory(Factory).maxIdleTime - The maximum timetimeUnit - The TimeUnit of maxIdleTimeB setMaxCacheTime(int maxCacheTime, int interval, TimeUnit timeUnit)
This method is useful for mass-inserts in the Cache, that should not expire at the same time (e.g. for resource reasons).
maxCacheTime - The minimum time to keep in secondsinterval - The size of the interval in secondstimeUnit - The TimeUnit of maxCacheTime and intervalB setMaxCacheTime(int maxCacheTime, TimeUnit timeUnit)
Cache.put(Object, Object, int, int, TimeUnit).maxCacheTime - The time to keep the value in secondstimeUnit - The TimeUnit of maxCacheTimeB setCleanupInterval(int cleanupInterval, TimeUnit timeUnit)
If you do not call this method, the default
cleanup interval is used. For JSR107 Caches this is 1 minute. For native Triava Caches this
is auto-optimized according to a fraction of getMaxIdleTime().
cleanupInterval - The eviction cleanup interval. 0 means auto-tuning.timeUnit - The TimeUnit of cleanupIntervalB setMaxElements(int maxElements)
getMaxElements(). Cache instances of unlimited size
EvictionPolicy.NONE will use this value only as a hint
for initially sizing the underlying storage structures.maxElements - The maximum number of elements to be storedB setConcurrencyLevel(int concurrencyLevel)
If not set, the default concurrencyLevel is 16, which should usually rarely create thread contention. If running with 12 cores (24 with hyperthreading) chances are not too high for contention. A note from the Java 6 API docs: "overestimates and underestimates within an order of magnitude do not usually have much noticeable impact."
For example, in a scenario where 150 Threads write concurrently via putIfAbsent(), only 12 Threads will actually run. As concurrencyLevel is 16, threads will usually rarely block. But in case of unlucky hash bucket distribution or if too many Threads get suspended during holding a lock, issues could arise. If the underlying ConcurrentMap uses unfair locks, it might even lead to thread starvation.
concurrencyLevel - The excpected number of application Threads that concurrently write to the CacheB setEvictionPolicy(EvictionPolicy evictionPolicy)
If you want to use a custom eviction strategy,
use setEvictionClass(EvictionInterface) instead.
evictionPolicy - The EvictionPolicyB setEvictionClass(EvictionInterface<K,V> clazz)
If you want to use a standard eviction strategy like LFU or LRU,
use setEvictionPolicy(EvictionPolicy) instead.
clazz - The instance that implements the eviction policyEvictionInterface<K,V> getEvictionClass()
B setHashImplementation(HashImplementation hashImplementation)
hashImplementation - The HashImplementationB setJamPolicy(JamPolicy jamPolicy)
JamPolicy has no effect on caches of unlimited size
EvictionPolicy}.NONE.jamPolicy - The JamPolicyboolean getStatistics()
B setStatistics(boolean statistics)
statistics - true, if you want to switch on statisticsB setManagement(boolean management)
management - true, if you want to switch on managementString getId()
long getMaxIdleTime()
long getMaxCacheTime()
long getMaxCacheTimeSpread()
long getCleanUpIntervalMillis()
setCleanupInterval(int, TimeUnit) for details on how the Cache uses this value.int getMaxElements()
setMaxElements(int)int getConcurrencyLevel()
int getMapConcurrencyLevel()
EvictionPolicy getEvictionPolicy()
HashImplementation getHashImplementation()
StorageBackend<K,V> storageFactory()
JamPolicy getJamPolicy()
void setKeyType(Class<K> keyType)
keyType - the required key typegetKeyType()void setValueType(Class<V> valueType)
valueType - the required value typegetValueType()boolean isStoreByValue()
CacheWriteMode getCacheWriteMode()
B setCacheWriteMode(CacheWriteMode writeMode)
Properties asProperties(TriavaCacheConfiguration.PropsType propsType)
propsType - If PropsType.CacheManager, the Cache specific properties (cacheName, cacheLoaderClass) are excludedB setLoader(CacheLoader<K,V> loader)
B setCacheLoaderFactory(javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>> loaderFactory)
B setCacheWriterFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<? super K,? super V>> factory)
B setReadThrough(boolean isReadThrough)
B setWriteThrough(boolean isWriteThrough)
CacheLoader<K,V> getLoader()
javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>> getCacheLoaderFactory()
javax.cache.configuration.Factory<javax.cache.integration.CacheWriter<? super K,? super V>> getCacheWriterFactory()
boolean isReadThrough()
boolean isWriteThrough()
boolean isStatisticsEnabled()
boolean isManagementEnabled()
boolean isStrictJSR107()
void setStrictJSR107(boolean strictJSR107)
Iterable<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> getCacheEntryListenerConfigurations()
javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy> getExpiryPolicyFactory()
B setExpiryPolicyFactory(javax.cache.configuration.Factory<? extends javax.cache.expiry.ExpiryPolicy> factory)
setMaxIdleTime(int, TimeUnit).factory - The factoryvoid addCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> listenerConfiguration)
Copyright © 2018 trivago. All rights reserved.