package redis.clients.jedis;
import redis.clients.jedis.BinaryClient.LIST_POSITION;
import redis.clients.jedis.params.sortedset.ZAddParams;
import redis.clients.jedis.params.sortedset.ZIncrByParams;
import redis.clients.util.KeyMergeUtil;
import redis.clients.jedis.params.geo.GeoRadiusParam;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
public class JedisCluster extends BinaryJedisCluster implements JedisCommands,
MultiKeyJedisClusterCommands, JedisClusterScriptingCommands {
public static enum Reset {
SOFT, HARD
}
public JedisCluster(Set nodes) {
this(nodes, DEFAULT_TIMEOUT);
}
public JedisCluster(Set nodes, int timeout) {
this(nodes, timeout, DEFAULT_MAX_REDIRECTIONS);
}
public JedisCluster(Set nodes, int timeout, int maxRedirections) {
this(nodes, timeout, maxRedirections, new GenericObjectPoolConfig());
}
public JedisCluster(Set nodes, final GenericObjectPoolConfig poolConfig) {
this(nodes, DEFAULT_TIMEOUT, DEFAULT_MAX_REDIRECTIONS, poolConfig);
}
public JedisCluster(Set nodes, int timeout, final GenericObjectPoolConfig poolConfig) {
this(nodes, timeout, DEFAULT_MAX_REDIRECTIONS, poolConfig);
}
public JedisCluster(Set nodes, int timeout, final GenericObjectPoolConfig poolConfig,String password) {
this(nodes, timeout, DEFAULT_MAX_REDIRECTIONS, poolConfig,password);
}
public JedisCluster(Set jedisClusterNode, int timeout, int maxRedirections,
final GenericObjectPoolConfig poolConfig) {
super(jedisClusterNode, timeout, maxRedirections, poolConfig);
}
public JedisCluster(Set jedisClusterNode, int timeout, int maxRedirections,
final GenericObjectPoolConfig poolConfig,String password) {
super(jedisClusterNode, timeout, maxRedirections, poolConfig,password);
}
public JedisCluster(Set jedisClusterNode, int connectionTimeout, int soTimeout,
int maxRedirections, final GenericObjectPoolConfig poolConfig) {
super(jedisClusterNode, connectionTimeout, soTimeout, maxRedirections, poolConfig);
}
@Override
public String set(final String key, final String value) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public String execute(Jedis connection) {
return connection.set(key, value);
}
}.run(key);
}
@Override
public String set(final String key, final String value, final String nxxx, final String expx,
final long time) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public String execute(Jedis connection) {
return connection.set(key, value, nxxx, expx, time);
}
}.run(key);
}
@Override
public String get(final String key) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public String execute(Jedis connection) {
return connection.get(key);
}
}.run(key);
}
@Override
public Boolean exists(final String key) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Boolean execute(Jedis connection) {
return connection.exists(key);
}
}.run(key);
}
@Override
public Long exists(final String... keys) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.exists(keys);
}
}.run(keys.length, keys);
}
@Override
public Long persist(final String key) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.persist(key);
}
}.run(key);
}
@Override
public String type(final String key) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public String execute(Jedis connection) {
return connection.type(key);
}
}.run(key);
}
@Override
public Long expire(final String key, final int seconds) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.expire(key, seconds);
}
}.run(key);
}
@Override
public Long pexpire(final String key, final long milliseconds) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.pexpire(key, milliseconds);
}
}.run(key);
}
@Override
public Long expireAt(final String key, final long unixTime) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.expireAt(key, unixTime);
}
}.run(key);
}
@Override
public Long pexpireAt(final String key, final long millisecondsTimestamp) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.pexpireAt(key, millisecondsTimestamp);
}
}.run(key);
}
@Override
public Long ttl(final String key) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.ttl(key);
}
}.run(key);
}
@Override
public Long pttl(final String key) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.pttl(key);
}
}.run(key);
}
@Override
public Boolean setbit(final String key, final long offset, final boolean value) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Boolean execute(Jedis connection) {
return connection.setbit(key, offset, value);
}
}.run(key);
}
@Override
public Boolean setbit(final String key, final long offset, final String value) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Boolean execute(Jedis connection) {
return connection.setbit(key, offset, value);
}
}.run(key);
}
@Override
public Boolean getbit(final String key, final long offset) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Boolean execute(Jedis connection) {
return connection.getbit(key, offset);
}
}.run(key);
}
@Override
public Long setrange(final String key, final long offset, final String value) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.setrange(key, offset, value);
}
}.run(key);
}
@Override
public String getrange(final String key, final long startOffset, final long endOffset) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public String execute(Jedis connection) {
return connection.getrange(key, startOffset, endOffset);
}
}.run(key);
}
@Override
public String getSet(final String key, final String value) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public String execute(Jedis connection) {
return connection.getSet(key, value);
}
}.run(key);
}
@Override
public Long setnx(final String key, final String value) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.setnx(key, value);
}
}.run(key);
}
@Override
public String setex(final String key, final int seconds, final String value) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public String execute(Jedis connection) {
return connection.setex(key, seconds, value);
}
}.run(key);
}
@Override
public String psetex(final String key, final long milliseconds, final String value) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public String execute(Jedis connection) {
return connection.psetex(key, milliseconds, value);
}
}.run(key);
}
@Override
public Long decrBy(final String key, final long integer) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.decrBy(key, integer);
}
}.run(key);
}
@Override
public Long decr(final String key) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.decr(key);
}
}.run(key);
}
@Override
public Long incrBy(final String key, final long integer) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.incrBy(key, integer);
}
}.run(key);
}
@Override
public Double incrByFloat(final String key, final double value) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Double execute(Jedis connection) {
return connection.incrByFloat(key, value);
}
}.run(key);
}
@Override
public Long incr(final String key) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.incr(key);
}
}.run(key);
}
@Override
public Long append(final String key, final String value) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.append(key, value);
}
}.run(key);
}
@Override
public String substr(final String key, final int start, final int end) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public String execute(Jedis connection) {
return connection.substr(key, start, end);
}
}.run(key);
}
@Override
public Long hset(final String key, final String field, final String value) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.hset(key, field, value);
}
}.run(key);
}
@Override
public String hget(final String key, final String field) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public String execute(Jedis connection) {
return connection.hget(key, field);
}
}.run(key);
}
@Override
public Long hsetnx(final String key, final String field, final String value) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.hsetnx(key, field, value);
}
}.run(key);
}
@Override
public String hmset(final String key, final Map hash) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public String execute(Jedis connection) {
return connection.hmset(key, hash);
}
}.run(key);
}
@Override
public List hmget(final String key, final String... fields) {
return new JedisClusterCommand>(connectionHandler, maxRedirections) {
@Override
public List execute(Jedis connection) {
return connection.hmget(key, fields);
}
}.run(key);
}
@Override
public Long hincrBy(final String key, final String field, final long value) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.hincrBy(key, field, value);
}
}.run(key);
}
@Override
public Double hincrByFloat(final String key, final String field, final double value) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Double execute(Jedis connection) {
return connection.hincrByFloat(key, field, value);
}
}.run(key);
}
@Override
public Boolean hexists(final String key, final String field) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Boolean execute(Jedis connection) {
return connection.hexists(key, field);
}
}.run(key);
}
@Override
public Long hdel(final String key, final String... field) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.hdel(key, field);
}
}.run(key);
}
@Override
public Long hlen(final String key) {
return new JedisClusterCommand(connectionHandler, maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.hlen(key);
}
}.run(key);
}
@Override
public Set hkeys(final String key) {
return new JedisClusterCommand>(connectionHandler, maxRedirections) {
@Override
public Set execute(Jedis connection) {
return connection.hkeys(key);
}
}.run(key);
}
@Override
public List hvals(final String key) {
return new JedisClusterCommand>(connectionHandler, maxRedirections) {
@Override
public List execute(Jedis connection) {
return connection.hvals(key);
}
}.run(key);
}
@Override
public Map hgetAll(final String key) {
return new JedisClusterCommand