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.intgetCodec()longgetName()intintintlongintintintlongbooleanSetsMapLoaderobject.loaderAsync(MapLoaderAsync<K, V> loaderAsync) SetsMapLoaderAsyncobject.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.DefinesMapWriterobject which is invoked during write operation.writerAsync(MapWriterAsync<K, V> writer) DefinesMapWriterAsyncobject which is invoked during write operation.writeRetryAttempts(int writerRetryAttempts) Sets max retry attempts forRetryableMapWriterorRetryableMapWriterAsyncwriteRetryInterval(Duration writerRetryInterval) Sets write retry intervalMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.redisson.api.options.CodecOptions
codecMethods inherited from interface org.redisson.api.options.ExMapOptions
loader, loaderAsync, writeBehindBatchSize, writeBehindDelay, writeMode, writer, writerAsync, writeRetryAttempts, writeRetryIntervalMethods 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
0then local cache is unbounded.If size is
-1then local cache is always empty and doesn't store data.- Specified by:
cacheSizein 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:
reconnectionStrategyin 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:
syncStrategyin 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:
evictionPolicyin 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 to0then timeout is not applied- Specified by:
timeToLivein 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 to0then timeout is not applied- Specified by:
maxIdlein interfaceLocalCachedMapOptions<K,V> - Parameters:
idleTime- time to live in milliseconds- Returns:
- LocalCachedMapOptions instance
-
getStoreMode
-
storeMode
Defines store mode of cache data.- Specified by:
storeModein 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:
cacheProviderin 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:
storeCacheMissin 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:
useKeyEventsPatternin 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:LocalCachedMapOptionsDefines how to listen expired event sent by Redis upon this instance deletion.- Specified by:
expirationEventPolicyin interfaceLocalCachedMapOptions<K,V> - Parameters:
expirationEventPolicy- expiration policy value- Returns:
- LocalCachedMapOptions instance
-
getExpirationEventPolicy
-
getName
-
writer
Description copied from interface:ExMapOptionsDefinesMapWriterobject which is invoked during write operation.- Specified by:
writerin interfaceExMapOptions<T extends ExMapOptions<T,K, V>, K, V> - Parameters:
writer- object- Returns:
- MapOptions instance
-
getWriter
-
writerAsync
Description copied from interface:ExMapOptionsDefinesMapWriterAsyncobject which is invoked during write operation.- Specified by:
writerAsyncin interfaceExMapOptions<T extends ExMapOptions<T,K, V>, K, V> - Parameters:
writer- object- Returns:
- MapOptions instance
-
getWriterAsync
-
writeBehindBatchSize
Description copied from interface:ExMapOptionsSets write behind tasks batch size. All updates accumulated into a batch of specified size and written withMapWriter.Default is
50- Specified by:
writeBehindBatchSizein 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:ExMapOptionsSets write behind tasks execution delay. All updates written withMapWriterand lag not more than specified delay.Default is
1000milliseconds- Specified by:
writeBehindDelayin 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:ExMapOptionsSets write mode.Default is
WriteMode.WRITE_THROUGH- Specified by:
writeModein 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 forRetryableMapWriterorRetryableMapWriterAsync- Specified by:
writeRetryAttemptsin interfaceExMapOptions<T extends ExMapOptions<T,K, V>, K, V> - Parameters:
writerRetryAttempts- object- Returns:
- MapOptions instance
-
getWriteRetryInterval
public long getWriteRetryInterval() -
writeRetryInterval
Description copied from interface:ExMapOptionsSets write retry interval- Specified by:
writeRetryIntervalin interfaceExMapOptions<T extends ExMapOptions<T,K, V>, K, V> - Parameters:
writerRetryInterval-Duration- Returns:
- MapOptions instance
-
loader
SetsMapLoaderobject.- Specified by:
loaderin interfaceExMapOptions<T extends ExMapOptions<T,K, V>, K, V> - Parameters:
loader- object- Returns:
- MapOptions instance
-
getLoader
-
loaderAsync
Description copied from interface:ExMapOptionsSetsMapLoaderAsyncobject.- Specified by:
loaderAsyncin interfaceExMapOptions<T extends ExMapOptions<T,K, V>, K, V> - Parameters:
loaderAsync- object- Returns:
- MapOptions instance
-
getLoaderAsync
-
codec
Description copied from interface:CodecOptionsDefines codec used for data stored in Redis- Specified by:
codecin interfaceCodecOptions<T extends InvocationOptions<T>,C> - Parameters:
codec- applied to object instance- Returns:
- options object
-
timeout
Description copied from interface:InvocationOptionsDefines 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:
timeoutin interfaceInvocationOptions<T extends InvocationOptions<T>>- Parameters:
timeout- Redis server response timeout- Returns:
- options instance
-
retryAttempts
Description copied from interface:InvocationOptionsDefines command retry attempts. Error is thrown if the Redis command can't be sent to Redis server afterretryAttempts. But if it sent successfully thenresponseTimeoutis started.Default is the value specified for the same parameter in Redisson configuration
- Specified by:
retryAttemptsin interfaceInvocationOptions<T extends InvocationOptions<T>>- Parameters:
retryAttempts- command retry attempts- Returns:
- options instance
-
retryInterval
Description copied from interface:InvocationOptionsDefines time interval for another one attempt to send a Redis command if it hasn't already been sent.- Specified by:
retryIntervalin interfaceInvocationOptions<T extends InvocationOptions<T>>- Parameters:
interval- retry time interval- Returns:
- options instance
-
getTimeout
public int getTimeout()- Specified by:
getTimeoutin interfaceObjectParams
-
getRetryAttempts
public int getRetryAttempts()- Specified by:
getRetryAttemptsin interfaceObjectParams
-
getRetryInterval
public int getRetryInterval()- Specified by:
getRetryIntervalin interfaceObjectParams
-
getCodec
-