public abstract class RedisConnectionUtils extends Object
RedisConnection handling, allowing for reuse of instances within
'transactions'/scopes.| Constructor and Description |
|---|
RedisConnectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static RedisConnection |
bindConnection(RedisConnectionFactory factory)
Binds a new Redis connection (from the given factory) to the current thread, if none is already bound.
|
static RedisConnection |
bindConnection(RedisConnectionFactory factory,
boolean transactionSupport)
Binds a new Redis connection (from the given factory) to the current thread, if none is already bound and enables
transaction support if
transactionSupport is set to true. |
static RedisConnection |
doGetConnection(RedisConnectionFactory factory,
boolean allowCreate,
boolean bind,
boolean transactionSupport)
Gets a Redis connection.
|
static RedisConnection |
getConnection(RedisConnectionFactory factory)
Gets a Redis connection from the given factory.
|
static RedisConnection |
getConnection(RedisConnectionFactory factory,
boolean transactionSupport)
Gets a Redis connection from the given factory.
|
static boolean |
isConnectionTransactional(RedisConnection conn,
RedisConnectionFactory connFactory)
Return whether the given Redis connection is transactional, that is, bound to the current thread by Spring's
transaction facilities.
|
static void |
releaseConnection(RedisConnection conn,
RedisConnectionFactory factory)
Deprecated.
since 2.1.10, use
releaseConnection(RedisConnection, RedisConnectionFactory, boolean) instead. |
static void |
releaseConnection(RedisConnection conn,
RedisConnectionFactory factory,
boolean transactionSupport)
Closes the given connection, created via the given factory if not managed externally (i.e. not bound to the
thread).
|
static void |
unbindConnection(RedisConnectionFactory factory)
Unbinds and closes the connection (if any) associated with the given factory.
|
public static RedisConnection bindConnection(RedisConnectionFactory factory)
factory - connection factorypublic static RedisConnection bindConnection(RedisConnectionFactory factory, boolean transactionSupport)
transactionSupport is set to true.factory - connection factory.transactionSupport - whether transaction support is enabled.public static RedisConnection getConnection(RedisConnectionFactory factory)
factory - connection factory for creating the connection.public static RedisConnection getConnection(RedisConnectionFactory factory, boolean transactionSupport)
factory - connection factory for creating the connection.transactionSupport - whether transaction support is enabled.public static RedisConnection doGetConnection(RedisConnectionFactory factory, boolean allowCreate, boolean bind, boolean transactionSupport)
allowCreate is true.factory - connection factory for creating the connection.allowCreate - whether a new (unbound) connection should be created when no connection can be found for the
current thread.bind - binds the connection to the thread, in case one was created-transactionSupport - whether transaction support is enabled.@Deprecated public static void releaseConnection(@Nullable RedisConnection conn, RedisConnectionFactory factory)
releaseConnection(RedisConnection, RedisConnectionFactory, boolean) instead.conn - the Redis connection to close.factory - the Redis factory that the connection was created with.public static void releaseConnection(@Nullable RedisConnection conn, RedisConnectionFactory factory, boolean transactionSupport)
conn - the Redis connection to close.factory - the Redis factory that the connection was created with.transactionSupport - whether transaction support is enabled.public static void unbindConnection(RedisConnectionFactory factory)
factory - Redis factorypublic static boolean isConnectionTransactional(RedisConnection conn, RedisConnectionFactory connFactory)
conn - Redis connection to checkconnFactory - Redis connection factory that the connection was created withCopyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.