Interface LocalCachedMapOptions<K,V>
- Type Parameters:
K- key typeV- value type
- All Superinterfaces:
CodecOptions<LocalCachedMapOptions<K,,V>, Codec> ExMapOptions<LocalCachedMapOptions<K,,V>, K, V> InvocationOptions<LocalCachedMapOptions<K,V>>
- All Known Implementing Classes:
LocalCachedMapParams
RLocalCachedMap instance options.- Author:
- Nikita Koksharov
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumstatic enumstatic enumstatic enumVarious strategies to avoid stale objects in local cache.static enumstatic enum -
Method Summary
Modifier and TypeMethodDescriptioncacheProvider(LocalCachedMapOptions.CacheProvider cacheProvider) Defines Cache provider used as local cache store.cacheSize(int cacheSize) Defines local cache size.evictionPolicy(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.Defines max idle time in milliseconds of each map entry in local cache.static <K,V> LocalCachedMapOptions <K, V> Creates options with the name of object instancereconnectionStrategy(LocalCachedMapOptions.ReconnectionStrategy reconnectionStrategy) Defines strategy for load missed local cache updates after Redis connection failure.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.timeToLive(Duration ttl) Defines time to live in milliseconds of each map entry in local cache.useKeyEventsPattern(boolean useKeyEventsPattern) Deprecated.useObjectAsCacheKey(boolean useObjectAsCacheKey) Defines whether to store CacheKey of an object key into the local cache.Methods 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
-
name
Creates options with the name of object instance- Parameters:
name- of object instance- Returns:
- options instance
-
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.- Parameters:
cacheSize- size of cache- Returns:
- LocalCachedMapOptions instance
-
reconnectionStrategy
LocalCachedMapOptions<K,V> reconnectionStrategy(LocalCachedMapOptions.ReconnectionStrategy reconnectionStrategy) Defines strategy for load missed local cache updates after Redis connection failure.- 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.- 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
Defines local cache eviction policy.- 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- 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- Parameters:
idleTime- time to live in milliseconds- Returns:
- LocalCachedMapOptions instance
-
storeMode
Defines store mode of cache data.- 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.- Parameters:
cacheProvider-REDISSON- uses Redisson own implementation.CAFFEINE- uses Caffeine implementation.- Returns:
- LocalCachedMapOptions instance
-
storeCacheMiss
Defines whether to store a cache miss into the local cache.- Parameters:
storeCacheMiss- - whether to store a cache miss into the local cache- Returns:
- LocalCachedMapOptions instance
-
useKeyEventsPattern
Deprecated.UseexpirationEventPolicy(ExpirationEventPolicy)instead- Parameters:
useKeyEventsPattern- - whether to use __keyevent pattern topic- Returns:
- LocalCachedMapOptions instance
-
expirationEventPolicy
LocalCachedMapOptions<K,V> expirationEventPolicy(LocalCachedMapOptions.ExpirationEventPolicy expirationEventPolicy) Defines how to listen expired event sent by Redis upon this instance deletion.- Parameters:
expirationEventPolicy- expiration policy value- Returns:
- LocalCachedMapOptions instance
-
useObjectAsCacheKey
Defines whether to store CacheKey of an object key into the local cache.
This indicator only affects whencacheProvider(CacheProvider)!= CAFFEINE- Parameters:
useObjectAsCacheKey- - whether to store CacheKey of an object key into the local cache- Returns:
- LocalCachedMapOptions instance
-