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 enableTranactionSupport)
Binds a new Redis connection (from the given factory) to the current thread, if none is already bound and enables
transaction support if
enableTranactionSupport is set to true. |
static RedisConnection |
doGetConnection(RedisConnectionFactory factory,
boolean allowCreate,
boolean bind,
boolean enableTransactionSupport)
Gets a Redis connection.
|
static RedisConnection |
getConnection(RedisConnectionFactory factory)
Gets a Redis connection from the given factory.
|
static RedisConnection |
getConnection(RedisConnectionFactory factory,
boolean enableTranactionSupport)
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)
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 enableTranactionSupport)
enableTranactionSupport is set to true.factory - connection factoryenableTranactionSupport - public static RedisConnection getConnection(RedisConnectionFactory factory)
factory - connection factory for creating the connectionpublic static RedisConnection getConnection(RedisConnectionFactory factory, boolean enableTranactionSupport)
factory - connection factory for creating the connectionenableTranactionSupport - public static RedisConnection doGetConnection(RedisConnectionFactory factory, boolean allowCreate, boolean bind, boolean enableTransactionSupport)
allowCreate is true.factory - connection factory for creating the connectionallowCreate - whether a new (unbound) connection should be created when no connection can be found for the
current threadbind - binds the connection to the thread, in case one was createdenableTransactionSupport - public static void releaseConnection(RedisConnection conn, RedisConnectionFactory factory)
conn - the Redis connection to closefactory - the Redis factory that the connection was created withpublic 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 with