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
Deprecated.
|
static class |
LocalCachedMapOptions.ReconnectionStrategy
Various strategies to avoid stale objects in cache.
|
static class |
LocalCachedMapOptions.SyncStrategy |
MapOptions.WriteMode
Modifier | Constructor and Description |
---|---|
protected |
LocalCachedMapOptions() |
protected |
LocalCachedMapOptions(LocalCachedMapOptions<K,V> copy) |
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.ReconnectionStrategy getReconnectionStrategy()
public LocalCachedMapOptions.SyncStrategy getSyncStrategy()
public LocalCachedMapOptions<K,V> reconnectionStrategy(LocalCachedMapOptions.ReconnectionStrategy reconnectionStrategy)
public LocalCachedMapOptions<K,V> syncStrategy(LocalCachedMapOptions.SyncStrategy syncStrategy)
@Deprecated public LocalCachedMapOptions<K,V> invalidationPolicy(LocalCachedMapOptions.InvalidationPolicy invalidationPolicy)
@Deprecated public LocalCachedMapOptions<K,V> invalidateEntryOnChange(boolean value)
public 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–2018 The Redisson Project. All rights reserved.