Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.wl4g.infra.common.jedis.cluster.ConfigurableJedisClusterJedisClient Maven / Gradle / Ivy
/*
* Copyright 2017 ~ 2025 the original author or authors. James Wong
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wl4g.infra.common.jedis.cluster;
import static com.wl4g.infra.common.lang.Assert2.notNullOf;
import static com.wl4g.infra.common.log.SmartLoggerFactory.getLogger;
import static java.util.Arrays.asList;
import static java.util.Collections.emptySet;
import static java.util.Collections.singleton;
import static org.apache.commons.lang3.StringUtils.isBlank;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import com.wl4g.infra.common.log.SmartLogger;
import com.wl4g.infra.common.jedis.JedisClient;
import com.wl4g.infra.common.jedis.util.NoCanonicalParamaterException;
import com.wl4g.infra.common.jedis.util.RedisSpecUtil;
import com.wl4g.infra.common.jedis.cluster.ConfigurableJedisClusterCommand.ConfigurableJedisClusterConntionHandler;
import redis.clients.jedis.BinaryJedisCluster;
import redis.clients.jedis.BinaryJedisPubSub;
import redis.clients.jedis.BitOP;
import redis.clients.jedis.GeoCoordinate;
import redis.clients.jedis.GeoRadiusResponse;
import redis.clients.jedis.GeoUnit;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.JedisPubSub;
import redis.clients.jedis.ListPosition;
import redis.clients.jedis.ScanParams;
import redis.clients.jedis.ScanResult;
import redis.clients.jedis.SortingParams;
import redis.clients.jedis.StreamEntry;
import redis.clients.jedis.StreamEntryID;
import redis.clients.jedis.StreamPendingEntry;
import redis.clients.jedis.StreamPendingSummary;
import redis.clients.jedis.Tuple;
import redis.clients.jedis.ZParams;
import redis.clients.jedis.args.FlushMode;
import redis.clients.jedis.args.ListDirection;
import redis.clients.jedis.commands.ProtocolCommand;
import redis.clients.jedis.params.GeoAddParams;
import redis.clients.jedis.params.GeoRadiusParam;
import redis.clients.jedis.params.GeoRadiusStoreParam;
import redis.clients.jedis.params.GetExParams;
import redis.clients.jedis.params.LPosParams;
import redis.clients.jedis.params.RestoreParams;
import redis.clients.jedis.params.SetParams;
import redis.clients.jedis.params.XAddParams;
import redis.clients.jedis.params.XClaimParams;
import redis.clients.jedis.params.XPendingParams;
import redis.clients.jedis.params.XReadGroupParams;
import redis.clients.jedis.params.XReadParams;
import redis.clients.jedis.params.XTrimParams;
import redis.clients.jedis.params.ZAddParams;
import redis.clients.jedis.params.ZIncrByParams;
import redis.clients.jedis.resps.KeyedListElement;
import redis.clients.jedis.resps.KeyedZSetElement;
import redis.clients.jedis.util.JedisClusterHashTagUtil;
import redis.clients.jedis.util.KeyMergeUtil;
import redis.clients.jedis.util.SafeEncoder;
/**
* {@link ConfigurableJedisClusterJedisClient}
*
* @author James Wong <[email protected] >
* @version 2020年3月28日 v1.0.0
* @see
*/
@SuppressWarnings({ "deprecation", "unchecked" })
public class ConfigurableJedisClusterJedisClient extends JedisCluster implements JedisClient {
protected final SmartLogger log = getLogger(getClass());
/** Safety mode, validating storage key. */
protected final boolean safeMode;
public ConfigurableJedisClusterJedisClient(HostAndPort node, int connectionTimeout, int soTimeout, int maxAttempts,
final GenericObjectPoolConfig poolConfig, boolean safeMode) {
this(singleton(node), connectionTimeout, soTimeout, maxAttempts, null, poolConfig, safeMode);
}
public ConfigurableJedisClusterJedisClient(Set jedisClusterNode, int connectionTimeout, int soTimeout,
int maxAttempts, final GenericObjectPoolConfig poolConfig, boolean safeMode) {
this(jedisClusterNode, connectionTimeout, soTimeout, maxAttempts, null, poolConfig, safeMode);
}
public ConfigurableJedisClusterJedisClient(Set jedisClusterNode, int connectionTimeout, int soTimeout,
int maxAttempts, String password, final GenericObjectPoolConfig poolConfig, boolean safeMode) {
super(emptySet(), connectionTimeout, soTimeout, maxAttempts, null, null);
// Overly jedisCluster connection handler
this.connectionHandler = new ConfigurableJedisClusterConntionHandler(jedisClusterNode, poolConfig, connectionTimeout,
soTimeout, (isBlank(password) ? null : password));
this.safeMode = safeMode;
}
// ----------------------- JedisCluster ---------------------------
@Override
public Boolean copy(String srcKey, String dstKey, boolean replace) {
checkArguments(srcKey);
checkArguments(dstKey);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Boolean doExecute(Jedis connection) {
return connection.copy(srcKey, dstKey, replace);
}
}.run(2, srcKey, dstKey);
}
@Override
public String set(final String key, final String value) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.set(key, value);
}
}.run(key);
}
@Override
public String set(final String key, final String value, final SetParams params) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.set(key, value, params);
}
}.run(key);
}
@Override
public String get(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.get(key);
}
}.run(key);
}
@Override
public String getDel(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.getDel(key);
}
}.run(key);
}
@Override
public String getEx(String key, GetExParams params) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.getEx(key, params);
}
}.run(key);
}
@Override
public Boolean exists(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Boolean doExecute(Jedis connection) {
return connection.exists(key);
}
}.run(key);
}
@Override
public Long exists(final String... keys) {
checkArguments(keys);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.exists(keys);
}
}.run(keys.length, keys);
}
@Override
public Long persist(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.persist(key);
}
}.run(key);
}
@Override
public String type(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.type(key);
}
}.run(key);
}
@Override
public byte[] dump(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public byte[] doExecute(Jedis connection) {
return connection.dump(key);
}
}.run(key);
}
@Override
public String restore(final String key, final long ttl, final byte[] serializedValue) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.restore(key, ttl, serializedValue);
}
}.run(key);
}
@Override
public String restore(final String key, final long ttl, final byte[] serializedValue, final RestoreParams params) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.restore(key, ttl, serializedValue, params);
}
}.run(key);
}
@Override
public Long expire(final String key, final long seconds) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.expire(key, seconds);
}
}.run(key);
}
@Override
public Long pexpire(final String key, final long milliseconds) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.pexpire(key, milliseconds);
}
}.run(key);
}
@Override
public Long expireAt(final String key, final long unixTime) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.expireAt(key, unixTime);
}
}.run(key);
}
@Override
public Long pexpireAt(final String key, final long millisecondsTimestamp) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.pexpireAt(key, millisecondsTimestamp);
}
}.run(key);
}
@Override
public Long ttl(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.ttl(key);
}
}.run(key);
}
@Override
public Long pttl(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.pttl(key);
}
}.run(key);
}
@Override
public Long touch(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.touch(key);
}
}.run(key);
}
@Override
public Long touch(final String... keys) {
checkArguments(keys);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.touch(keys);
}
}.run(keys.length, keys);
}
@Override
public Boolean setbit(final String key, final long offset, final boolean value) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Boolean doExecute(Jedis connection) {
return connection.setbit(key, offset, value);
}
}.run(key);
}
@Override
public Boolean setbit(final String key, final long offset, final String value) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Boolean doExecute(Jedis connection) {
return connection.setbit(key, offset, value);
}
}.run(key);
}
@Override
public Boolean getbit(final String key, final long offset) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Boolean doExecute(Jedis connection) {
return connection.getbit(key, offset);
}
}.run(key);
}
@Override
public Long setrange(final String key, final long offset, final String value) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.setrange(key, offset, value);
}
}.run(key);
}
@Override
public String getrange(final String key, final long startOffset, final long endOffset) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.getrange(key, startOffset, endOffset);
}
}.run(key);
}
@Override
public String getSet(final String key, final String value) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.getSet(key, value);
}
}.run(key);
}
@Override
public Long setnx(final String key, final String value) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.setnx(key, value);
}
}.run(key);
}
@Override
public String setex(final String key, final long seconds, final String value) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.setex(key, seconds, value);
}
}.run(key);
}
@Override
public String psetex(final String key, final long milliseconds, final String value) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.psetex(key, milliseconds, value);
}
}.run(key);
}
@Override
public Long decrBy(final String key, final long decrement) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.decrBy(key, decrement);
}
}.run(key);
}
@Override
public Long decr(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.decr(key);
}
}.run(key);
}
@Override
public Long incrBy(final String key, final long increment) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.incrBy(key, increment);
}
}.run(key);
}
@Override
public Double incrByFloat(final String key, final double increment) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Double doExecute(Jedis connection) {
return connection.incrByFloat(key, increment);
}
}.run(key);
}
@Override
public Long incr(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.incr(key);
}
}.run(key);
}
@Override
public Long append(final String key, final String value) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.append(key, value);
}
}.run(key);
}
@Override
public String substr(final String key, final int start, final int end) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.substr(key, start, end);
}
}.run(key);
}
@Override
public Long hset(final String key, final String field, final String value) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.hset(key, field, value);
}
}.run(key);
}
@Override
public Long hset(final String key, final Map hash) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.hset(key, hash);
}
}.run(key);
}
@Override
public String hget(final String key, final String field) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.hget(key, field);
}
}.run(key);
}
@Override
public Long hsetnx(final String key, final String field, final String value) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.hsetnx(key, field, value);
}
}.run(key);
}
@Override
public String hmset(final String key, final Map hash) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.hmset(key, hash);
}
}.run(key);
}
@Override
public List hmget(final String key, final String... fields) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public List doExecute(Jedis connection) {
return connection.hmget(key, fields);
}
}.run(key);
}
@Override
public Long hincrBy(final String key, final String field, final long value) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.hincrBy(key, field, value);
}
}.run(key);
}
@Override
public Double hincrByFloat(final String key, final String field, final double value) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Double doExecute(Jedis connection) {
return connection.hincrByFloat(key, field, value);
}
}.run(key);
}
@Override
public Boolean hexists(final String key, final String field) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Boolean doExecute(Jedis connection) {
return connection.hexists(key, field);
}
}.run(key);
}
@Override
public Long hdel(final String key, final String... field) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.hdel(key, field);
}
}.run(key);
}
@Override
public Long hlen(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.hlen(key);
}
}.run(key);
}
@Override
public Set hkeys(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.hkeys(key);
}
}.run(key);
}
@Override
public List hvals(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public List doExecute(Jedis connection) {
return connection.hvals(key);
}
}.run(key);
}
@Override
public Map hgetAll(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Map doExecute(Jedis connection) {
return connection.hgetAll(key);
}
}.run(key);
}
@Override
public String hrandfield(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.hrandfield(key);
}
}.run(key);
}
@Override
public List hrandfield(final String key, final long count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public List doExecute(Jedis connection) {
return connection.hrandfield(key, count);
}
}.run(key);
}
@Override
public Map hrandfieldWithValues(final String key, final long count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Map doExecute(Jedis connection) {
return connection.hrandfieldWithValues(key, count);
}
}.run(key);
}
@Override
public Long rpush(final String key, final String... string) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.rpush(key, string);
}
}.run(key);
}
@Override
public Long lpush(final String key, final String... string) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.lpush(key, string);
}
}.run(key);
}
@Override
public Long llen(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.llen(key);
}
}.run(key);
}
@Override
public List lrange(final String key, final long start, final long stop) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public List doExecute(Jedis connection) {
return connection.lrange(key, start, stop);
}
}.run(key);
}
@Override
public String ltrim(final String key, final long start, final long stop) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.ltrim(key, start, stop);
}
}.run(key);
}
@Override
public String lindex(final String key, final long index) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.lindex(key, index);
}
}.run(key);
}
@Override
public String lset(final String key, final long index, final String value) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.lset(key, index, value);
}
}.run(key);
}
@Override
public Long lrem(final String key, final long count, final String value) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.lrem(key, count, value);
}
}.run(key);
}
@Override
public String lpop(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.lpop(key);
}
}.run(key);
}
@Override
public List lpop(final String key, final int count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public List doExecute(Jedis connection) {
return connection.lpop(key, count);
}
}.run(key);
}
@Override
public Long lpos(final String key, final String element) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.lpos(key, element);
}
}.run(key);
}
@Override
public Long lpos(final String key, final String element, final LPosParams params) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.lpos(key, element, params);
}
}.run(key);
}
@Override
public List lpos(final String key, final String element, final LPosParams params, final long count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public List doExecute(Jedis connection) {
return connection.lpos(key, element, params, count);
}
}.run(key);
}
@Override
public String rpop(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.rpop(key);
}
}.run(key);
}
@Override
public List rpop(final String key, final int count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public List doExecute(Jedis connection) {
return connection.rpop(key, count);
}
}.run(key);
}
@Override
public Long sadd(final String key, final String... member) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.sadd(key, member);
}
}.run(key);
}
@Override
public Set smembers(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.smembers(key);
}
}.run(key);
}
@Override
public Long srem(final String key, final String... member) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.srem(key, member);
}
}.run(key);
}
@Override
public String spop(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.spop(key);
}
}.run(key);
}
@Override
public Set spop(final String key, final long count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.spop(key, count);
}
}.run(key);
}
@Override
public Long scard(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.scard(key);
}
}.run(key);
}
@Override
public Boolean sismember(final String key, final String member) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Boolean doExecute(Jedis connection) {
return connection.sismember(key, member);
}
}.run(key);
}
@Override
public List smismember(final String key, final String... members) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public List doExecute(Jedis connection) {
return connection.smismember(key, members);
}
}.run(key);
}
@Override
public String srandmember(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.srandmember(key);
}
}.run(key);
}
@Override
public List srandmember(final String key, final int count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public List doExecute(Jedis connection) {
return connection.srandmember(key, count);
}
}.run(key);
}
@Override
public Long strlen(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.strlen(key);
}
}.run(key);
}
@Override
public Long zadd(final String key, final double score, final String member) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.zadd(key, score, member);
}
}.run(key);
}
@Override
public Long zadd(final String key, final double score, final String member, final ZAddParams params) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.zadd(key, score, member, params);
}
}.run(key);
}
@Override
public Long zadd(final String key, final Map scoreMembers) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.zadd(key, scoreMembers);
}
}.run(key);
}
@Override
public Long zadd(final String key, final Map scoreMembers, final ZAddParams params) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.zadd(key, scoreMembers, params);
}
}.run(key);
}
@Override
public Double zaddIncr(String key, double score, String member, ZAddParams params) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Double doExecute(Jedis connection) {
return connection.zaddIncr(key, score, member, params);
}
}.run(key);
}
@Override
public Set zdiff(String... keys) {
checkArguments(keys);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zdiff(keys);
}
}.run(keys.length, keys);
}
@Override
public Set zdiffWithScores(String... keys) {
checkArguments(keys);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zdiffWithScores(keys);
}
}.run(keys.length, keys);
}
@Override
public Long zdiffStore(final String dstkey, final String... keys) {
checkArguments(dstkey);
String[] wholeKeys = KeyMergeUtil.merge(dstkey, keys);
checkArguments(keys);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.zdiffStore(dstkey, keys);
}
}.run(wholeKeys.length, wholeKeys);
}
@Override
public Set zrange(final String key, final long start, final long stop) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrange(key, start, stop);
}
}.run(key);
}
@Override
public Long zrem(final String key, final String... members) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.zrem(key, members);
}
}.run(key);
}
@Override
public Double zincrby(final String key, final double increment, final String member) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Double doExecute(Jedis connection) {
return connection.zincrby(key, increment, member);
}
}.run(key);
}
@Override
public Double zincrby(final String key, final double increment, final String member, final ZIncrByParams params) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Double doExecute(Jedis connection) {
return connection.zincrby(key, increment, member, params);
}
}.run(key);
}
@Override
public Long zrank(final String key, final String member) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.zrank(key, member);
}
}.run(key);
}
@Override
public Long zrevrank(final String key, final String member) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.zrevrank(key, member);
}
}.run(key);
}
@Override
public Set zrevrange(final String key, final long start, final long stop) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrevrange(key, start, stop);
}
}.run(key);
}
@Override
public Set zrangeWithScores(final String key, final long start, final long stop) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrangeWithScores(key, start, stop);
}
}.run(key);
}
@Override
public Set zrevrangeWithScores(final String key, final long start, final long stop) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrevrangeWithScores(key, start, stop);
}
}.run(key);
}
@Override
public String zrandmember(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.zrandmember(key);
}
}.run(key);
}
@Override
public Set zrandmember(final String key, final long count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrandmember(key, count);
}
}.run(key);
}
@Override
public Set zrandmemberWithScores(final String key, final long count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrandmemberWithScores(key, count);
}
}.run(key);
}
@Override
public Long zcard(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.zcard(key);
}
}.run(key);
}
@Override
public Double zscore(final String key, final String member) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Double doExecute(Jedis connection) {
return connection.zscore(key, member);
}
}.run(key);
}
@Override
public List zmscore(final String key, final String... members) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public List doExecute(Jedis connection) {
return connection.zmscore(key, members);
}
}.run(key);
}
@Override
public Tuple zpopmax(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Tuple doExecute(Jedis connection) {
return connection.zpopmax(key);
}
}.run(key);
}
@Override
public Set zpopmax(final String key, final int count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zpopmax(key, count);
}
}.run(key);
}
@Override
public Tuple zpopmin(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Tuple doExecute(Jedis connection) {
return connection.zpopmin(key);
}
}.run(key);
}
@Override
public Set zpopmin(final String key, final int count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zpopmin(key, count);
}
}.run(key);
}
@Override
public List sort(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public List doExecute(Jedis connection) {
return connection.sort(key);
}
}.run(key);
}
@Override
public List sort(final String key, final SortingParams sortingParameters) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public List doExecute(Jedis connection) {
return connection.sort(key, sortingParameters);
}
}.run(key);
}
@Override
public Long zcount(final String key, final double min, final double max) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.zcount(key, min, max);
}
}.run(key);
}
@Override
public Long zcount(final String key, final String min, final String max) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.zcount(key, min, max);
}
}.run(key);
}
@Override
public Set zrangeByScore(final String key, final double min, final double max) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrangeByScore(key, min, max);
}
}.run(key);
}
@Override
public Set zrangeByScore(final String key, final String min, final String max) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrangeByScore(key, min, max);
}
}.run(key);
}
@Override
public Set zrevrangeByScore(final String key, final double max, final double min) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrevrangeByScore(key, max, min);
}
}.run(key);
}
@Override
public Set zrangeByScore(final String key, final double min, final double max, final int offset, final int count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrangeByScore(key, min, max, offset, count);
}
}.run(key);
}
@Override
public Set zrevrangeByScore(final String key, final String max, final String min) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrevrangeByScore(key, max, min);
}
}.run(key);
}
@Override
public Set zrangeByScore(final String key, final String min, final String max, final int offset, final int count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrangeByScore(key, min, max, offset, count);
}
}.run(key);
}
@Override
public Set zrevrangeByScore(final String key, final double max, final double min, final int offset, final int count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrevrangeByScore(key, max, min, offset, count);
}
}.run(key);
}
@Override
public Set zrangeByScoreWithScores(final String key, final double min, final double max) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrangeByScoreWithScores(key, min, max);
}
}.run(key);
}
@Override
public Set zrevrangeByScoreWithScores(final String key, final double max, final double min) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrevrangeByScoreWithScores(key, max, min);
}
}.run(key);
}
@Override
public Set zrangeByScoreWithScores(
final String key,
final double min,
final double max,
final int offset,
final int count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrangeByScoreWithScores(key, min, max, offset, count);
}
}.run(key);
}
@Override
public Set zrevrangeByScore(final String key, final String max, final String min, final int offset, final int count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrevrangeByScore(key, max, min, offset, count);
}
}.run(key);
}
@Override
public Set zrangeByScoreWithScores(final String key, final String min, final String max) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrangeByScoreWithScores(key, min, max);
}
}.run(key);
}
@Override
public Set zrevrangeByScoreWithScores(final String key, final String max, final String min) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrevrangeByScoreWithScores(key, max, min);
}
}.run(key);
}
@Override
public Set zrangeByScoreWithScores(
final String key,
final String min,
final String max,
final int offset,
final int count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrangeByScoreWithScores(key, min, max, offset, count);
}
}.run(key);
}
@Override
public Set zrevrangeByScoreWithScores(
final String key,
final double max,
final double min,
final int offset,
final int count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrevrangeByScoreWithScores(key, max, min, offset, count);
}
}.run(key);
}
@Override
public Set zrevrangeByScoreWithScores(
final String key,
final String max,
final String min,
final int offset,
final int count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrevrangeByScoreWithScores(key, max, min, offset, count);
}
}.run(key);
}
@Override
public Long zremrangeByRank(final String key, final long start, final long stop) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.zremrangeByRank(key, start, stop);
}
}.run(key);
}
@Override
public Long zremrangeByScore(final String key, final double min, final double max) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.zremrangeByScore(key, min, max);
}
}.run(key);
}
@Override
public Long zremrangeByScore(final String key, final String min, final String max) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.zremrangeByScore(key, min, max);
}
}.run(key);
}
@Override
public Long zlexcount(final String key, final String min, final String max) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.zlexcount(key, min, max);
}
}.run(key);
}
@Override
public Set zrangeByLex(final String key, final String min, final String max) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrangeByLex(key, min, max);
}
}.run(key);
}
@Override
public Set zrangeByLex(final String key, final String min, final String max, final int offset, final int count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrangeByLex(key, min, max, offset, count);
}
}.run(key);
}
@Override
public Set zrevrangeByLex(final String key, final String max, final String min) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrevrangeByLex(key, max, min);
}
}.run(key);
}
@Override
public Set zrevrangeByLex(final String key, final String max, final String min, final int offset, final int count) {
checkArguments(key);
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set doExecute(Jedis connection) {
return connection.zrevrangeByLex(key, max, min, offset, count);
}
}.run(key);
}
@Override
public Long zremrangeByLex(final String key, final String min, final String max) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.zremrangeByLex(key, min, max);
}
}.run(key);
}
@Override
public Long linsert(final String key, final ListPosition where, final String pivot, final String value) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.linsert(key, where, pivot, value);
}
}.run(key);
}
@Override
public Long lpushx(final String key, final String... string) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.lpushx(key, string);
}
}.run(key);
}
@Override
public Long rpushx(final String key, final String... string) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.rpushx(key, string);
}
}.run(key);
}
@Override
public Long del(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.del(key);
}
}.run(key);
}
@Override
public Long unlink(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.unlink(key);
}
}.run(key);
}
@Override
public Long unlink(final String... keys) {
checkArguments(keys);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.unlink(keys);
}
}.run(keys.length, keys);
}
@Override
public String echo(final String string) {
// note that it'll be run from arbitrary node
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public String doExecute(Jedis connection) {
return connection.echo(string);
}
}.run(string);
}
@Override
public Long bitcount(final String key) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.bitcount(key);
}
}.run(key);
}
@Override
public Long bitcount(final String key, final long start, final long end) {
checkArguments(key);
return new ConfigurableJedisClusterCommand(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Long doExecute(Jedis connection) {
return connection.bitcount(key, start, end);
}
}.run(key);
}
@Override
public Set keys(final String pattern) {
if (pattern == null || pattern.isEmpty()) {
throw new IllegalArgumentException(
this.getClass().getSimpleName() + " only supports KEYS commands with non-empty patterns");
}
if (!JedisClusterHashTagUtil.isClusterCompliantMatchPattern(pattern)) {
throw new IllegalArgumentException(this.getClass().getSimpleName()
+ " only supports KEYS commands with patterns containing hash-tags" + " ( curly-brackets enclosed strings )");
}
return new ConfigurableJedisClusterCommand>(connectionHandler, maxAttempts, maxTotalRetriesDuration) {
@Override
public Set