@FunctionalInterface public interface LettuceConnectionProvider
connection
of on each invocation.
Connection providers may create a new connection on each invocation or return pooled instances. Each obtained
connection must be released through its connection provider to allow disposal or release back to the pool.
Connection providers are usually associated with a RedisCodec
to create connections
with an appropriate codec.StatefulConnection
Modifier and Type | Interface and Description |
---|---|
static interface |
LettuceConnectionProvider.TargetAware
Extension to
LettuceConnectionProvider for providers that allow connection creation to specific nodes. |
Modifier and Type | Method and Description |
---|---|
default <T extends io.lettuce.core.api.StatefulConnection<?,?>> |
getConnection(Class<T> connectionType)
Request a connection given
connectionType . |
<T extends io.lettuce.core.api.StatefulConnection<?,?>> |
getConnectionAsync(Class<T> connectionType)
Request asynchronously a connection given
connectionType . |
default void |
release(io.lettuce.core.api.StatefulConnection<?,?> connection)
Release the
connection . |
default CompletableFuture<Void> |
releaseAsync(io.lettuce.core.api.StatefulConnection<?,?> connection)
Release asynchronously the
connection . |
default <T extends io.lettuce.core.api.StatefulConnection<?,?>> T getConnection(Class<T> connectionType)
connectionType
. Providing a connection type allows specialization to provide a
more specific connection type.connectionType
- must not be null.released
if the connection is no
longer in use.<T extends io.lettuce.core.api.StatefulConnection<?,?>> CompletionStage<T> getConnectionAsync(Class<T> connectionType)
connectionType
. Providing a connection type allows specialization
to provide a more specific connection type.connectionType
- must not be null.CompletionStage
that is notified with the connection progress. Must be
released
if the connection is no longer in use.default void release(io.lettuce.core.api.StatefulConnection<?,?> connection)
connection
. Closes connection StatefulConnection.close()
by default.
Implementations may choose whether they override this method and return the connection to a pool.connection
- must not be null.default CompletableFuture<Void> releaseAsync(io.lettuce.core.api.StatefulConnection<?,?> connection)
connection
. Closes connection
StatefulConnection.closeAsync()
by default. Implementations may choose whether they override this method
and return the connection to a pool.connection
- must not be null.future
notified once the connection is released.Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.