Class RedisGetSetClient

java.lang.Object
services.moleculer.util.redis.AbstractRedisClient
services.moleculer.util.redis.RedisGetSetClient

public final class RedisGetSetClient extends AbstractRedisClient
Promise-based get/set Redis client.
  • Constructor Details

    • RedisGetSetClient

      public RedisGetSetClient(String[] urls, String password, boolean secure, ExecutorService executor, io.lettuce.core.event.EventBus eventBus)
  • Method Details

    • connect

      public final void connect()
      Overrides:
      connect in class AbstractRedisClient
    • get

      public final io.datatree.Promise get(String key)
      Gets a content by a key.
      Parameters:
      key - cache key
      Returns:
      Promise with cached value (or null, the returned Promise also can be null)
    • set

      public final io.datatree.Promise set(String key, byte[] value, io.lettuce.core.SetArgs args)
      Sets a content by key.
      Parameters:
      key - cache key
      value - new value
      args - Redis arguments (eg. TTL)
      Returns:
      Promise with empty value
    • del

      public final io.datatree.Promise del(String key)
      Deletes a content with the specified key.
      Parameters:
      key - cache key
      Returns:
      Promise with empty value
    • clean

      public final io.datatree.Promise clean(String match, AtomicLong counter)
      Deletes a group of items. Removes every key by a match string.
      Parameters:
      match - regex
      counter - counter of deleted records
      Returns:
      Promise with empty value
    • getCacheKeys

      public io.datatree.Promise getCacheKeys(io.datatree.Tree keys)
    • disconnect

      public final io.datatree.Promise disconnect()
      Overrides:
      disconnect in class AbstractRedisClient