}
}.runBinary(key);
}
<<<<<<< HEAD
@Override
public Long del(final byte[]... keys) {
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.del(keys);
}
}.runBinary(keys.length, keys);
}
@Override
public List blpop(final int timeout, final byte[]... keys) {
return new JedisClusterCommand>(connectionHandler,
timeout, maxRedirections) {
@Override
public List execute(Jedis connection) {
return connection.blpop(timeout, keys);
}
}.runBinary(keys.length, keys);
}
@Override
public List brpop(final int timeout, final byte[]... keys) {
return new JedisClusterCommand>(connectionHandler,
timeout, maxRedirections) {
@Override
public List execute(Jedis connection) {
return connection.brpop(timeout, keys);
}
}.runBinary(keys.length, keys);
}
@Override
public List mget(final byte[]... keys) {
return new JedisClusterCommand>(connectionHandler,
timeout, maxRedirections) {
@Override
public List execute(Jedis connection) {
return connection.mget(keys);
}
}.runBinary(keys.length - 1, keys);
}
@Override
public String mset(final byte[]... keysvalues) {
byte[][] keys = new byte[keysvalues.length / 2][];
for (int keyIdx = 0; keyIdx < keys.length; keyIdx++) {
keys[keyIdx] = keysvalues[keyIdx * 2];
}
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public String execute(Jedis connection) {
return connection.mset(keysvalues);
}
}.runBinary(keys.length, keys);
}
@Override
public Long msetnx(final byte[]... keysvalues) {
byte[][] keys = new byte[keysvalues.length / 2][];
for (int keyIdx = 0; keyIdx < keys.length; keyIdx++) {
keys[keyIdx] = keysvalues[keyIdx * 2];
}
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.msetnx(keysvalues);
}
}.runBinary(keys.length, keys);
}
@Override
public String rename(final byte[] oldkey, final byte[] newkey) {
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public String execute(Jedis connection) {
return connection.rename(oldkey, newkey);
}
}.runBinary(2, oldkey, newkey);
}
@Override
public Long renamenx(final byte[] oldkey, final byte[] newkey) {
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.renamenx(oldkey, newkey);
}
}
@Override
@Override
}.runBinary(2, oldkey, newkey);
}
@Override
public byte[] rpoplpush(final byte[] srckey, final byte[] dstkey) {
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public byte[] execute(Jedis connection) {
return connection.rpoplpush(srckey, dstkey);
}
}.runBinary(2, srckey, dstkey);
}
@Override
public Set sdiff(final byte[]... keys) {
return new JedisClusterCommand>(connectionHandler, timeout,
maxRedirections) {
@Override
public Set execute(Jedis connection) {
return connection.sdiff(keys);
}
}.runBinary(keys.length, keys);
}
@Override
public Long sdiffstore(final byte[] dstkey, final byte[]... keys) {
byte[][] wholeKeys = KeyMergeUtil.merge(dstkey, keys);
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.sdiffstore(dstkey, keys);
}
}.runBinary(wholeKeys.length, wholeKeys);
}
@Override
public Set sinter(final byte[]... keys) {
return new JedisClusterCommand>(connectionHandler, timeout,
maxRedirections) {
@Override
public Set execute(Jedis connection) {
return connection.sinter(keys);
}
}.runBinary(keys.length, keys);
}
@Override
public Long sinterstore(final byte[] dstkey, final byte[]... keys) {
byte[][] wholeKeys = KeyMergeUtil.merge(dstkey, keys);
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.sinterstore(dstkey, keys);
}
}.runBinary(wholeKeys.length, wholeKeys);
}
@Override
public Long smove(final byte[] srckey, final byte[] dstkey,
final byte[] member) {
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.smove(srckey, dstkey, member);
}
}.runBinary(2, srckey, dstkey);
}
@Override
public Long sort(final byte[] key, final SortingParams sortingParameters,
final byte[] dstkey) {
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.sort(key, sortingParameters, dstkey);
}
}.runBinary(2, key, dstkey);
}
@Override
public Long sort(final byte[] key, final byte[] dstkey) {
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.sort(key, dstkey);
}
}.runBinary(2, key, dstkey);
}
@Override
public Set sunion(final byte[]... keys) {
return new JedisClusterCommand>(connectionHandler, timeout,
maxRedirections) {
@Override
public Set execute(Jedis connection) {
return connection.sunion(keys);
}
}.runBinary(keys.length, keys);
public String execute(Jedis connection) {
public void psubscribe(final BinaryJedisPubSub jedisPubSub,
}
@Override
public Long sunionstore(final byte[] dstkey, final byte[]... keys) {
byte[][] wholeKeys = KeyMergeUtil.merge(dstkey, keys);
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.sunionstore(dstkey, keys);
}
}.runBinary(wholeKeys.length, wholeKeys);
}
@Override
public Long zinterstore(final byte[] dstkey, final byte[]... sets) {
byte[][] wholeKeys = KeyMergeUtil.merge(dstkey, sets);
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.zinterstore(dstkey, sets);
}
}.runBinary(wholeKeys.length, wholeKeys);
public Long zinterstore(final byte[] dstkey, final ZParams params,
final byte[]... sets) {
byte[][] wholeKeys = KeyMergeUtil.merge(dstkey, sets);
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.zinterstore(dstkey, params, sets);
}
}.runBinary(wholeKeys.length, wholeKeys);
}
@Override
public Long zunionstore(final byte[] dstkey, final byte[]... sets) {
byte[][] wholeKeys = KeyMergeUtil.merge(dstkey, sets);
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.zunionstore(dstkey, sets);
}
}.runBinary(wholeKeys.length, wholeKeys);
}
@Override
public Long zunionstore(final byte[] dstkey, final ZParams params,
final byte[]... sets) {
byte[][] wholeKeys = KeyMergeUtil.merge(dstkey, sets);
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.zunionstore(dstkey, params, sets);
}
}.runBinary(wholeKeys.length, wholeKeys);
}
@Override
public byte[] brpoplpush(final byte[] source, final byte[] destination,
final int timeout) {
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public byte[] execute(Jedis connection) {
return connection.brpoplpush(source, destination, timeout);
}
}.runBinary(2, source, destination);
}
@Override
public Long publish(final byte[] channel, final byte[] message) {
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.publish(channel, message);
}
}.runWithAnyNode();
}
@Override
public void subscribe(final BinaryJedisPubSub jedisPubSub,
final byte[]... channels) {
new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public Integer execute(Jedis connection) {
connection.subscribe(jedisPubSub, channels);
return 0;
}
}.runWithAnyNode();
}
@Override
final byte[]... patterns) {
new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
maxRedirections) {
@Override
public Integer execute(Jedis connection) {
connection.subscribe(jedisPubSub, patterns);
return 0;
}
}.runWithAnyNode();
}
@Override
public Long bitop(final BitOP op, final byte[] destKey,
final byte[]... srcKeys) {
byte[][] wholeKeys = KeyMergeUtil.merge(destKey, srcKeys);
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.bitop(op, destKey, srcKeys);
}
}.runBinary(wholeKeys.length, wholeKeys);
}
@Override
public String pfmerge(final byte[] destkey, final byte[]... sourcekeys) {
byte[][] wholeKeys = KeyMergeUtil.merge(destkey, sourcekeys);
return new JedisClusterCommand(connectionHandler, timeout,
return connection.pfmerge(destkey, sourcekeys);
}
}.runBinary(wholeKeys.length, wholeKeys);
}
@Override
public Long pfcount(final byte[]... keys) {
return new JedisClusterCommand(connectionHandler, timeout,
maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.pfcount(keys);
}
}.runBinary(keys.length, keys);
=======
@Override
public void close() throws IOException {
if (connectionHandler != null) {
for (JedisPool pool : connectionHandler.getNodes().values()) {
try {
if (pool != null) {
pool.destroy();
}
} catch (Exception e) {
// pass
}
}
}
>>>>>>> 53e7dc218fdf8e703bad4cebf6ef7201b96d2b5e
}
} |