
com.lambdaworks.redis.RedisAsyncConnection Maven / Gradle / Ivy
// Copyright (C) 2011 - Will Glozer. All rights reserved.
package com.lambdaworks.redis;
import com.lambdaworks.redis.codec.RedisCodec;
import com.lambdaworks.redis.protocol.*;
import java.util.ArrayList;
import java.util.List;
/**
* An asynchronous {@link RedisConnection} wrapper. All redis command methods
* with the exception of {@link #multi}, {@link #exec} and {@link #discard} will
* immediately return null and their output can be collected later via the
* {@link #flush} method.
*
* RedisAsyncConnections are not thread-safe and should only be used by a
* single thread.
*
* @author Will Glozer
*/
public class RedisAsyncConnection extends RedisConnection {
private RedisConnection parent;
private List> pipeline;
/**
* Initialize a new connection.
*
* @param codec Codec used to encode/decode keys and values.
* @param parent Parent connection.
*/
public RedisAsyncConnection(RedisCodec codec, RedisConnection parent) {
super(null, codec, 0, null);
this.parent = parent;
this.pipeline = new ArrayList>();
}
/**
* Wait for completion of all commands executed since the last flush
* and return their outputs.
*
* @return The command outputs.
*/
public List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy