templates.java.client.txt Maven / Gradle / Ivy
package redis.client;
import java.io.IOException;
import java.net.Socket;
import java.util.Collections;
import java.util.List;
import java.util.ArrayList;
import java.util.concurrent.Executors;
import com.google.common.base.Charsets;
import com.google.common.util.concurrent.ListenableFuture;
import redis.Command;
import redis.reply.BulkReply;
import redis.reply.IntegerReply;
import redis.reply.MultiBulkReply;
import redis.reply.Reply;
import redis.reply.StatusReply;
public class RedisClient extends RedisClientBase {
protected Pipeline pipeline = new Pipeline();
public RedisClient(String host, int port) throws IOException {
this(new Socket(host, port));
}
public RedisClient(Socket socket) throws IOException {
super(socket, Executors.newSingleThreadExecutor());
}
public Pipeline pipeline() {
return pipeline;
}
{{#commands}}
private static final String {{name}} = "{{name1}}";
{{#split_command}}
private static final String {{name}}2 = "{{name2}}";
private static final byte[] {{name}}2_BYTES = {{name}}2.getBytes(Charsets.US_ASCII);
{{/split_command}}
private static final byte[] {{name}}_BYTES = {{name}}.getBytes(Charsets.US_ASCII);
private static final int {{name}}_VERSION = parseVersion("{{version}}");
{{{{/return}}
{{$method}}pipeline{{/method}}
{{/method}}
{{/commands}}
}
}