Class LocalCachedMapParams<K,V>
- Type Parameters:
K
- key typeV
- value type
- All Implemented Interfaces:
CodecOptions<LocalCachedMapOptions<K,
,V>, Codec> ExMapOptions<LocalCachedMapOptions<K,
,V>, K, V> InvocationOptions<LocalCachedMapOptions<K,
,V>> LocalCachedMapOptions<K,
,V> ObjectParams
- Author:
- Nikita Koksharov
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.redisson.api.options.LocalCachedMapOptions
LocalCachedMapOptions.CacheProvider, LocalCachedMapOptions.EvictionPolicy, LocalCachedMapOptions.ExpirationEventPolicy, LocalCachedMapOptions.ReconnectionStrategy, LocalCachedMapOptions.StoreMode, LocalCachedMapOptions.SyncStrategy
-
Method Summary
Modifier and TypeMethodDescriptioncacheProvider
(LocalCachedMapOptions.CacheProvider cacheProvider) Defines Cache provider used as local cache store.cacheSize
(int cacheSize) Defines local cache size.Defines codec used for data stored in RedisevictionPolicy
(LocalCachedMapOptions.EvictionPolicy evictionPolicy) Defines local cache eviction policy.expirationEventPolicy
(LocalCachedMapOptions.ExpirationEventPolicy expirationEventPolicy) Defines how to listen expired event sent by Redis upon this instance deletion.int
getCodec()
long
getName()
int
int
int
long
int
int
int
long
boolean
SetsMapLoader
object.loaderAsync
(MapLoaderAsync<K, V> loaderAsync) SetsMapLoaderAsync
object.Defines max idle time in milliseconds of each map entry in local cache.reconnectionStrategy
(LocalCachedMapOptions.ReconnectionStrategy reconnectionStrategy) Defines strategy for load missed local cache updates after Redis connection failure.retryAttempts
(int retryAttempts) Defines command retry attempts.retryInterval
(Duration interval) Defines time interval for another one attempt to send a Redis command if it hasn't already been sent.storeCacheMiss
(boolean storeCacheMiss) Defines whether to store a cache miss into the local cache.storeMode
(LocalCachedMapOptions.StoreMode storeMode) Defines store mode of cache data.syncStrategy
(LocalCachedMapOptions.SyncStrategy syncStrategy) Defines local cache synchronization strategy.Defines Redis server response timeout.timeToLive
(Duration ttl) Defines time to live in milliseconds of each map entry in local cache.useKeyEventsPattern
(boolean useKeyEventsPattern) Defines whether to use __keyevent pattern topic to listen for expired events.writeBehindBatchSize
(int writeBehindBatchSize) Sets write behind tasks batch size.writeBehindDelay
(int writeBehindDelay) Sets write behind tasks execution delay.Sets write mode.DefinesMapWriter
object which is invoked during write operation.writerAsync
(MapWriterAsync<K, V> writer) DefinesMapWriterAsync
object which is invoked during write operation.writeRetryAttempts
(int writerRetryAttempts) Sets max retry attempts forRetryableMapWriter
orRetryableMapWriterAsync
writeRetryInterval
(Duration writerRetryInterval) Sets write retry intervalMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.redisson.api.options.CodecOptions
codec
Methods inherited from interface org.redisson.api.options.ExMapOptions
loader, loaderAsync, writeBehindBatchSize, writeBehindDelay, writeMode, writer, writerAsync, writeRetryAttempts, writeRetryInterval
Methods inherited from interface org.redisson.api.options.InvocationOptions
retryAttempts, retryInterval, timeout
-
Method Details
-
getCacheProvider
-
getEvictionPolicy
-
getCacheSize
public int getCacheSize() -
getTimeToLiveInMillis
public long getTimeToLiveInMillis() -
getMaxIdleInMillis
public long getMaxIdleInMillis() -
cacheSize
Defines local cache size.If size is
0
then local cache is unbounded.If size is
-1
then local cache is always empty and doesn't store data.- Specified by:
cacheSize
in interfaceLocalCachedMapOptions<K,
V> - Parameters:
cacheSize
- size of cache- Returns:
- LocalCachedMapOptions instance
-
getReconnectionStrategy
-
getSyncStrategy
-
reconnectionStrategy
public LocalCachedMapParams<K,V> reconnectionStrategy(LocalCachedMapOptions.ReconnectionStrategy reconnectionStrategy) Defines strategy for load missed local cache updates after Redis connection failure.- Specified by:
reconnectionStrategy
in interfaceLocalCachedMapOptions<K,
V> - Parameters:
reconnectionStrategy
-CLEAR
- clear local cache if map instance has been disconnected for a while.LOAD
- store invalidated entry hash in invalidation log for 10 minutes. Cache keys for stored invalidated entry hashes will be removed if LocalCachedMap instance has been disconnected less than 10 minutes or whole cache will be cleaned otherwiseNONE
- Default. No reconnection handling- Returns:
- LocalCachedMapOptions instance
-
syncStrategy
Defines local cache synchronization strategy.- Specified by:
syncStrategy
in interfaceLocalCachedMapOptions<K,
V> - Parameters:
syncStrategy
-INVALIDATE
- Default. Invalidate cache entry across all LocalCachedMap instances on map entry changeUPDATE
- Insert/update cache entry across all LocalCachedMap instances on map entry changeNONE
- No synchronizations on map changes- Returns:
- LocalCachedMapOptions instance
-
evictionPolicy
public LocalCachedMapParams<K,V> evictionPolicy(LocalCachedMapOptions.EvictionPolicy evictionPolicy) Defines local cache eviction policy.- Specified by:
evictionPolicy
in interfaceLocalCachedMapOptions<K,
V> - Parameters:
evictionPolicy
-LRU
- uses local cache with LRU (least recently used) eviction policy.LFU
- uses local cache with LFU (least frequently used) eviction policy.SOFT
- uses local cache with soft references. The garbage collector will evict items from the local cache when the JVM is running out of memory.WEAK
- uses local cache with weak references. The garbage collector will evict items from the local cache when it became weakly reachable.NONE
- doesn't use eviction policy, but timeToLive and maxIdleTime params are still working.- Returns:
- LocalCachedMapOptions instance
-
timeToLive
Defines time to live in milliseconds of each map entry in local cache. If value equals to0
then timeout is not applied- Specified by:
timeToLive
in interfaceLocalCachedMapOptions<K,
V> - Parameters:
ttl
- time to live in milliseconds- Returns:
- LocalCachedMapOptions instance
-
maxIdle
Defines max idle time in milliseconds of each map entry in local cache. If value equals to0
then timeout is not applied- Specified by:
maxIdle
in interfaceLocalCachedMapOptions<K,
V> - Parameters:
idleTime
- time to live in milliseconds- Returns:
- LocalCachedMapOptions instance
-
getStoreMode
-
storeMode
Defines store mode of cache data.- Specified by:
storeMode
in interfaceLocalCachedMapOptions<K,
V> - Parameters:
storeMode
-LOCALCACHE
- store data in local cache only.LOCALCACHE_REDIS
- store data in both Redis and local cache.- Returns:
- LocalCachedMapOptions instance
-
cacheProvider
Defines Cache provider used as local cache store.- Specified by:
cacheProvider
in interfaceLocalCachedMapOptions<K,
V> - Parameters:
cacheProvider
-REDISSON
- uses Redisson own implementation.CAFFEINE
- uses Caffeine implementation.- Returns:
- LocalCachedMapOptions instance
-
isStoreCacheMiss
public boolean isStoreCacheMiss() -
storeCacheMiss
Defines whether to store a cache miss into the local cache.- Specified by:
storeCacheMiss
in interfaceLocalCachedMapOptions<K,
V> - Parameters:
storeCacheMiss
- - whether to store a cache miss into the local cache- Returns:
- LocalCachedMapOptions instance
-
useKeyEventsPattern
Defines whether to use __keyevent pattern topic to listen for expired events.- Specified by:
useKeyEventsPattern
in interfaceLocalCachedMapOptions<K,
V> - Parameters:
useKeyEventsPattern
- - whether to use __keyevent pattern topic- Returns:
- LocalCachedMapOptions instance
-
expirationEventPolicy
public LocalCachedMapOptions<K,V> expirationEventPolicy(LocalCachedMapOptions.ExpirationEventPolicy expirationEventPolicy) Description copied from interface:LocalCachedMapOptions
Defines how to listen expired event sent by Redis upon this instance deletion.- Specified by:
expirationEventPolicy
in interfaceLocalCachedMapOptions<K,
V> - Parameters:
expirationEventPolicy
- expiration policy value- Returns:
- LocalCachedMapOptions instance
-
getExpirationEventPolicy
-
getName
-
writer
Description copied from interface:ExMapOptions
DefinesMapWriter
object which is invoked during write operation.- Specified by:
writer
in interfaceExMapOptions<T extends ExMapOptions<T,
K, V>, K, V> - Parameters:
writer
- object- Returns:
- MapOptions instance
-
getWriter
-
writerAsync
Description copied from interface:ExMapOptions
DefinesMapWriterAsync
object which is invoked during write operation.- Specified by:
writerAsync
in interfaceExMapOptions<T extends ExMapOptions<T,
K, V>, K, V> - Parameters:
writer
- object- Returns:
- MapOptions instance
-
getWriterAsync
-
writeBehindBatchSize
Description copied from interface:ExMapOptions
Sets write behind tasks batch size. All updates accumulated into a batch of specified size and written withMapWriter
.Default is
50
- Specified by:
writeBehindBatchSize
in interfaceExMapOptions<T extends ExMapOptions<T,
K, V>, K, V> - Parameters:
writeBehindBatchSize
- size of batch- Returns:
- MapOptions instance
-
getWriteBehindBatchSize
public int getWriteBehindBatchSize() -
writeBehindDelay
Description copied from interface:ExMapOptions
Sets write behind tasks execution delay. All updates written withMapWriter
and lag not more than specified delay.Default is
1000
milliseconds- Specified by:
writeBehindDelay
in interfaceExMapOptions<T extends ExMapOptions<T,
K, V>, K, V> - Parameters:
writeBehindDelay
- delay in milliseconds- Returns:
- MapOptions instance
-
getWriteBehindDelay
public int getWriteBehindDelay() -
writeMode
Description copied from interface:ExMapOptions
Sets write mode.Default is
WriteMode.WRITE_THROUGH
- Specified by:
writeMode
in interfaceExMapOptions<T extends ExMapOptions<T,
K, V>, K, V> - Parameters:
writeMode
- write mode- Returns:
- MapOptions instance
-
getWriteMode
-
getWriteRetryAttempts
public int getWriteRetryAttempts() -
writeRetryAttempts
Sets max retry attempts forRetryableMapWriter
orRetryableMapWriterAsync
- Specified by:
writeRetryAttempts
in interfaceExMapOptions<T extends ExMapOptions<T,
K, V>, K, V> - Parameters:
writerRetryAttempts
- object- Returns:
- MapOptions instance
-
getWriteRetryInterval
public long getWriteRetryInterval() -
writeRetryInterval
Description copied from interface:ExMapOptions
Sets write retry interval- Specified by:
writeRetryInterval
in interfaceExMapOptions<T extends ExMapOptions<T,
K, V>, K, V> - Parameters:
writerRetryInterval
-Duration
- Returns:
- MapOptions instance
-
loader
SetsMapLoader
object.- Specified by:
loader
in interfaceExMapOptions<T extends ExMapOptions<T,
K, V>, K, V> - Parameters:
loader
- object- Returns:
- MapOptions instance
-
getLoader
-
loaderAsync
Description copied from interface:ExMapOptions
SetsMapLoaderAsync
object.- Specified by:
loaderAsync
in interfaceExMapOptions<T extends ExMapOptions<T,
K, V>, K, V> - Parameters:
loaderAsync
- object- Returns:
- MapOptions instance
-
getLoaderAsync
-
codec
Description copied from interface:CodecOptions
Defines codec used for data stored in Redis- Specified by:
codec
in interfaceCodecOptions<T extends InvocationOptions<T>,
C> - Parameters:
codec
- applied to object instance- Returns:
- options object
-
timeout
Description copied from interface:InvocationOptions
Defines Redis server response timeout. Starts to countdown when a Redis command was successfully sent.Default is the value specified for the same parameter in Redisson configuration
- Specified by:
timeout
in interfaceInvocationOptions<T extends InvocationOptions<T>>
- Parameters:
timeout
- Redis server response timeout- Returns:
- options instance
-
retryAttempts
Description copied from interface:InvocationOptions
Defines command retry attempts. Error is thrown if the Redis command can't be sent to Redis server afterretryAttempts
. But if it sent successfully thenresponseTimeout
is started.Default is the value specified for the same parameter in Redisson configuration
- Specified by:
retryAttempts
in interfaceInvocationOptions<T extends InvocationOptions<T>>
- Parameters:
retryAttempts
- command retry attempts- Returns:
- options instance
-
retryInterval
Description copied from interface:InvocationOptions
Defines time interval for another one attempt to send a Redis command if it hasn't already been sent.- Specified by:
retryInterval
in interfaceInvocationOptions<T extends InvocationOptions<T>>
- Parameters:
interval
- retry time interval- Returns:
- options instance
-
getTimeout
public int getTimeout()- Specified by:
getTimeout
in interfaceObjectParams
-
getRetryAttempts
public int getRetryAttempts()- Specified by:
getRetryAttempts
in interfaceObjectParams
-
getRetryInterval
public int getRetryInterval()- Specified by:
getRetryInterval
in interfaceObjectParams
-
getCodec
-