Package io.lettuce.core.api
Interface StatefulRedisConnection<K,V>
-
- Type Parameters:
K
- Key type.V
- Value type.
- All Superinterfaces:
AsyncCloseable
,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 oneStatefulRedisConnection
. AConnectionWatchdog
monitors each connection and reconnects automatically untilStatefulConnection.close()
is called. All pending commands will be (re)sent after successful reconnection.- Since:
- 4.0
- Author:
- Mark Paluch
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addListener(PushListener listener)
Add a newlistener
to consume push messages.RedisAsyncCommands<K,V>
async()
Returns theRedisAsyncCommands
API for the current connection.boolean
isMulti()
RedisReactiveCommands<K,V>
reactive()
Returns theRedisReactiveCommands
API for the current connection.void
removeListener(PushListener listener)
Remove an existinglistener
.RedisCommands<K,V>
sync()
Returns theRedisCommands
API for the current connection.-
Methods inherited from interface io.lettuce.core.api.StatefulConnection
addListener, close, closeAsync, dispatch, dispatch, flushCommands, getOptions, getResources, getTimeout, isOpen, removeListener, reset, setAutoFlushCommands, setTimeout
-
-
-
-
Method Detail
-
isMulti
boolean isMulti()
- Returns:
- true, if the connection is within a transaction.
-
sync
RedisCommands<K,V> sync()
Returns theRedisCommands
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 theRedisAsyncCommands
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 theRedisReactiveCommands
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 newlistener
to consume push messages.- Parameters:
listener
- the listener, must not benull
.- Since:
- 6.0
-
removeListener
void removeListener(PushListener listener)
Remove an existinglistener
.- Parameters:
listener
- the listener, must not benull
.- Since:
- 6.0
-
-