Interface LocalCachedMapOptions<K,V>

Type Parameters:
K - key type
V - value type
All Superinterfaces:
CodecOptions<LocalCachedMapOptions<K,V>,Codec>, ExMapOptions<LocalCachedMapOptions<K,V>,K,V>, InvocationOptions<LocalCachedMapOptions<K,V>>
All Known Implementing Classes:
LocalCachedMapParams

public interface LocalCachedMapOptions<K,V> extends ExMapOptions<LocalCachedMapOptions<K,V>,K,V>
RLocalCachedMap instance options.
Author:
Nikita Koksharov
  • Method Details

    • name

      static <K, V> LocalCachedMapOptions<K,V> name(String name)
      Creates options with the name of object instance
      Parameters:
      name - of object instance
      Returns:
      options instance
    • cacheSize

      LocalCachedMapOptions<K,V> cacheSize(int 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.

      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 otherwise

      NONE - 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 change

      UPDATE - Insert/update cache entry across all LocalCachedMap instances on map entry change

      NONE - 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

      LocalCachedMapOptions<K,V> timeToLive(Duration ttl)
      Defines time to live in milliseconds of each map entry in local cache. If value equals to 0 then timeout is not applied
      Parameters:
      ttl - - time to live in milliseconds
      Returns:
      LocalCachedMapOptions instance
    • maxIdle

      LocalCachedMapOptions<K,V> maxIdle(Duration idleTime)
      Defines max idle time in milliseconds of each map entry in local cache. If value equals to 0 then 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

      LocalCachedMapOptions<K,V> storeCacheMiss(boolean 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 LocalCachedMapOptions<K,V> useKeyEventsPattern(boolean useKeyEventsPattern)
      Deprecated.
      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