Package org.springframework.data.keyvalue.redis.connection

Examples of org.springframework.data.keyvalue.redis.connection.RedisConnection


   */
  public <T> T execute(RedisCallback<T> action, boolean exposeConnection, boolean pipeline) {
    Assert.notNull(action, "Callback object must not be null");

    RedisConnectionFactory factory = getConnectionFactory();
    RedisConnection conn = RedisConnectionUtils.getConnection(factory);

    boolean existingConnection = TransactionSynchronizationManager.hasResource(factory);
    preProcessConnection(conn, existingConnection);

    boolean pipelineStatus = conn.isPipelined();
    if (pipeline && !pipelineStatus) {
      conn.openPipeline();
    }

    try {
      RedisConnection connToExpose = (exposeConnection ? conn : createRedisConnectionProxy(conn));
      T result = action.doInRedis(connToExpose);
      // TODO: any other connection processing?
      return postProcessResult(result, conn, existingConnection);
    } finally {
      try {
View Full Code Here


    }

    if (log.isDebugEnabled())
      log.debug("Opening RedisConnection");

    RedisConnection conn = factory.getConnection();

    boolean synchronizationActive = TransactionSynchronizationManager.isSynchronizationActive();

    if (bind || synchronizationActive) {
      connHolder = new RedisConnectionHolder(conn);
View Full Code Here

   * @param factory Redis factory
   */
  public static void unbindConnection(RedisConnectionFactory factory) {
    RedisConnectionHolder connHolder = (RedisConnectionHolder) TransactionSynchronizationManager.unbindResourceIfPossible(factory);
    if (connHolder != null) {
      RedisConnection connection = connHolder.getConnection();
      connection.close();
    }
  }
View Full Code Here

*/
public class SessionTest {

  @Test
  public void testSession() throws Exception {
    final RedisConnection conn = mock(RedisConnection.class);
    RedisConnectionFactory factory = mock(RedisConnectionFactory.class);

    when(factory.getConnection()).thenReturn(conn);
    final StringRedisTemplate template = new StringRedisTemplate(factory);

View Full Code Here

    ConnectionFactoryTracker.add(factory);
  }

  @After
  public void stop() {
    RedisConnection connection = factory.getConnection();
    connection.flushDb();
    connection.close();
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.keyvalue.redis.connection.RedisConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.