Interface RedisClient<A,B>

Type Parameters:
A - key type
B - value type
All Superinterfaces:
RedisGeoReactiveOperations<A,B>, RedisHashReactiveOperations<A,B>, RedisHLLReactiveOperations<A,B>, RedisKeyReactiveOperations<A,B>, RedisListReactiveOperations<A,B>, RedisOperations<A,B>, RedisScriptingReactiveOperations<A,B>, RedisSetReactiveOperations<A,B>, RedisSortedSetReactiveOperations<A,B>, RedisStreamReactiveOperations<A,B>, RedisStringReactiveOperations<A,B>
All Known Subinterfaces:
RedisTransactionalClient<A,B>
All Known Implementing Classes:
io.inverno.mod.redis.lettuce.internal.AbstractRedisClient, PoolRedisClient, PoolRedisClusterClient

public interface RedisClient<A,B> extends RedisOperations<A,B>

A Redis Client exposes reactive methods to query a Redis datastore.

Since:
1.4
Author:
Jeremy Kuhn
  • Method Details

    • connection

      <T> Publisher<T> connection(Function<RedisOperations<A,B>,Publisher<T>> function)

      Executes queries on a single connection.

      All Redis operations performed within the function using the Redis operations argument will be executed on the same connection.

      The connection is obtained when the returned publisher is subscribed and closed when it terminates (complete, error or cancel).

      Whether connections are reused (pool) or created is implementation specific.

      Type Parameters:
      T - The type of results
      Parameters:
      function - the function to be run using a single connection
      Returns:
      a publisher
    • batch

      <T> Publisher<T> batch(Function<RedisOperations<A,B>,Publisher<Publisher<T>>> function)

      Executes multiple queries in a batch on a single connection.

      The specified function shall return queries publishers created from the Redis operations argument, these queries are then pipelined on a single Redis connection, defering the flush of queries over the network.

      A connection is obtained when the returned publisher is subscribed and closed when it terminates (complete, error or cancel).

      Whether connections are reused (pool) or created is implementation specific.

      Type Parameters:
      T - the type of results
      Parameters:
      function - a function returning queries to execute in a batch
      Returns:
      a publisher of results
    • close

      Mono<Void> close()

      Closes the Redis client and free resources.

      Returns:
      a Mono that completes when the client is closed