final class LettuceRedisConnection<K,V> extends Object implements Connection, StatefulRedisConnection<K,V>
StatefulRedisConnection
.
This classes requires a release handle, used when a close is requested.
Instead of actually closing the StatefulRedisConnection
, the
release handle is called.Modifier and Type | Method and Description |
---|---|
RedisAsyncCommands<K,V> |
async() |
void |
close() |
CompletableFuture<Void> |
closeAsync() |
(package private) static <K,V> LettuceRedisConnection<K,V> |
create(StatefulRedisConnection<K,V> connection,
Consumer<StatefulRedisConnection<K,V>> releaseHandle) |
Collection<RedisCommand<K,V,?>> |
dispatch(Collection<? extends RedisCommand<K,V,?>> redisCommands) |
<T> RedisCommand<K,V,T> |
dispatch(RedisCommand<K,V,T> command) |
void |
flushCommands() |
ClientOptions |
getOptions() |
ClientResources |
getResources() |
Duration |
getTimeout() |
boolean |
isMulti() |
boolean |
isOpen() |
boolean |
isValid(long timeOut,
TimeUnit unit)
Pings the Redis server provided by
RedisDatabase.uri() |
RedisReactiveCommands<K,V> |
reactive() |
void |
reset() |
void |
setAutoFlushCommands(boolean autoFlush) |
void |
setTimeout(Duration timeout) |
void |
setTimeout(long timeout,
TimeUnit unit) |
RedisCommands<K,V> |
sync() |
static <K,V> LettuceRedisConnection<K,V> create(StatefulRedisConnection<K,V> connection, Consumer<StatefulRedisConnection<K,V>> releaseHandle)
connection
- the redis connectionreleaseHandle
- the consumer to be executed when close is requestedpublic boolean isValid(long timeOut, TimeUnit unit)
RedisDatabase.uri()
Creates a new RedisClient
based on the RedisDatabase.uri()
and sends a
BaseRedisCommands.ping()
command to verify that the server is reachable
isValid
in interface Connection
timeOut
- The time to wait for the database operation used to validate the connection to complete.unit
- time unit of timeOut
public void close() throws DatabaseException
close
in interface StatefulConnection<K,V>
close
in interface Connection
close
in interface AutoCloseable
DatabaseException
public CompletableFuture<Void> closeAsync()
closeAsync
in interface StatefulConnection<K,V>
closeAsync
in interface AsyncCloseable
public boolean isMulti()
isMulti
in interface StatefulRedisConnection<K,V>
public RedisCommands<K,V> sync()
sync
in interface StatefulRedisConnection<K,V>
public RedisAsyncCommands<K,V> async()
async
in interface StatefulRedisConnection<K,V>
public RedisReactiveCommands<K,V> reactive()
reactive
in interface StatefulRedisConnection<K,V>
public void setTimeout(Duration timeout)
setTimeout
in interface StatefulConnection<K,V>
public void setTimeout(long timeout, TimeUnit unit)
setTimeout
in interface StatefulConnection<K,V>
public Duration getTimeout()
getTimeout
in interface StatefulConnection<K,V>
public <T> RedisCommand<K,V,T> dispatch(RedisCommand<K,V,T> command)
dispatch
in interface StatefulConnection<K,V>
public Collection<RedisCommand<K,V,?>> dispatch(Collection<? extends RedisCommand<K,V,?>> redisCommands)
dispatch
in interface StatefulConnection<K,V>
public boolean isOpen()
isOpen
in interface StatefulConnection<K,V>
public ClientOptions getOptions()
getOptions
in interface StatefulConnection<K,V>
public ClientResources getResources()
getResources
in interface StatefulConnection<K,V>
public void reset()
reset
in interface StatefulConnection<K,V>
public void setAutoFlushCommands(boolean autoFlush)
setAutoFlushCommands
in interface StatefulConnection<K,V>
public void flushCommands()
flushCommands
in interface StatefulConnection<K,V>
Copyright © 2021. All rights reserved.