public interface LRUCachingMapConfiguration
Modifier and Type | Method and Description |
---|---|
long |
getCleanupIntervalTime()
How long interval between cleanup is performed by an internal thread.
|
long |
getExpireTime()
How many milliseconds a key may be in the cache per default, before it is removed from cache.
|
long |
getExtendTime()
When a Key is retrieved from the class via get(K key) the Key/Value pair can has it expire time extended.
|
int |
getMaxExtendCount()
How many times an Key/Value pair is allowed to be extended in expiretime.
|
int |
getMaxSize()
How many keys is maximum allowed in the class, if exceeded the oldest entries is removed until below maxSize.
|
boolean |
isPersistedValuesInMemory()
If the values for persisted LRUCachingMaps should be held in memory or not.
If false the values for persisted storage will have to retrieved from persisted storage for each get, if true all values is held in memory as well, this will have an effect on your memory usage. |
LRUCachingMapConfiguration |
setCleanupIntervalTime(long cleanupIntervalTime)
Set the cleanup interval in milliseconds.
|
LRUCachingMapConfiguration |
setExpireTime(long expireTime)
Set the expireTime for a key in milliseconds.
|
LRUCachingMapConfiguration |
setExtendTime(long extendTime)
How many milliseconds a "key"'s expire time is extended in milliseconds everytime is it "get" from a "LRUCachingMap".
|
LRUCachingMapConfiguration |
setMaxExtendCount(int maxExtendCount)
How many times a "key"'s expire time is allowed to be extended.
|
LRUCachingMapConfiguration |
setMaxSize(int maxSize)
The maximum number of elements in a LRUCachingMap before "cleanup" is performed to reduce the map size.
|
LRUCachingMapConfiguration |
setPersistedValuesInMemory(boolean persistedValuesInMemory)
If the values for persisted LRUCachingMaps should be held in memory or not.
If false the values for persisted storage will have to retrieved from persisted storage for each get, if true all values is held in memory as well, this will have an effect on your memory usage. |
long getCleanupIntervalTime()
long getExpireTime()
long getExtendTime()
int getMaxExtendCount()
int getMaxSize()
LRUCachingMapConfiguration setCleanupIntervalTime(long cleanupIntervalTime)
cleanupIntervalTime
- the cleanup interval in milliseconds, if ">0" an internal timer thread will handle this, otherwise you must handle this yourself.LRUCachingMap.cleanup()
is called.CleanupTimerRunnable
LRUCachingMapConfiguration setExpireTime(long expireTime) throws IllegalArgumentException
expireTime
- the expire time in milliseconds.IllegalArgumentException
- if expireTime is less than one.LRUCachingMapConfiguration setExtendTime(long extendTime)
extendTime
- how many milliseconds a key's expire time is extended in milliseconds everytime is it "get" from a "LRUCachingMap".LRUCachingMap.get(Object)
LRUCachingMapConfiguration setMaxExtendCount(int maxExtendCount)
maxExtendCount
- How many times a "key"'s expire time is allowed to be extended, if "<=0" than no expiration time extension is allowed.LRUCachingMapConfiguration setMaxSize(int maxSize)
maxSize
- the maximum number of keys allowed in the cache.LRUCachingMap.cleanup()
,
LRUCachingMap.getNextToExpire()
boolean isPersistedValuesInMemory()
false
the values for persisted storage will have to retrieved from persisted storage for each get, if true
all values is held in memory as well, this will have an effect on your memory usage.
Only applies for LRUCachingMap implementation which has persisted storage.LRUCachingMapConfiguration setPersistedValuesInMemory(boolean persistedValuesInMemory)
false
the values for persisted storage will have to retrieved from persisted storage for each get, if true
all values is held in memory as well, this will have an effect on your memory usage.
Only applies for LRUCachingMap implementation which has persisted storage.persistedValuesInMemory
- is persisted values held in memory.Copyright © 2016. All rights reserved.