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.
top.netkit.redis.client.executor.RedisClient Maven / Gradle / Ivy
package top.netkit.redis.client.executor;
import com.fasterxml.jackson.core.type.TypeReference;
import org.redisson.api.*;
import org.redisson.api.listener.MessageListener;
import org.redisson.api.listener.PatternMessageListener;
import org.redisson.client.codec.Codec;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
/**
* redis组件
*
* @author shixinke
*/
public class RedisClient implements RedisCommandExecutor, RedisLockExecutor {
private static final Logger logger = LoggerFactory.getLogger(RedisClient.class);
/**
* redis command client
*/
private final RedisCommandClient redisCommandClient;
/**
* redis lock client
*/
private final RedisLockClient redisLockClient;
public RedisClient(RedisCommandClient redisCommandClient, RedisLockClient redisLockClient) {
this.redisCommandClient = redisCommandClient;
this.redisLockClient = redisLockClient;
}
@Override
public void setCodec(Codec codec) {
}
@Override
public Codec getCodec() {
return null;
}
@Override
public boolean hDel(String key, List fields) {
return redisCommandClient.hDel(key, fields);
}
@Override
public boolean hDel(String key, String field) {
return redisCommandClient.hDel(key, field);
}
@Override
public boolean hExists(String key, String filed) {
return redisCommandClient.hExists(key, filed);
}
@Override
public V hGet(String key, String field, Class clazz) {
return redisCommandClient.hGet(key, field, clazz);
}
@Override
public V hGet(String key, String field, TypeReference typeReference) {
return redisCommandClient.hGet(key, field, typeReference);
}
@Override
public Map hGetAll(String key, Class clazz) {
return redisCommandClient.hGetAll(key, clazz);
}
@Override
public long hIncr(String key, String field, int step) {
return redisCommandClient.hIncr(key, field, step);
}
@Override
public double hIncrByFloat(String key, String field, double step) {
return redisCommandClient.hIncrByFloat(key, field, step);
}
@Override
public List hKeys(String key) {
return redisCommandClient.hKeys(key);
}
@Override
public long hLen(String key) {
return redisCommandClient.hLen(key);
}
@Override
public Map hMGet(String key, List fields, Class clazz) {
return redisCommandClient.hMGet(key, fields, clazz);
}
@Override
public boolean hMSet(String key, Map valuesMap) {
return redisCommandClient.hMSet(key, valuesMap);
}
@Override
public boolean hSet(String key, String field, V value) {
return redisCommandClient.hSet(key, field, value);
}
@Override
public boolean hSetNx(String key, String field, V value) {
return redisCommandClient.hSetNx(key, field, value);
}
@Override
public long hStrLen(String key, String field) {
return redisCommandClient.hStrLen(key, field);
}
@Override
public List hVals(String key, Class clazz) {
return redisCommandClient.hVals(key, clazz);
}
@Override
public boolean del(String key) {
return redisCommandClient.del(key);
}
@Override
public boolean del(Collection keys) {
return redisCommandClient.del(keys);
}
@Override
public boolean exists(String key) {
return redisCommandClient.exists(key);
}
@Override
public boolean expire(String key, Long seconds) {
try {
return redisCommandClient.expire(key, seconds);
} catch(Exception ex) {
logger.error("expire failed, key={}", key, ex);
return false;
}
}
@Override
public boolean expireAt(String key, Integer timestamp) {
return redisCommandClient.expireAt(key, timestamp);
}
@Override
public boolean pExpire(String key, Long mills) {
return redisCommandClient.pExpire(key, mills);
}
@Override
public boolean pExpireAt(String key, Long timestampMills) {
return redisCommandClient.pExpireAt(key, timestampMills);
}
@Override
public Long ttl(String key) {
return redisCommandClient.ttl(key);
}
@Override
public Long pTtl(String key) {
return redisCommandClient.pTtl(key);
}
@Override
public boolean persist(String key) {
return redisCommandClient.persist(key);
}
@Override
public boolean rename(String originalKey, String newKey) {
return redisCommandClient.rename(originalKey, newKey);
}
@Override
public boolean renameNx(String originalKey, String newKey) {
return redisCommandClient.renameNx(originalKey, newKey);
}
@Override
public String randomKey() {
return redisCommandClient.randomKey();
}
@Override
public String type(String key) {
return redisCommandClient.type(key);
}
@Override
public Iterable keys(String pattern) {
return redisCommandClient.keys(pattern);
}
@Override
public V blPop(String key, Long timeout, Class clazz) {
return redisCommandClient.blPop(key, timeout, clazz);
}
@Override
public List blPop(List keys, Long timeoutMills, Class clazz) {
return redisCommandClient.blPop(keys, timeoutMills, clazz);
}
@Override
public V brPop(String key, Long timeout, Class clazz) {
return redisCommandClient.brPop(key, timeout, clazz);
}
@Override
public List brPop(List keys, Long timeout, Class clazz) {
return redisCommandClient.brPop(keys, timeout, clazz);
}
@Override
public V brPopLPush(String sourceKey, String destKey, Class clazz) {
return redisCommandClient.brPopLPush(sourceKey, destKey, clazz);
}
@Override
public V lIndex(String key, int index, Class clazz) {
return redisCommandClient.lIndex(key, index, clazz);
}
@Override
public boolean lInsertBefore(String key, V pivot, List values) {
return redisCommandClient.lInsertBefore(key, pivot, values);
}
@Override
public boolean lInsertAfter(String key, V pivot, List values) {
return redisCommandClient.lInsertAfter(key, pivot, values);
}
@Override
public int lLen(String key) {
return redisCommandClient.lLen(key);
}
@Override
public V lPop(String key, Class clazz) {
return redisCommandClient.lPop(key, clazz);
}
@Override
public boolean lPush(String key, List values) {
return redisCommandClient.lPush(key, values);
}
@Override
public boolean lPush(String key, V value) {
return redisCommandClient.lPush(key, value);
}
@Override
public boolean lPushX(String key, V value) {
return redisCommandClient.lPushX(key, value);
}
@Override
public List lRange(String key, int start, int end, Class clazz) {
return redisCommandClient.lRange(key, start, end, clazz);
}
@Override
public boolean lRem(String key, V value, Integer count) {
return redisCommandClient.lRem(key, value, count);
}
@Override
public boolean lSet(String key, int index, V value) {
return redisCommandClient.lSet(key, index, value);
}
@Override
public boolean lTrim(String key, int start, int end) {
return redisCommandClient.lTrim(key, start, end);
}
@Override
public V rPop(String key, Class clazz) {
return redisCommandClient.rPop(key, clazz);
}
@Override
public V rPopLPush(String sourceKey, String destKey, Class clazz) {
return redisCommandClient.rPopLPush(sourceKey, destKey, clazz);
}
@Override
public boolean rPush(String key, V value) {
return redisCommandClient.rPush(key, value);
}
@Override
public boolean rPushX(String key, V value) {
return redisCommandClient.rPushX(key, value);
}
@Override
public void pSubscribe(String pattern, Class type, PatternMessageListener listener) {
redisCommandClient.pSubscribe(pattern, type, listener);
}
@Override
public void pSubscribe(List patterns, List> types, List> patternMessageListeners) {
redisCommandClient.pSubscribe(patterns, types, patternMessageListeners);
}
@Override
public void pUnSubscribe(String pattern) {
redisCommandClient.pUnSubscribe(pattern);
}
@Override
public void pUnSubscribe(List patterns) {
redisCommandClient.pUnSubscribe(patterns);
}
@Override
public Long publish(String channel, V message) {
return redisCommandClient.publish(channel, message);
}
@Override
public void subscribe(String topic, Class type, MessageListener extends M> listener) {
redisCommandClient.subscribe(topic, type, listener);
}
@Override
public void subscribe(List topics, List> clazz, List> messageListeners) {
redisCommandClient.subscribe(topics, clazz, messageListeners);
}
@Override
public void unsubscribe(String topic) {
redisCommandClient.unsubscribe(topic);
}
@Override
public void unsubscribe(List topics) {
redisCommandClient.unsubscribe(topics);
}
@Override
public V eval(String key, String script, boolean readonly, List keys, List args, Class clazz) {
return redisCommandClient.eval(key, script, readonly, keys, args, clazz);
}
@Override
public V eval(String script, boolean readonly, List keys, List args, Class clazz) {
return redisCommandClient.eval(script, readonly, keys, args, clazz);
}
@Override
public V eval(String script, boolean readonly, Class clazz) {
return redisCommandClient.eval(script, readonly, clazz);
}
@Override
public V evalSha(String key, String script, boolean readonly, List keys, List args, Class clazz) {
return redisCommandClient.evalSha(key, script, readonly, keys, args, clazz);
}
@Override
public V evalSha(String script, boolean readonly, List keys, List args, Class clazz) {
return redisCommandClient.evalSha(script, readonly, keys, args, clazz);
}
@Override
public V evalSha(String script, boolean readonly, Class clazz) {
return redisCommandClient.evalSha(script, readonly, clazz);
}
@Override
public boolean scriptExists(String script) {
return redisCommandClient.scriptExists(script);
}
@Override
public List scriptExists(List scripts) {
return redisCommandClient.scriptExists(scripts);
}
@Override
public boolean flushScript() {
return redisCommandClient.flushScript();
}
@Override
public boolean killScript() {
return redisCommandClient.killScript();
}
@Override
public V loadScript(String script) {
return redisCommandClient.loadScript(script);
}
@Override
public boolean sAdd(String key, V value) {
return redisCommandClient.sAdd(key, value);
}
@Override
public boolean sAdd(String key, List values) {
return redisCommandClient.sAdd(key, values);
}
@Override
public int sCard(String key) {
return redisCommandClient.sCard(key);
}
@Override
public Set sDiff(String sourceKey, String destKey, Class clazz) {
return redisCommandClient.sDiff(sourceKey, destKey, clazz);
}
@Override
public Set sDiff(String sourceKey, List destKeys, Class clazz) {
return redisCommandClient.sDiff(sourceKey, destKeys, clazz);
}
@Override
public boolean sDiffStore(String storeKey, String sourceKey, List destKeys, Class clazz) {
return redisCommandClient.sDiffStore(storeKey, sourceKey, destKeys, clazz);
}
@Override
public Set sInter(String sourceKey, String destKey, Class clazz) {
return redisCommandClient.sInter(sourceKey, destKey, clazz);
}
@Override
public Set sInter(String sourceKey, List destKeys, Class clazz) {
return redisCommandClient.sInter(sourceKey, destKeys, clazz);
}
@Override
public boolean sInterStore(String storeKey, String sourceKey, List destKeys, Class clazz) {
return redisCommandClient.sInterStore(storeKey, sourceKey, destKeys, clazz);
}
@Override
public Set sUnion(String sourceKey, String destKey, Class clazz) {
return redisCommandClient.sUnion(sourceKey, destKey, clazz);
}
@Override
public Set sUnion(String sourceKey, List destKeys, Class clazz) {
return redisCommandClient.sUnion(sourceKey, destKeys, clazz);
}
@Override
public boolean sUnionStore(String storeKey, String sourceKey, List destKeys, Class clazz) {
return redisCommandClient.sUnionStore(storeKey, sourceKey, destKeys, clazz);
}
@Override
public boolean sIsMember(String key, V member) {
return redisCommandClient.sIsMember(key, member);
}
@Override
public Set sMembers(String key, Class clazz) {
return redisCommandClient.sMembers(key, clazz);
}
@Override
public boolean sMove(String sourceKey, String destKey, V value) {
return redisCommandClient.sMove(sourceKey, destKey, value);
}
@Override
public Set sPop(String key, Integer count, Class clazz) {
return redisCommandClient.sPop(key, count, clazz);
}
@Override
public boolean sRem(String key, List values) {
return redisCommandClient.sRem(key, values);
}
@Override
public boolean sRem(String key, V value) {
return redisCommandClient.sRem(key, value);
}
@Override
public Set sRandomMember(String key, Integer count, Class clazz) {
return redisCommandClient.sRandomMember(key, count, clazz);
}
@Override
public boolean zAdd(String key, V member, Double score) {
return redisCommandClient.zAdd(key, member, score);
}
@Override
public boolean zAdd(String key, Map members) {
return redisCommandClient.zAdd(key, members);
}
@Override
public int zCard(String key) {
return redisCommandClient.zCard(key);
}
@Override
public int zCount(String key, double min, double max) {
return redisCommandClient.zCount(key, min, max);
}
@Override
public double zIncrBy(String key, V member, double step) {
return redisCommandClient.zIncrBy(key, member, step);
}
@Override
public boolean zInterStore(String storeKey, String sourceKey, List destKeys) {
return redisCommandClient.zInterStore(storeKey, sourceKey, destKeys);
}
@Override
public long zLexCount(String key, String minMember, String maxMember) {
return redisCommandClient.zLexCount(key, minMember, maxMember);
}
@Override
public List zRangeWithoutScore(String key, int start, int end, Class clazz) {
return redisCommandClient.zRangeWithoutScore(key, start, end, clazz);
}
@Override
public List zRevRangeWithoutScore(String key, int start, int end, Class clazz) {
return redisCommandClient.zRevRangeWithoutScore(key, start, end, clazz);
}
@Override
public Integer zRank(String key, V member) {
return redisCommandClient.zRank(key, member);
}
@Override
public Integer zRevRank(String key, V member) {
return redisCommandClient.zRevRank(key, member);
}
@Override
public boolean zRem(String key, V member) {
return redisCommandClient.zRem(key, member);
}
@Override
public boolean zRem(String key, List members) {
return redisCommandClient.zRem(key, members);
}
@Override
public List> zRange(String key, int start, int end, Class clazz) {
return redisCommandClient.zRange(key, start, end, clazz);
}
@Override
public Map zRangeByScore(String key, int start, int end, boolean withScores, Long offset, Long count, Class clazz) {
return redisCommandClient.zRangeByScore(key, start, end, withScores, offset, count, clazz);
}
@Override
public List> zRevRange(String key, int start, int end, Class clazz) {
return redisCommandClient.zRevRange(key, start, end, clazz);
}
@Override
public Map zRevRangeByScore(String key, int start, int end, boolean withScores, Long offset, Long count, Class clazz) {
return redisCommandClient.zRevRangeByScore(key, start, end, withScores, offset, count, clazz);
}
@Override
public boolean zRemRangeByRank(String key, int start, int end) {
return redisCommandClient.zRemRangeByRank(key, start, end);
}
@Override
public boolean zRemRangeByScope(String key, double min, double max) {
return redisCommandClient.zRemRangeByScope(key, min, max);
}
@Override
public Double zScore(String key, V member) {
return redisCommandClient.zScore(key, member);
}
@Override
public boolean zUnionStore(String storeKey, String sourceKey, List destKeys) {
return redisCommandClient.zUnionStore(storeKey, sourceKey, destKeys);
}
@Override
public boolean append(String key, String value) {
return redisCommandClient.append(key, value);
}
@Override
public long bitCount(String key) {
return redisCommandClient.bitCount(key);
}
@Override
public void bitOp(String destKey, String operation, String... keys) {
redisCommandClient.bitOp(destKey, operation, keys);
}
@Override
public void and(String destKey, String... keys) {
redisCommandClient.and(destKey, keys);
}
@Override
public void or(String destKey, String... keys) {
redisCommandClient.or(destKey, keys);
}
@Override
public void not(String destKey) {
redisCommandClient.not(destKey);
}
@Override
public void xor(String destKey, String... keys) {
redisCommandClient.xor(destKey, keys);
}
@Override
public boolean set(String key, V value) {
return redisCommandClient.set(key, value);
}
@Override
public boolean set(String key, V value, Long expireSeconds) {
return redisCommandClient.set(key, value, expireSeconds);
}
@Override
public boolean setEx(String key, V value, Long expireSeconds) {
return redisCommandClient.setEx(key, value, expireSeconds);
}
@Override
public boolean pSetEx(String key, V value, Long expireMills) {
return redisCommandClient.pSetEx(key, value, expireMills);
}
@Override
public boolean setNx(String key, V value) {
return redisCommandClient.setNx(key, value);
}
@Override
public String get(String key) {
try {
return redisCommandClient.get(key);
} catch (Exception ex) {
logger.error("get failed, key={}", key, ex);
return null;
}
}
@Override
public V get(String key, Class clazz) {
try {
return redisCommandClient.get(key, clazz);
} catch (Exception ex) {
logger.error("get failed, key={}", key, ex);
return null;
}
}
@Override
public V get(String key, TypeReference typeReference) {
try {
return redisCommandClient.get(key, typeReference);
} catch (Exception ex) {
logger.error("get failed, key={}", key, ex);
return null;
}
}
@Override
public V getSet(String key, V value, Class clazz) {
return redisCommandClient.getSet(key, value, clazz);
}
@Override
public Long incr(String key) {
return redisCommandClient.incr(key);
}
@Override
public Long incrBy(String key, int step) {
return redisCommandClient.incrBy(key, step);
}
@Override
public double incrByFloat(String key, float step) {
return redisCommandClient.incrByFloat(key, step);
}
@Override
public Long decr(String key) {
return redisCommandClient.decr(key);
}
@Override
public Long decrBy(String key, int step) {
return redisCommandClient.decrBy(key, step);
}
@Override
public Map mGet(List keys, Class clazz) {
return redisCommandClient.mGet(keys, clazz);
}
@Override
public Map mGet(List keys, TypeReference typeReference) {
return redisCommandClient.mGet(keys, typeReference);
}
@Override
public boolean mSet(Map valueMap) {
return redisCommandClient.mSet(valueMap);
}
@Override
public boolean mSetEx(Map valueMap, Long expire) {
return redisCommandClient.mSetEx(valueMap, expire);
}
@Override
public boolean mSetNx(Map valueMap) {
return redisCommandClient.mSetNx(valueMap);
}
@Override
public boolean setRange(String key, int offset, String value) {
return redisCommandClient.setRange(key, offset, value);
}
@Override
public Long strLen(String key) {
return redisCommandClient.strLen(key);
}
@Override
public boolean discard(RTransaction transaction) {
return redisCommandClient.discard(transaction);
}
@Override
public boolean multi(ReturnableExecutor executor) {
return redisCommandClient.multi(executor);
}
@Override
public boolean pipeline(ReturnableExecutor executor) {
return redisCommandClient.pipeline(executor);
}
@Override
public T lock(String key, int timeout, TimeUnit timeUnit, ReturnableExecutor executor) {
return redisLockClient.lock(key, timeout, timeUnit, executor);
}
@Override
public void lock(String key, int timeout, TimeUnit timeUnit, VoidExecutor executor) {
redisLockClient.lock(key, timeout, timeUnit, executor);
}
@Override
public T lock(String key, boolean fair, int timeout, TimeUnit timeUnit, ReturnableExecutor executor) {
return redisLockClient.lock(key, fair, timeout, timeUnit, executor);
}
@Override
public void lock(String key, boolean fair, int timeout, TimeUnit timeUnit, VoidExecutor executor) {
redisLockClient.lock(key, fair, timeout, timeUnit, executor);
}
@Override
public T lock(String key, int timeout, ReturnableExecutor executor) {
return redisLockClient.lock(key,timeout, executor);
}
@Override
public void lock(String key, int timeout, VoidExecutor executor) {
redisLockClient.lock(key,timeout, executor);
}
@Override
public T tryLock(String key, int waitTime, int releaseTime, TimeUnit timeUnit, ReturnableExecutor executor) {
return redisLockClient.tryLock(key, waitTime, releaseTime, timeUnit, executor);
}
@Override
public void tryLock(String key, int waitTime, int releaseTime, TimeUnit timeUnit, VoidExecutor executor) {
redisLockClient.tryLock(key, waitTime, releaseTime, timeUnit, executor);
}
@Override
public T tryLock(String key, int waitTime, int releaseTime, ReturnableExecutor executor) {
return redisLockClient.tryLock(key, waitTime, releaseTime, executor);
}
@Override
public void tryLock(String key, int waitTime, int releaseTime, VoidExecutor executor) {
redisLockClient.tryLock(key, waitTime, releaseTime, executor);
}
@Override
public T readWriteLock(String key, int readTimeout, int writeTimeout, ReturnableExecutor readExecutor, ReturnableExecutor writeExecutor) {
return redisLockClient.readWriteLock(key, readTimeout, writeTimeout, readExecutor, writeExecutor);
}
@Override
public T multiLock(List keys, int timeout, TimeUnit timeUnit, ReturnableExecutor executor) {
return redisLockClient.multiLock(keys, timeout, timeUnit, executor);
}
@Override
public T multiLock(List keys, int timeout, ReturnableExecutor executor) {
return redisLockClient.multiLock(keys, timeout, executor);
}
@Override
public void multiLock(List keys, int timeout, TimeUnit timeUnit, VoidExecutor executor) {
redisLockClient.multiLock(keys, timeout, timeUnit, executor);
}
@Override
public void multiLock(List keys, int timeout, VoidExecutor executor) {
redisLockClient.multiLock(keys, timeout, executor);
}
}