K
- key typeV
- value typepublic class LocalCachedMapOptions<K,V> extends MapOptions<K,V>
Modifier and Type | Class and Description |
---|---|
static class |
LocalCachedMapOptions.EvictionPolicy |
static class |
LocalCachedMapOptions.InvalidationPolicy |
MapOptions.WriteMode
Modifier | Constructor and Description |
---|---|
protected |
LocalCachedMapOptions() |
protected |
LocalCachedMapOptions(LocalCachedMapOptions<K,V> copy) |
Modifier and Type | Method and Description |
---|---|
LocalCachedMapOptions<K,V> |
cacheSize(int cacheSize)
Sets cache size.
|
static <K,V> LocalCachedMapOptions<K,V> |
defaults()
Creates a new instance of LocalCachedMapOptions with default options.
|
LocalCachedMapOptions<K,V> |
evictionPolicy(LocalCachedMapOptions.EvictionPolicy evictionPolicy)
Sets eviction policy.
|
int |
getCacheSize() |
LocalCachedMapOptions.EvictionPolicy |
getEvictionPolicy() |
LocalCachedMapOptions.InvalidationPolicy |
getInvalidationPolicy() |
long |
getMaxIdleInMillis() |
long |
getTimeToLiveInMillis() |
LocalCachedMapOptions<K,V> |
invalidateEntryOnChange(boolean value)
Deprecated.
|
LocalCachedMapOptions<K,V> |
invalidationPolicy(LocalCachedMapOptions.InvalidationPolicy invalidationPolicy)
Sets entry invalidation policy.
|
LocalCachedMapOptions<K,V> |
loader(MapLoader<K,V> loader)
Sets
MapLoader object. |
LocalCachedMapOptions<K,V> |
maxIdle(long maxIdleInMillis)
Sets max idle time in milliseconds for each map entry in cache.
|
LocalCachedMapOptions<K,V> |
maxIdle(long maxIdle,
TimeUnit timeUnit)
Sets max idle time for each map entry in cache.
|
LocalCachedMapOptions<K,V> |
timeToLive(long timeToLiveInMillis)
Sets time to live in milliseconds for each map entry in cache.
|
LocalCachedMapOptions<K,V> |
timeToLive(long timeToLive,
TimeUnit timeUnit)
Sets time to live for each map entry in cache.
|
LocalCachedMapOptions<K,V> |
writeBehindThreads(int writeBehindThreads)
Sets threads amount used in write behind mode.
|
LocalCachedMapOptions<K,V> |
writeMode(MapOptions.WriteMode writeMode)
Sets write mode.
|
LocalCachedMapOptions<K,V> |
writer(MapWriter<K,V> writer)
Sets
MapWriter object. |
getLoader, getWriteBehindThreads, getWriteMode, getWriter
protected LocalCachedMapOptions()
protected LocalCachedMapOptions(LocalCachedMapOptions<K,V> copy)
public static <K,V> LocalCachedMapOptions<K,V> defaults()
This is equivalent to:
new LocalCachedMapOptions() .cacheSize(0).timeToLive(0).maxIdle(0) .evictionPolicy(EvictionPolicy.NONE) .invalidateEntryOnChange(true);
K
- key typeV
- value typepublic LocalCachedMapOptions.EvictionPolicy getEvictionPolicy()
public int getCacheSize()
public long getTimeToLiveInMillis()
public long getMaxIdleInMillis()
public LocalCachedMapOptions<K,V> cacheSize(int cacheSize)
0
then local cache is unbounded.cacheSize
- - size of cachepublic LocalCachedMapOptions.InvalidationPolicy getInvalidationPolicy()
public LocalCachedMapOptions<K,V> invalidationPolicy(LocalCachedMapOptions.InvalidationPolicy invalidationPolicy)
invalidationPolicy
- NONE
- no invalidation applied.
ON_CHANGE
- invalidation message which removes corresponding entry from cache
will be sent to all other RLocalCachedMap instances on each entry update/remove operation.
ON_CHANGE_WITH_CLEAR_ON_RECONNECT
- includes ON_CHANGE
policy
and clears local cache of current instance in case of reconnection to Redis.
@Deprecated public LocalCachedMapOptions<K,V> invalidateEntryOnChange(boolean value)
value
- - if true
then invalidation message which removes corresponding entry from cache
will be sent to all other RLocalCachedMap instances on each entry update/remove operation.
if false
then invalidation message won't be sentpublic LocalCachedMapOptions<K,V> evictionPolicy(LocalCachedMapOptions.EvictionPolicy evictionPolicy)
evictionPolicy
- LRU
- uses cache with LRU (least recently used) eviction policy.
LFU
- uses cache with LFU (least frequently used) eviction policy.
SOFT
- uses cache with soft references. The garbage collector will evict items from the cache when the JVM is running out of memory.
NONE
- doesn't use eviction policy, but timeToLive and maxIdleTime params are still working.
public LocalCachedMapOptions<K,V> timeToLive(long timeToLiveInMillis)
0
then timeout is not appliedtimeToLiveInMillis
- - time to live in millisecondspublic LocalCachedMapOptions<K,V> timeToLive(long timeToLive, TimeUnit timeUnit)
0
then timeout is not appliedtimeToLive
- - time to livetimeUnit
- - time unitpublic LocalCachedMapOptions<K,V> maxIdle(long maxIdleInMillis)
0
then timeout is not appliedmaxIdleInMillis
- - time to live in millisecondspublic LocalCachedMapOptions<K,V> maxIdle(long maxIdle, TimeUnit timeUnit)
0
then timeout is not appliedmaxIdle
- - max idle timetimeUnit
- - time unitpublic LocalCachedMapOptions<K,V> writer(MapWriter<K,V> writer)
MapOptions
MapWriter
object.writer
in class MapOptions<K,V>
writer
- objectpublic LocalCachedMapOptions<K,V> writeBehindThreads(int writeBehindThreads)
MapOptions
Default is 1
writeBehindThreads
in class MapOptions<K,V>
writeBehindThreads
- - threads amountpublic LocalCachedMapOptions<K,V> writeMode(MapOptions.WriteMode writeMode)
MapOptions
Default is MapOptions.WriteMode.WRITE_THROUGH
writeMode
in class MapOptions<K,V>
writeMode
- - write modepublic LocalCachedMapOptions<K,V> loader(MapLoader<K,V> loader)
MapOptions
MapLoader
object.loader
in class MapOptions<K,V>
loader
- objectCopyright © 2014–2017 The Redisson Project. All rights reserved.