Module lettuce.core

Interface StatefulRedisConnection<K,​V>

Type Parameters:
K - Key type.
V - Value type.
All Superinterfaces:
AsyncCloseable, AutoCloseable, StatefulConnection<K,​V>
All Known Subinterfaces:
StatefulRedisClusterPubSubConnection<K,​V>, StatefulRedisMasterReplicaConnection<K,​V>, StatefulRedisMasterSlaveConnection<K,​V>, StatefulRedisPubSubConnection<K,​V>
All Known Implementing Classes:
StatefulRedisConnectionImpl, StatefulRedisPubSubConnectionImpl

public interface StatefulRedisConnection<K,​V>
extends StatefulConnection<K,​V>
A thread-safe connection to a redis server. Multiple threads may share one StatefulRedisConnection. A ConnectionWatchdog monitors each connection and reconnects automatically until StatefulConnection.close() is called. All pending commands will be (re)sent after successful reconnection.
Since:
4.0
Author:
Mark Paluch
  • Method Details

    • isMulti

      boolean isMulti()
      Returns:
      true, if the connection is within a transaction.
    • sync

      RedisCommands<K,​V> sync()
      Returns the RedisCommands API for the current connection. Does not create a new connection.
      Returns:
      the synchronous API for the underlying connection.
    • async

      RedisAsyncCommands<K,​V> async()
      Returns the RedisAsyncCommands API for the current connection. Does not create a new connection.
      Returns:
      the asynchronous API for the underlying connection.
    • reactive

      RedisReactiveCommands<K,​V> reactive()
      Returns the RedisReactiveCommands API for the current connection. Does not create a new connection.
      Returns:
      the reactive API for the underlying connection.
    • addListener

      void addListener​(PushListener listener)
      Add a new listener to consume push messages.
      Parameters:
      listener - the listener, must not be null.
      Since:
      6.0
    • removeListener

      void removeListener​(PushListener listener)
      Remove an existing listener.
      Parameters:
      listener - the listener, must not be null.
      Since:
      6.0