Class PoolRedisClient<A,B,C extends io.lettuce.core.api.StatefulRedisConnection<A,B>>

java.lang.Object
io.inverno.mod.redis.lettuce.internal.AbstractRedisClient<A,B,C>
io.inverno.mod.redis.lettuce.PoolRedisClient<A,B,C>
Type Parameters:
A - key type
B - value type
C - underlying connection type
All Implemented Interfaces:
RedisGeoReactiveOperations<A,B>, RedisHashReactiveOperations<A,B>, RedisHLLReactiveOperations<A,B>, RedisKeyReactiveOperations<A,B>, RedisListReactiveOperations<A,B>, RedisScriptingReactiveOperations<A,B>, RedisSetReactiveOperations<A,B>, RedisSortedSetReactiveOperations<A,B>, RedisStreamReactiveOperations<A,B>, RedisStringReactiveOperations<A,B>, RedisClient<A,B>, RedisOperations<A,B>, RedisTransactionalClient<A,B>

public class PoolRedisClient<A,B,C extends io.lettuce.core.api.StatefulRedisConnection<A,B>> extends io.inverno.mod.redis.lettuce.internal.AbstractRedisClient<A,B,C> implements RedisTransactionalClient<A,B>

A Lettuce pool Redis client wrapper.

This Redis client implementation supports transaction.

Since:
1.4
Author:
Jeremy Kuhn
  • Constructor Details

    • PoolRedisClient

      public PoolRedisClient(io.lettuce.core.support.AsyncPool<C> pool, Class<A> keyType, Class<B> valueType)

      Creates a Redis client with the specified Lettuce pool.

      Parameters:
      pool - an async pool
      keyType - the key type
      valueType - the value type
  • Method Details

    • operations

      protected Mono<io.inverno.mod.redis.lettuce.internal.operations.StatefulRedisConnectionOperations<A,B,C,?>> operations()
      Description copied from class: io.inverno.mod.redis.lettuce.internal.AbstractRedisClient

      Returns Redis Operations.

      Specified by:
      operations in class io.inverno.mod.redis.lettuce.internal.AbstractRedisClient<A,B,C extends io.lettuce.core.api.StatefulRedisConnection<A,B>>
      Returns:
      a mono emitting RedisOperations object
    • transactionalOperations

      protected Mono<io.inverno.mod.redis.lettuce.internal.operations.StatefulRedisConnectionTransactionalOperations<A,B,C,?>> transactionalOperations()

      Returns Redis transactional operations.

      Returns:
      a mono emitting RedisTransactionalOperations object
    • multi

      public Mono<RedisTransactionalOperations<A,B>> multi(A... watches)
      Description copied from interface: RedisTransactionalClient

      Starts a transaction block with the specified watches.

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

      The connection is obtained and the transaction started when the returned publisher is subscribed. The transaction MUST be explicitly executed or discarded in order to free resources.

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

      Specified by:
      multi in interface RedisTransactionalClient<A,B>
      Parameters:
      watches - a list of watches
      Returns:
      a mono emitting a transactional operations object
    • multi

      public Mono<RedisTransactionResult> multi(Function<RedisOperations<A,B>,Publisher<Publisher<?>>> function, A... watches)
      Description copied from interface: RedisTransactionalClient

      Executes queries in a transaction on a single connection.

      The specified function shall return queries publishers created from the Redis operations argument, these queries are then executed within a transaction on a single Redis connection.

      The connection is obtained and the transaction started when the returned publisher is subscribed. The transaction is executed when the returned operations publisher successfully completes or discarded when it completes with errors. The connection is eventually closed once the EXEX/DISCARD operation terminates.

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

      Specified by:
      multi in interface RedisTransactionalClient<A,B>
      Parameters:
      function - a function returning queries to execute in a transaction
      watches - a list of watches
      Returns:
      a mono emitting transaction result