+ remove @Override annotations to allow the code to be compiled on 1.5 (though it requires JDK 6 for its collection support)
This commit is contained in:
@@ -37,7 +37,6 @@ public class DefaultRedisCachePrefix implements RedisCachePrefix {
|
||||
this.delimiter = delimiter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] prefix(String cacheName) {
|
||||
return serializer.serialize((delimiter != null ? cacheName.concat(":") : cacheName));
|
||||
}
|
||||
|
||||
@@ -67,12 +67,10 @@ class RedisCache implements Cache {
|
||||
this.cacheLockName = stringSerializer.serialize(name + "~lock");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
@@ -83,10 +81,10 @@ class RedisCache implements Cache {
|
||||
return template;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public ValueWrapper get(final Object key) {
|
||||
return (ValueWrapper) template.execute(new RedisCallback<ValueWrapper>() {
|
||||
@Override
|
||||
|
||||
public ValueWrapper doInRedis(RedisConnection connection) throws DataAccessException {
|
||||
waitForLock(connection);
|
||||
byte[] bs = connection.get(computeKey(key));
|
||||
@@ -95,7 +93,7 @@ class RedisCache implements Cache {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void put(final Object key, final Object value) {
|
||||
final byte[] k = computeKey(key);
|
||||
|
||||
@@ -112,7 +110,7 @@ class RedisCache implements Cache {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void evict(Object key) {
|
||||
final byte[] k = computeKey(key);
|
||||
|
||||
@@ -126,7 +124,7 @@ class RedisCache implements Cache {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void clear() {
|
||||
// need to del each key individually
|
||||
template.execute(new RedisCallback<Object>() {
|
||||
|
||||
@@ -28,12 +28,12 @@ import org.w3c.dom.Element;
|
||||
*/
|
||||
public class RedisCollectionParser extends AbstractSimpleBeanDefinitionParser {
|
||||
|
||||
@Override
|
||||
|
||||
protected Class<?> getBeanClass(Element element) {
|
||||
return RedisCollectionFactoryBean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected void postProcess(BeanDefinitionBuilder beanDefinition, Element element) {
|
||||
String template = element.getAttribute("template");
|
||||
if (StringUtils.hasText(template)) {
|
||||
@@ -41,7 +41,7 @@ public class RedisCollectionParser extends AbstractSimpleBeanDefinitionParser {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected boolean isEligibleAttribute(String attributeName) {
|
||||
return super.isEligibleAttribute(attributeName) && (!"template".equals(attributeName));
|
||||
}
|
||||
|
||||
@@ -43,13 +43,13 @@ import org.w3c.dom.NamedNodeMap;
|
||||
*/
|
||||
class RedisListenerContainerParser extends AbstractSimpleBeanDefinitionParser {
|
||||
|
||||
@Override
|
||||
|
||||
protected Class<RedisMessageListenerContainer> getBeanClass(Element element) {
|
||||
return RedisMessageListenerContainer.class;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
// parse attributes (but replace the value assignment with references)
|
||||
NamedNodeMap attributes = element.getAttributes();
|
||||
@@ -87,7 +87,7 @@ class RedisListenerContainerParser extends AbstractSimpleBeanDefinitionParser {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected boolean isEligibleAttribute(String attributeName) {
|
||||
return (!"phase".equals(attributeName));
|
||||
}
|
||||
@@ -132,7 +132,7 @@ class RedisListenerContainerParser extends AbstractSimpleBeanDefinitionParser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected boolean shouldGenerateId() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
|
||||
*/
|
||||
class RedisNamespaceHandler extends NamespaceHandlerSupport {
|
||||
|
||||
@Override
|
||||
|
||||
public void init() {
|
||||
registerBeanDefinitionParser("listener-container", new RedisListenerContainerParser());
|
||||
registerBeanDefinitionParser("collection", new RedisCollectionParser());
|
||||
|
||||
@@ -32,17 +32,17 @@ public class DefaultMessage implements Message {
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] getChannel() {
|
||||
return (channel != null ? channel.clone() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] getBody() {
|
||||
return (body != null ? body.clone() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String toString() {
|
||||
if (toString == null){
|
||||
toString = new String(body);
|
||||
|
||||
@@ -68,7 +68,7 @@ public class DefaultSortParameters implements SortParameters {
|
||||
setGetPattern(getPattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] getByPattern() {
|
||||
return byPattern;
|
||||
}
|
||||
@@ -77,7 +77,7 @@ public class DefaultSortParameters implements SortParameters {
|
||||
this.byPattern = byPattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Range getLimit() {
|
||||
return limit;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class DefaultSortParameters implements SortParameters {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[][] getGetPattern() {
|
||||
return getPattern.toArray(new byte[getPattern.size()][]);
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public class DefaultSortParameters implements SortParameters {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Order getOrder() {
|
||||
return order;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public class DefaultSortParameters implements SortParameters {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean isAlphabetic() {
|
||||
return alphabetic;
|
||||
}
|
||||
|
||||
@@ -637,518 +637,518 @@ public class DefaultStringRedisConnection implements StringRedisConnection {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long append(String key, String value) {
|
||||
return delegate.append(serialize(key), serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<String> bLPop(int timeout, String... keys) {
|
||||
return deserialize(delegate.bLPop(timeout, serializeMulti(keys)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<String> bRPop(int timeout, String... keys) {
|
||||
return deserialize(delegate.bRPop(timeout, serializeMulti(keys)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String bRPopLPush(int timeout, String srcKey, String dstKey) {
|
||||
return deserialize(delegate.bRPopLPush(timeout, serialize(srcKey), serialize(dstKey)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long decr(String key) {
|
||||
return delegate.decr(serialize(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long decrBy(String key, long value) {
|
||||
return delegate.decrBy(serialize(key), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long del(String... keys) {
|
||||
return delegate.del(serializeMulti(keys));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String echo(String message) {
|
||||
return deserialize(delegate.echo(serialize(message)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean exists(String key) {
|
||||
return delegate.exists(serialize(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean expire(String key, long seconds) {
|
||||
return delegate.expire(serialize(key), seconds);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean expireAt(String key, long unixTime) {
|
||||
return delegate.expireAt(serialize(key), unixTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String get(String key) {
|
||||
return deserialize(delegate.get(serialize(key)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean getBit(String key, long offset) {
|
||||
return delegate.getBit(serialize(key), offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String getRange(String key, long start, long end) {
|
||||
return deserialize(delegate.getRange(serialize(key), start, end));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String getSet(String key, String value) {
|
||||
return deserialize(delegate.getSet(serialize(key), serialize(value)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean hDel(String key, String field) {
|
||||
return delegate.hDel(serialize(key), serialize(field));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean hExists(String key, String field) {
|
||||
return delegate.hExists(serialize(key), serialize(field));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String hGet(String key, String field) {
|
||||
return deserialize(delegate.hGet(serialize(key), serialize(field)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Map<String, String> hGetAll(String key) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long hIncrBy(String key, String field, long delta) {
|
||||
return delegate.hIncrBy(serialize(key), serialize(field), delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<String> hKeys(String key) {
|
||||
return deserialize(delegate.hKeys(serialize(key)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long hLen(String key) {
|
||||
return delegate.hLen(serialize(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<String> hMGet(String key, String... fields) {
|
||||
return deserialize(delegate.hMGet(serialize(key), serializeMulti(fields)));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public void hMSet(String key, Map<String, String> hashes) {
|
||||
delegate.hMSet(serialize(key), serialize(hashes));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean hSet(String key, String field, String value) {
|
||||
return delegate.hSet(serialize(key), serialize(field), serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean hSetNX(String key, String field, String value) {
|
||||
return delegate.hSetNX(serialize(key), serialize(field), serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<String> hVals(String key) {
|
||||
return deserialize(delegate.hVals(serialize(key)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long incr(String key) {
|
||||
return delegate.incr(serialize(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long incrBy(String key, long value) {
|
||||
return delegate.incrBy(serialize(key), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Collection<String> keys(String pattern) {
|
||||
return deserialize(delegate.keys(serialize(pattern)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String lIndex(String key, long index) {
|
||||
return deserialize(delegate.lIndex(serialize(key), index));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long lInsert(String key, Position where, String pivot, String value) {
|
||||
return delegate.lInsert(serialize(key), where, serialize(pivot), serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long lLen(String key) {
|
||||
return delegate.lLen(serialize(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String lPop(String key) {
|
||||
return deserialize(delegate.lPop(serialize(key)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long lPush(String key, String value) {
|
||||
return delegate.lPush(serialize(key), serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long lPushX(String key, String value) {
|
||||
return delegate.lPushX(serialize(key), serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<String> lRange(String key, long start, long end) {
|
||||
return deserialize(delegate.lRange(serialize(key), start, end));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long lRem(String key, long count, String value) {
|
||||
return delegate.lRem(serialize(key), count, serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void lSet(String key, long index, String value) {
|
||||
delegate.lSet(serialize(key), index, serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void lTrim(String key, long start, long end) {
|
||||
delegate.lTrim(serialize(key), start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<String> mGet(String... keys) {
|
||||
return deserialize(delegate.mGet(serializeMulti(keys)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void mSetNXString(Map<String, String> tuple) {
|
||||
delegate.mSetNX(serialize(tuple));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void mSetString(Map<String, String> tuple) {
|
||||
delegate.mSet(serialize(tuple));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean persist(String key) {
|
||||
return delegate.persist(serialize(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean move(String key, int dbIndex) {
|
||||
return delegate.move(serialize(key), dbIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void pSubscribe(MessageListener listener, String... patterns) {
|
||||
delegate.pSubscribe(listener, serializeMulti(patterns));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long publish(String channel, String message) {
|
||||
return delegate.publish(serialize(channel), serialize(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void rename(String oldName, String newName) {
|
||||
delegate.rename(serialize(oldName), serialize(newName));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean renameNX(String oldName, String newName) {
|
||||
return delegate.renameNX(serialize(oldName), serialize(newName));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String rPop(String key) {
|
||||
return deserialize(delegate.rPop(serialize(key)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String rPopLPush(String srcKey, String dstKey) {
|
||||
return deserialize(delegate.rPopLPush(serialize(srcKey), serialize(dstKey)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long rPush(String key, String value) {
|
||||
return delegate.rPush(serialize(key), serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long rPushX(String key, String value) {
|
||||
return delegate.rPushX(serialize(key), serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean sAdd(String key, String value) {
|
||||
return delegate.sAdd(serialize(key), serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long sCard(String key) {
|
||||
return delegate.sCard(serialize(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<String> sDiff(String... keys) {
|
||||
return deserialize(delegate.sDiff(serializeMulti(keys)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void sDiffStore(String destKey, String... keys) {
|
||||
delegate.sDiffStore(serialize(destKey), serializeMulti(keys));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void set(String key, String value) {
|
||||
delegate.set(serialize(key), serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void setBit(String key, long offset, boolean value) {
|
||||
delegate.setBit(serialize(key), offset, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void setEx(String key, long seconds, String value) {
|
||||
delegate.setEx(serialize(key), seconds, serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean setNX(String key, String value) {
|
||||
return delegate.setNX(serialize(key), serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void setRange(String key, String value, long start) {
|
||||
delegate.setRange(serialize(key), serialize(value), start);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<String> sInter(String... keys) {
|
||||
return deserialize(delegate.sInter(serializeMulti(keys)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void sInterStore(String destKey, String... keys) {
|
||||
delegate.sInterStore(serialize(destKey), serializeMulti(keys));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean sIsMember(String key, String value) {
|
||||
return delegate.sIsMember(serialize(key), serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<String> sMembers(String key) {
|
||||
return deserialize(delegate.sMembers(serialize(key)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean sMove(String srcKey, String destKey, String value) {
|
||||
return delegate.sMove(serialize(srcKey), serialize(destKey), serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long sort(String key, SortParameters params, String storeKey) {
|
||||
return delegate.sort(serialize(key), params, serialize(storeKey));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<String> sort(String key, SortParameters params) {
|
||||
return deserialize(delegate.sort(serialize(key), params));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String sPop(String key) {
|
||||
return deserialize(delegate.sPop(serialize(key)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String sRandMember(String key) {
|
||||
return deserialize(delegate.sRandMember(serialize(key)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean sRem(String key, String value) {
|
||||
return delegate.sRem(serialize(key), serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long strLen(String key) {
|
||||
return delegate.strLen(serialize(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void subscribe(MessageListener listener, String... channels) {
|
||||
delegate.subscribe(listener, serializeMulti(channels));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<String> sUnion(String... keys) {
|
||||
return deserialize(delegate.sUnion(serializeMulti(keys)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void sUnionStore(String destKey, String... keys) {
|
||||
delegate.sUnionStore(serialize(destKey), serializeMulti(keys));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long ttl(String key) {
|
||||
return delegate.ttl(serialize(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public DataType type(String key) {
|
||||
return delegate.type(serialize(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean zAdd(String key, double score, String value) {
|
||||
return delegate.zAdd(serialize(key), score, serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zCard(String key) {
|
||||
return delegate.zCard(serialize(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zCount(String key, double min, double max) {
|
||||
return delegate.zCount(serialize(key), min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Double zIncrBy(String key, double increment, String value) {
|
||||
return delegate.zIncrBy(serialize(key), increment, serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zInterStore(String destKey, Aggregate aggregate, int[] weights, String... sets) {
|
||||
return delegate.zInterStore(serialize(destKey), aggregate, weights, serializeMulti(sets));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zInterStore(String destKey, String... sets) {
|
||||
return delegate.zInterStore(serialize(destKey), serializeMulti(sets));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<String> zRange(String key, long start, long end) {
|
||||
return deserialize(delegate.zRange(serialize(key), start, end));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<String> zRangeByScore(String key, double min, double max, long offset, long count) {
|
||||
return deserialize(delegate.zRangeByScore(serialize(key), min, max, offset, count));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<String> zRangeByScore(String key, double min, double max) {
|
||||
return deserialize(delegate.zRangeByScore(serialize(key), min, max));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<StringTuple> zRangeByScoreWithScores(String key, double min, double max, long offset, long count) {
|
||||
return deserializeTuple(delegate.zRangeByScoreWithScores(serialize(key), min, max, offset, count));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<StringTuple> zRangeByScoreWithScores(String key, double min, double max) {
|
||||
return deserializeTuple(delegate.zRangeByScoreWithScores(serialize(key), min, max));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<StringTuple> zRangeWithScores(String key, long start, long end) {
|
||||
return deserializeTuple(delegate.zRangeWithScores(serialize(key), start, end));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zRank(String key, String value) {
|
||||
return delegate.zRank(serialize(key), serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean zRem(String key, String value) {
|
||||
return delegate.zRem(serialize(key), serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zRemRange(String key, long start, long end) {
|
||||
return delegate.zRemRange(serialize(key), start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zRemRangeByScore(String key, double min, double max) {
|
||||
return delegate.zRemRangeByScore(serialize(key), min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<String> zRevRange(String key, long start, long end) {
|
||||
return deserialize(delegate.zRevRange(serialize(key), start, end));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<StringTuple> zRevRangeWithScores(String key, long start, long end) {
|
||||
return deserializeTuple(delegate.zRevRangeWithScores(serialize(key), start, end));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zRevRank(String key, String value) {
|
||||
return delegate.zRevRank(serialize(key), serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Double zScore(String key, String value) {
|
||||
return delegate.zScore(serialize(key), serialize(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zUnionStore(String destKey, Aggregate aggregate, int[] weights, String... sets) {
|
||||
return delegate.zUnionStore(serialize(destKey), aggregate, weights, serializeMulti(sets));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zUnionStore(String destKey, String... sets) {
|
||||
return delegate.zUnionStore(serialize(destKey), serializeMulti(sets));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<Object> closePipeline() {
|
||||
return delegate.closePipeline();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean isPipelined() {
|
||||
return delegate.isPipelined();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void openPipeline() {
|
||||
delegate.openPipeline();
|
||||
}
|
||||
|
||||
@@ -50,12 +50,12 @@ public class DefaultStringTuple extends DefaultTuple implements StringTuple {
|
||||
this.valueAsString = valueAsString;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String getValueAsString() {
|
||||
return valueAsString;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
@@ -63,7 +63,7 @@ public class DefaultStringTuple extends DefaultTuple implements StringTuple {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (super.equals(obj)) {
|
||||
if (!(obj instanceof DefaultStringTuple))
|
||||
|
||||
@@ -41,17 +41,17 @@ public class DefaultTuple implements Tuple {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Double getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
@@ -71,7 +71,7 @@ public class DefaultTuple implements Tuple {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
@@ -80,7 +80,7 @@ public class DefaultTuple implements Tuple {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int compareTo(Double o) {
|
||||
Double d = (score == null ? Double.valueOf(0.0d) : score);
|
||||
Double a = (o == null ? Double.valueOf(0.0d) : o);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -150,7 +150,7 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean,
|
||||
null, dbIndex)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
|
||||
return JedisUtils.convertJedisAccessException(ex);
|
||||
}
|
||||
|
||||
@@ -35,32 +35,32 @@ class JedisMessageListener extends BinaryJedisPubSub {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void onMessage(byte[] channel, byte[] message) {
|
||||
listener.onMessage(new DefaultMessage(channel, message), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void onPMessage(byte[] pattern, byte[] channel, byte[] message) {
|
||||
listener.onMessage(new DefaultMessage(channel, message), pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void onPSubscribe(byte[] pattern, int subscribedChannels) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void onPUnsubscribe(byte[] pattern, int subscribedChannels) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void onSubscribe(byte[] channel, int subscribedChannels) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void onUnsubscribe(byte[] channel, int subscribedChannels) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@@ -34,18 +34,18 @@ class JedisSubscription extends AbstractSubscription {
|
||||
this.jedisPubSub = jedisPubSub;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected void doClose() {
|
||||
jedisPubSub.unsubscribe();
|
||||
jedisPubSub.punsubscribe();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected void doPsubscribe(byte[]... patterns) {
|
||||
jedisPubSub.psubscribe(patterns);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected void doPUnsubscribe(boolean all, byte[]... patterns) {
|
||||
if (all) {
|
||||
jedisPubSub.punsubscribe();
|
||||
@@ -55,12 +55,12 @@ class JedisSubscription extends AbstractSubscription {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected void doSubscribe(byte[]... channels) {
|
||||
jedisPubSub.subscribe(channels);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected void doUnsubscribe(boolean all, byte[]... channels) {
|
||||
if (all) {
|
||||
jedisPubSub.unsubscribe();
|
||||
|
||||
@@ -73,7 +73,7 @@ public class JredisConnection implements RedisConnection {
|
||||
return new RedisSystemException("Unknown JRedis exception", ex);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void close() throws RedisSystemException {
|
||||
isClosed = true;
|
||||
|
||||
@@ -88,37 +88,37 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public JRedis getNativeConnection() {
|
||||
return jredis;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean isClosed() {
|
||||
return isClosed;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean isQueueing() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean isPipelined() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void openPipeline() {
|
||||
throw new UnsupportedOperationException("Pipelining not supported by JRedis");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<Object> closePipeline() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<byte[]> sort(byte[] key, SortParameters params) {
|
||||
Sort sort = jredis.sort(JredisUtils.decode(key));
|
||||
JredisUtils.applySortingParams(sort, params, null);
|
||||
@@ -129,7 +129,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long sort(byte[] key, SortParameters params, byte[] storeKey) {
|
||||
Sort sort = jredis.sort(JredisUtils.decode(key));
|
||||
JredisUtils.applySortingParams(sort, params, null);
|
||||
@@ -140,7 +140,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long dbSize() {
|
||||
try {
|
||||
return jredis.dbsize();
|
||||
@@ -149,7 +149,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void flushDb() {
|
||||
try {
|
||||
jredis.flushdb();
|
||||
@@ -158,7 +158,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void flushAll() {
|
||||
try {
|
||||
jredis.flushall();
|
||||
@@ -167,7 +167,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] echo(byte[] message) {
|
||||
try {
|
||||
return jredis.echo(message);
|
||||
@@ -176,7 +176,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String ping() {
|
||||
try {
|
||||
jredis.ping();
|
||||
@@ -186,7 +186,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void bgSave() {
|
||||
try {
|
||||
jredis.bgsave();
|
||||
@@ -195,7 +195,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void bgWriteAof() {
|
||||
try {
|
||||
jredis.bgrewriteaof();
|
||||
@@ -204,7 +204,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void save() {
|
||||
try {
|
||||
jredis.save();
|
||||
@@ -213,12 +213,12 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<String> getConfig(String pattern) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Properties info() {
|
||||
try {
|
||||
return JredisUtils.info(jredis.info());
|
||||
@@ -227,7 +227,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long lastSave() {
|
||||
try {
|
||||
return jredis.lastsave();
|
||||
@@ -236,22 +236,22 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void setConfig(String param, String value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void resetConfigStats() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void shutdown() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long del(byte[]... keys) {
|
||||
try {
|
||||
return jredis.del(JredisUtils.decodeMultiple(keys));
|
||||
@@ -260,7 +260,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void discard() {
|
||||
try {
|
||||
jredis.discard();
|
||||
@@ -269,12 +269,12 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<Object> exec() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean exists(byte[] key) {
|
||||
try {
|
||||
return jredis.exists(JredisUtils.decode(key));
|
||||
@@ -283,7 +283,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean expire(byte[] key, long seconds) {
|
||||
try {
|
||||
return jredis.expire(JredisUtils.decode(key), (int) seconds);
|
||||
@@ -292,7 +292,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean expireAt(byte[] key, long unixTime) {
|
||||
try {
|
||||
return jredis.expireat(JredisUtils.decode(key), unixTime);
|
||||
@@ -301,7 +301,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<byte[]> keys(byte[] pattern) {
|
||||
try {
|
||||
return JredisUtils.convertToSet(jredis.keys(JredisUtils.decode(pattern)));
|
||||
@@ -310,18 +310,18 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void multi() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean persist(byte[] key) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean move(byte[] key, int dbIndex) {
|
||||
try {
|
||||
return jredis.move(JredisUtils.decode(key), dbIndex);
|
||||
@@ -330,7 +330,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] randomKey() {
|
||||
try {
|
||||
return JredisUtils.encode(jredis.randomkey());
|
||||
@@ -339,7 +339,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void rename(byte[] oldName, byte[] newName) {
|
||||
try {
|
||||
jredis.rename(JredisUtils.decode(oldName), JredisUtils.decode(newName));
|
||||
@@ -348,7 +348,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean renameNX(byte[] oldName, byte[] newName) {
|
||||
try {
|
||||
return jredis.renamenx(JredisUtils.decode(oldName), JredisUtils.decode(newName));
|
||||
@@ -357,12 +357,12 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void select(int dbIndex) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long ttl(byte[] key) {
|
||||
try {
|
||||
return jredis.ttl(JredisUtils.decode(key));
|
||||
@@ -371,7 +371,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public DataType type(byte[] key) {
|
||||
try {
|
||||
return JredisUtils.convertDataType(jredis.type(JredisUtils.decode(key)));
|
||||
@@ -380,12 +380,12 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void unwatch() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void watch(byte[]... keys) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@@ -394,7 +394,7 @@ public class JredisConnection implements RedisConnection {
|
||||
// String operations
|
||||
//
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] get(byte[] key) {
|
||||
try {
|
||||
return jredis.get(JredisUtils.decode(key));
|
||||
@@ -403,7 +403,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void set(byte[] key, byte[] value) {
|
||||
try {
|
||||
jredis.set(JredisUtils.decode(key), value);
|
||||
@@ -412,7 +412,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] getSet(byte[] key, byte[] value) {
|
||||
try {
|
||||
return jredis.getset(JredisUtils.decode(key), value);
|
||||
@@ -421,7 +421,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long append(byte[] key, byte[] value) {
|
||||
try {
|
||||
return jredis.append(JredisUtils.decode(key), value);
|
||||
@@ -430,7 +430,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<byte[]> mGet(byte[]... keys) {
|
||||
try {
|
||||
return jredis.mget(JredisUtils.decodeMultiple(keys));
|
||||
@@ -439,7 +439,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void mSet(Map<byte[], byte[]> tuple) {
|
||||
try {
|
||||
jredis.mset(JredisUtils.decodeMap(tuple));
|
||||
@@ -448,7 +448,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void mSetNX(Map<byte[], byte[]> tuple) {
|
||||
try {
|
||||
jredis.msetnx(JredisUtils.decodeMap(tuple));
|
||||
@@ -457,12 +457,12 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void setEx(byte[] key, long seconds, byte[] value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean setNX(byte[] key, byte[] value) {
|
||||
try {
|
||||
return jredis.setnx(JredisUtils.decode(key), value);
|
||||
@@ -471,7 +471,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] getRange(byte[] key, long start, long end) {
|
||||
try {
|
||||
return jredis.substr(JredisUtils.decode(key), start, end);
|
||||
@@ -480,7 +480,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long decr(byte[] key) {
|
||||
try {
|
||||
return jredis.decr(JredisUtils.decode(key));
|
||||
@@ -489,7 +489,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long decrBy(byte[] key, long value) {
|
||||
try {
|
||||
return jredis.decrby(JredisUtils.decode(key), (int) value);
|
||||
@@ -498,7 +498,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long incr(byte[] key) {
|
||||
try {
|
||||
return jredis.incr(JredisUtils.decode(key));
|
||||
@@ -507,7 +507,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long incrBy(byte[] key, long value) {
|
||||
try {
|
||||
return jredis.incrby(JredisUtils.decode(key), (int) value);
|
||||
@@ -516,22 +516,22 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean getBit(byte[] key, long offset) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void setBit(byte[] key, long offset, boolean value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void setRange(byte[] key, byte[] value, long start) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long strLen(byte[] key) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@@ -540,17 +540,17 @@ public class JredisConnection implements RedisConnection {
|
||||
// List commands
|
||||
//
|
||||
|
||||
@Override
|
||||
|
||||
public List<byte[]> bLPop(int timeout, byte[]... keys) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<byte[]> bRPop(int timeout, byte[]... keys) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] lIndex(byte[] key, long index) {
|
||||
try {
|
||||
return jredis.lindex(JredisUtils.decode(key), index);
|
||||
@@ -559,7 +559,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long lLen(byte[] key) {
|
||||
try {
|
||||
return jredis.llen(JredisUtils.decode(key));
|
||||
@@ -568,7 +568,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] lPop(byte[] key) {
|
||||
try {
|
||||
return jredis.lpop(JredisUtils.decode(key));
|
||||
@@ -577,7 +577,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long lPush(byte[] key, byte[] value) {
|
||||
try {
|
||||
jredis.lpush(JredisUtils.decode(key), value);
|
||||
@@ -587,7 +587,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<byte[]> lRange(byte[] key, long start, long end) {
|
||||
try {
|
||||
List<byte[]> lrange = jredis.lrange(JredisUtils.decode(key), start, end);
|
||||
@@ -598,7 +598,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long lRem(byte[] key, long count, byte[] value) {
|
||||
try {
|
||||
return jredis.lrem(JredisUtils.decode(key), value, (int) count);
|
||||
@@ -607,7 +607,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void lSet(byte[] key, long index, byte[] value) {
|
||||
try {
|
||||
jredis.lset(JredisUtils.decode(key), index, value);
|
||||
@@ -616,7 +616,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void lTrim(byte[] key, long start, long end) {
|
||||
try {
|
||||
jredis.ltrim(JredisUtils.decode(key), start, end);
|
||||
@@ -625,7 +625,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] rPop(byte[] key) {
|
||||
try {
|
||||
return jredis.rpop(JredisUtils.decode(key));
|
||||
@@ -634,7 +634,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] rPopLPush(byte[] srcKey, byte[] dstKey) {
|
||||
try {
|
||||
return jredis.rpoplpush(JredisUtils.decode(srcKey), JredisUtils.decode(dstKey));
|
||||
@@ -643,7 +643,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long rPush(byte[] key, byte[] value) {
|
||||
try {
|
||||
jredis.rpush(JredisUtils.decode(key), value);
|
||||
@@ -653,22 +653,22 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long lInsert(byte[] key, Position where, byte[] pivot, byte[] value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] bRPopLPush(int timeout, byte[] srcKey, byte[] dstKey) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long lPushX(byte[] key, byte[] value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long rPushX(byte[] key, byte[] value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@@ -678,7 +678,7 @@ public class JredisConnection implements RedisConnection {
|
||||
// Set commands
|
||||
//
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean sAdd(byte[] key, byte[] value) {
|
||||
try {
|
||||
return jredis.sadd(JredisUtils.decode(key), value);
|
||||
@@ -687,7 +687,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long sCard(byte[] key) {
|
||||
try {
|
||||
return jredis.scard(JredisUtils.decode(key));
|
||||
@@ -696,7 +696,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<byte[]> sDiff(byte[]... keys) {
|
||||
String destKey = JredisUtils.decode(keys[0]);
|
||||
String[] sets = JredisUtils.decodeMultiple(Arrays.copyOfRange(keys, 1, keys.length));
|
||||
@@ -709,7 +709,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void sDiffStore(byte[] destKey, byte[]... keys) {
|
||||
String destSet = JredisUtils.decode(destKey);
|
||||
String[] sets = JredisUtils.decodeMultiple(keys);
|
||||
@@ -721,7 +721,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<byte[]> sInter(byte[]... keys) {
|
||||
String set1 = JredisUtils.decode(keys[0]);
|
||||
String[] sets = JredisUtils.decodeMultiple(Arrays.copyOfRange(keys, 1, keys.length));
|
||||
@@ -734,7 +734,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void sInterStore(byte[] destKey, byte[]... keys) {
|
||||
String destSet = JredisUtils.decode(destKey);
|
||||
String[] sets = JredisUtils.decodeMultiple(keys);
|
||||
@@ -746,7 +746,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean sIsMember(byte[] key, byte[] value) {
|
||||
try {
|
||||
return jredis.sismember(JredisUtils.decode(key), value);
|
||||
@@ -755,7 +755,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<byte[]> sMembers(byte[] key) {
|
||||
try {
|
||||
return new LinkedHashSet<byte[]>(jredis.smembers(JredisUtils.decode(key)));
|
||||
@@ -764,7 +764,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean sMove(byte[] srcKey, byte[] destKey, byte[] value) {
|
||||
try {
|
||||
return jredis.smove(JredisUtils.decode(srcKey), JredisUtils.decode(destKey), value);
|
||||
@@ -773,7 +773,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] sPop(byte[] key) {
|
||||
try {
|
||||
return jredis.spop(JredisUtils.decode(key));
|
||||
@@ -782,7 +782,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] sRandMember(byte[] key) {
|
||||
try {
|
||||
return jredis.srandmember(JredisUtils.decode(key));
|
||||
@@ -791,7 +791,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean sRem(byte[] key, byte[] value) {
|
||||
try {
|
||||
return jredis.srem(JredisUtils.decode(key), value);
|
||||
@@ -800,7 +800,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<byte[]> sUnion(byte[]... keys) {
|
||||
String set1 = JredisUtils.decode(keys[0]);
|
||||
String[] sets = JredisUtils.decodeMultiple(Arrays.copyOfRange(keys, 1, keys.length));
|
||||
@@ -812,7 +812,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void sUnionStore(byte[] destKey, byte[]... keys) {
|
||||
String destSet = JredisUtils.decode(destKey);
|
||||
String[] sets = JredisUtils.decodeMultiple(keys);
|
||||
@@ -829,7 +829,7 @@ public class JredisConnection implements RedisConnection {
|
||||
// ZSet commands
|
||||
//
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean zAdd(byte[] key, double score, byte[] value) {
|
||||
try {
|
||||
return jredis.zadd(JredisUtils.decode(key), score, value);
|
||||
@@ -838,7 +838,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zCard(byte[] key) {
|
||||
try {
|
||||
return jredis.zcard(JredisUtils.decode(key));
|
||||
@@ -847,7 +847,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zCount(byte[] key, double min, double max) {
|
||||
try {
|
||||
return jredis.zcount(JredisUtils.decode(key), min, max);
|
||||
@@ -856,7 +856,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Double zIncrBy(byte[] key, double increment, byte[] value) {
|
||||
try {
|
||||
return jredis.zincrby(JredisUtils.decode(key), increment, value);
|
||||
@@ -865,17 +865,17 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zInterStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zInterStore(byte[] destKey, byte[]... sets) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<byte[]> zRange(byte[] key, long start, long end) {
|
||||
try {
|
||||
return new LinkedHashSet<byte[]>(jredis.zrange(JredisUtils.decode(key), start, end));
|
||||
@@ -884,12 +884,12 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<Tuple> zRangeWithScores(byte[] key, long start, long end) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<byte[]> zRangeByScore(byte[] key, double min, double max) {
|
||||
try {
|
||||
return new LinkedHashSet<byte[]>(jredis.zrangebyscore(JredisUtils.decode(key), min, max));
|
||||
@@ -898,42 +898,42 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<Tuple> zRangeByScoreWithScores(byte[] key, double min, double max) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<byte[]> zRangeByScore(byte[] key, double min, double max, long offset, long count) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<Tuple> zRangeByScoreWithScores(byte[] key, double min, double max, long offset, long count) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<byte[]> zRevRangeByScore(byte[] key, double min, double max, long offset, long count) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<byte[]> zRevRangeByScore(byte[] key, double min, double max) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<Tuple> zRevRangeByScoreWithScores(byte[] key, double min, double max, long offset, long count) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<Tuple> zRevRangeByScoreWithScores(byte[] key, double min, double max) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zRank(byte[] key, byte[] value) {
|
||||
try {
|
||||
return jredis.zrank(JredisUtils.decode(key), value);
|
||||
@@ -942,7 +942,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean zRem(byte[] key, byte[] value) {
|
||||
try {
|
||||
return jredis.zrem(JredisUtils.decode(key), value);
|
||||
@@ -951,7 +951,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zRemRange(byte[] key, long start, long end) {
|
||||
try {
|
||||
return jredis.zremrangebyrank(JredisUtils.decode(key), start, end);
|
||||
@@ -960,7 +960,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zRemRangeByScore(byte[] key, double min, double max) {
|
||||
try {
|
||||
return jredis.zremrangebyscore(JredisUtils.decode(key), min, max);
|
||||
@@ -969,7 +969,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<byte[]> zRevRange(byte[] key, long start, long end) {
|
||||
try {
|
||||
return new LinkedHashSet<byte[]>(jredis.zrevrange(JredisUtils.decode(key), start, end));
|
||||
@@ -978,12 +978,12 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<Tuple> zRevRangeWithScores(byte[] key, long start, long end) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zRevRank(byte[] key, byte[] value) {
|
||||
try {
|
||||
return jredis.zrevrank(JredisUtils.decode(key), value);
|
||||
@@ -992,7 +992,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Double zScore(byte[] key, byte[] value) {
|
||||
try {
|
||||
return jredis.zscore(JredisUtils.decode(key), value);
|
||||
@@ -1006,17 +1006,17 @@ public class JredisConnection implements RedisConnection {
|
||||
// Hash commands
|
||||
//
|
||||
|
||||
@Override
|
||||
|
||||
public Long zUnionStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long zUnionStore(byte[] destKey, byte[]... sets) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean hDel(byte[] key, byte[] field) {
|
||||
try {
|
||||
return jredis.hdel(JredisUtils.decode(key), JredisUtils.decode(field));
|
||||
@@ -1025,7 +1025,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean hExists(byte[] key, byte[] field) {
|
||||
try {
|
||||
return jredis.hexists(JredisUtils.decode(key), JredisUtils.decode(field));
|
||||
@@ -1034,7 +1034,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] hGet(byte[] key, byte[] field) {
|
||||
try {
|
||||
return jredis.hget(JredisUtils.decode(key), JredisUtils.decode(field));
|
||||
@@ -1043,7 +1043,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Map<byte[], byte[]> hGetAll(byte[] key) {
|
||||
try {
|
||||
return JredisUtils.encodeMap(jredis.hgetall(JredisUtils.decode(key)));
|
||||
@@ -1052,12 +1052,12 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long hIncrBy(byte[] key, byte[] field, long delta) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<byte[]> hKeys(byte[] key) {
|
||||
try {
|
||||
return new LinkedHashSet<byte[]>(JredisUtils.convertToSet(jredis.hkeys(JredisUtils.decode(key))));
|
||||
@@ -1066,7 +1066,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long hLen(byte[] key) {
|
||||
try {
|
||||
return jredis.hlen(JredisUtils.decode(key));
|
||||
@@ -1075,17 +1075,17 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<byte[]> hMGet(byte[] key, byte[]... fields) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void hMSet(byte[] key, Map<byte[], byte[]> values) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean hSet(byte[] key, byte[] field, byte[] value) {
|
||||
try {
|
||||
return jredis.hset(JredisUtils.decode(key), JredisUtils.decode(field), value);
|
||||
@@ -1094,12 +1094,12 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean hSetNX(byte[] key, byte[] field, byte[] value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<byte[]> hVals(byte[] key) {
|
||||
try {
|
||||
return jredis.hvals(JredisUtils.decode(key));
|
||||
@@ -1112,27 +1112,27 @@ public class JredisConnection implements RedisConnection {
|
||||
// PubSub commands
|
||||
//
|
||||
|
||||
@Override
|
||||
|
||||
public Subscription getSubscription() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean isSubscribed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void pSubscribe(MessageListener listener, byte[]... patterns) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long publish(byte[] channel, byte[] message) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void subscribe(MessageListener listener, byte[]... channels) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class JredisConnectionFactory implements InitializingBean, DisposableBean
|
||||
this.connectionSpec = connectionSpec;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void afterPropertiesSet() {
|
||||
if (connectionSpec == null) {
|
||||
Assert.hasText(hostName);
|
||||
@@ -95,7 +95,7 @@ public class JredisConnectionFactory implements InitializingBean, DisposableBean
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public void destroy() {
|
||||
if (usePool && pool != null) {
|
||||
pool.quit();
|
||||
@@ -104,7 +104,7 @@ public class JredisConnectionFactory implements InitializingBean, DisposableBean
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public RedisConnection getConnection() {
|
||||
return postProcessConnection(new JredisConnection((usePool ? pool : new JRedisClient(connectionSpec))));
|
||||
}
|
||||
@@ -122,7 +122,7 @@ public class JredisConnectionFactory implements InitializingBean, DisposableBean
|
||||
return connection;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
|
||||
if (ex instanceof ClientRuntimeException) {
|
||||
return JredisUtils.convertJredisAccessException((ClientRuntimeException) ex);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -85,7 +85,7 @@ public class RjcConnectionFactory implements InitializingBean, DisposableBean, R
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisConnection getConnection() {
|
||||
return postProcessConnection(new RjcConnection(dataSource.getConnection(), dbIndex));
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class RjcConnectionFactory implements InitializingBean, DisposableBean, R
|
||||
return connection;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
|
||||
return RjcUtils.convertRjcAccessException(ex);
|
||||
}
|
||||
|
||||
@@ -32,12 +32,12 @@ class RjcMessageListener implements MessageListener, PMessageListener {
|
||||
this.listener = messageListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void onMessage(String channel, String message) {
|
||||
listener.onMessage(new DefaultMessage(RjcUtils.encode(channel), RjcUtils.encode(message)), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void onMessage(String pattern, String channel, String message) {
|
||||
listener.onMessage(new DefaultMessage(RjcUtils.encode(channel), RjcUtils.encode(message)),
|
||||
RjcUtils.encode(pattern));
|
||||
|
||||
@@ -35,27 +35,27 @@ class RjcSubscription extends AbstractSubscription {
|
||||
subscriber.setPMessageListener(new RjcMessageListener(listener));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected void doClose() {
|
||||
subscriber.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected void doPsubscribe(byte[]... patterns) {
|
||||
subscriber.psubscribe(RjcUtils.decodeMultiple(patterns));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected void doPUnsubscribe(boolean all, byte[]... patterns) {
|
||||
subscriber.punsubscribe(RjcUtils.decodeMultiple(patterns));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected void doSubscribe(byte[]... channels) {
|
||||
subscriber.subscribe(RjcUtils.decodeMultiple(channels));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected void doUnsubscribe(boolean all, byte[]... channels) {
|
||||
subscriber.punsubscribe(RjcUtils.decodeMultiple(channels));
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class SingleDataSource implements DataSource {
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisConnection getConnection() {
|
||||
return connection;
|
||||
}
|
||||
|
||||
@@ -98,26 +98,26 @@ public abstract class AbstractSubscription implements Subscription {
|
||||
*/
|
||||
protected abstract void doClose();
|
||||
|
||||
@Override
|
||||
|
||||
public MessageListener getListener() {
|
||||
return listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Collection<byte[]> getChannels() {
|
||||
synchronized (channels) {
|
||||
return clone(channels);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Collection<byte[]> getPatterns() {
|
||||
synchronized (patterns) {
|
||||
return clone(patterns);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void pSubscribe(byte[]... patterns) {
|
||||
checkPulse();
|
||||
|
||||
@@ -130,13 +130,13 @@ public abstract class AbstractSubscription implements Subscription {
|
||||
doPsubscribe(patterns);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void pUnsubscribe() {
|
||||
pUnsubscribe((byte[][]) null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public void subscribe(byte[]... channels) {
|
||||
checkPulse();
|
||||
|
||||
@@ -149,12 +149,12 @@ public abstract class AbstractSubscription implements Subscription {
|
||||
doSubscribe(channels);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void unsubscribe() {
|
||||
unsubscribe((byte[][]) null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void pUnsubscribe(byte[]... patts) {
|
||||
if (!isAlive()) {
|
||||
return;
|
||||
@@ -184,7 +184,7 @@ public abstract class AbstractSubscription implements Subscription {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void unsubscribe(byte[]... chans) {
|
||||
if (!isAlive()) {
|
||||
return;
|
||||
@@ -214,7 +214,7 @@ public abstract class AbstractSubscription implements Subscription {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean isAlive() {
|
||||
return alive.get();
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class ByteArrayWrapper {
|
||||
this.hashCode = Arrays.hashCode(array);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof ByteArrayWrapper) {
|
||||
return Arrays.equals(array, ((ByteArrayWrapper) obj).array);
|
||||
@@ -41,7 +41,7 @@ public class ByteArrayWrapper {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int hashCode() {
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ abstract class AbstractOperations<K, V> {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public final V doInRedis(RedisConnection connection) {
|
||||
byte[] result = inRedis(rawKey(key), connection);
|
||||
return deserializeValue(result);
|
||||
|
||||
@@ -41,72 +41,72 @@ class DefaultBoundHashOperations<H, HK, HV> extends DefaultBoundKeyOperations<H>
|
||||
this.ops = operations.opsForHash();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void delete(Object key) {
|
||||
ops.delete(getKey(), key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public HV get(Object key) {
|
||||
return ops.get(getKey(), key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Collection<HV> multiGet(Collection<HK> hashKeys) {
|
||||
return ops.multiGet(getKey(), hashKeys);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisOperations<H, ?> getOperations() {
|
||||
return ops.getOperations();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean hasKey(Object key) {
|
||||
return ops.hasKey(getKey(), key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long increment(HK key, long delta) {
|
||||
return ops.increment(getKey(), key, delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<HK> keys() {
|
||||
return ops.keys(getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long size() {
|
||||
return ops.size(getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void putAll(Map<? extends HK, ? extends HV> m) {
|
||||
ops.putAll(getKey(), m);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void put(HK key, HV value) {
|
||||
ops.put(getKey(), key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean putIfAbsent(HK key, HV value) {
|
||||
return ops.putIfAbsent(getKey(), key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Collection<HV> values() {
|
||||
return ops.values(getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Map<HK, HV> entries() {
|
||||
return ops.entries(getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public DataType getType() {
|
||||
return DataType.HASH;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ abstract class DefaultBoundKeyOperations<K> implements BoundKeyOperations<K> {
|
||||
this.ops = operations;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public K getKey() {
|
||||
return key;
|
||||
}
|
||||
@@ -44,27 +44,27 @@ abstract class DefaultBoundKeyOperations<K> implements BoundKeyOperations<K> {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean expire(long timeout, TimeUnit unit) {
|
||||
return ops.expire(key, timeout, unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean expireAt(Date date) {
|
||||
return ops.expireAt(key, date);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long getExpire() {
|
||||
return ops.getExpire(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean persist() {
|
||||
return ops.persist(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void rename(K newKey) {
|
||||
if (ops.hasKey(key)) {
|
||||
ops.rename(key, newKey);
|
||||
|
||||
@@ -42,92 +42,92 @@ class DefaultBoundListOperations<K, V> extends DefaultBoundKeyOperations<K> impl
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public RedisOperations<K, V> getOperations() {
|
||||
return ops.getOperations();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V index(long index) {
|
||||
return ops.index(getKey(), index);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V leftPop() {
|
||||
return ops.leftPop(getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V leftPop(long timeout, TimeUnit unit) {
|
||||
return ops.leftPop(getKey(), timeout, unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long leftPush(V value) {
|
||||
return ops.leftPush(getKey(), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long leftPushIfPresent(V value) {
|
||||
return ops.leftPushIfPresent(getKey(), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long leftPush(V pivot, V value) {
|
||||
return ops.leftPush(getKey(), pivot, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long size() {
|
||||
return ops.size(getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<V> range(long start, long end) {
|
||||
return ops.range(getKey(), start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long remove(long i, Object value) {
|
||||
return ops.remove(getKey(), i, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V rightPop() {
|
||||
return ops.rightPop(getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V rightPop(long timeout, TimeUnit unit) {
|
||||
return ops.rightPop(getKey(), timeout, unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long rightPushIfPresent(V value) {
|
||||
return ops.rightPushIfPresent(getKey(), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long rightPush(V value) {
|
||||
return ops.rightPush(getKey(), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long rightPush(V pivot, V value) {
|
||||
return ops.rightPush(getKey(), pivot, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void trim(long start, long end) {
|
||||
ops.trim(getKey(), start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void set(long index, V value) {
|
||||
ops.set(getKey(), index, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public DataType getType() {
|
||||
return DataType.LIST;
|
||||
}
|
||||
|
||||
@@ -42,114 +42,114 @@ class DefaultBoundSetOperations<K, V> extends DefaultBoundKeyOperations<K> imple
|
||||
this.ops = operations.opsForSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean add(V value) {
|
||||
return ops.add(getKey(), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<V> diff(K key) {
|
||||
return ops.difference(getKey(), key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<V> diff(Collection<K> keys) {
|
||||
return ops.difference(getKey(), keys);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public void diffAndStore(K key, K destKey) {
|
||||
ops.differenceAndStore(getKey(), key, destKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void diffAndStore(Collection<K> keys, K destKey) {
|
||||
ops.differenceAndStore(getKey(), keys, destKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisOperations<K, V> getOperations() {
|
||||
return ops.getOperations();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<V> intersect(K key) {
|
||||
return ops.intersect(getKey(), key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<V> intersect(Collection<K> keys) {
|
||||
return ops.intersect(getKey(), keys);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void intersectAndStore(K key, K destKey) {
|
||||
ops.intersectAndStore(getKey(), key, destKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void intersectAndStore(Collection<K> keys, K destKey) {
|
||||
ops.intersectAndStore(getKey(), keys, destKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean isMember(Object o) {
|
||||
return ops.isMember(getKey(), o);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<V> members() {
|
||||
return ops.members(getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean move(K destKey, V value) {
|
||||
return ops.move(getKey(), value, destKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V randomMember() {
|
||||
return ops.randomMember(getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean remove(Object o) {
|
||||
return ops.remove(getKey(), o);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V pop() {
|
||||
return ops.pop(getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long size() {
|
||||
return ops.size(getKey());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public Set<V> union(K key) {
|
||||
return ops.union(getKey(), key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<V> union(Collection<K> keys) {
|
||||
return ops.union(getKey(), keys);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void unionAndStore(K key, K destKey) {
|
||||
ops.unionAndStore(getKey(), key, destKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void unionAndStore(Collection<K> keys, K destKey) {
|
||||
ops.unionAndStore(getKey(), keys, destKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public DataType getType() {
|
||||
return DataType.SET;
|
||||
}
|
||||
|
||||
@@ -37,62 +37,62 @@ class DefaultBoundValueOperations<K, V> extends DefaultBoundKeyOperations<K> imp
|
||||
this.ops = operations.opsForValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V get() {
|
||||
return ops.get(getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V getAndSet(V value) {
|
||||
return ops.getAndSet(getKey(), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long increment(long delta) {
|
||||
return ops.increment(getKey(), delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Integer append(String value) {
|
||||
return ops.append(getKey(), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String get(long start, long end) {
|
||||
return ops.get(getKey(), start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void set(V value, long timeout, TimeUnit unit) {
|
||||
ops.set(getKey(), value, timeout, unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void set(V value) {
|
||||
ops.set(getKey(), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean setIfAbsent(V value) {
|
||||
return ops.setIfAbsent(getKey(), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void set(V value, long offset) {
|
||||
ops.set(getKey(), value, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long size() {
|
||||
return ops.size(getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisOperations<K, V> getOperations() {
|
||||
return ops.getOperations();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public DataType getType() {
|
||||
return DataType.STRING;
|
||||
}
|
||||
|
||||
@@ -42,122 +42,122 @@ class DefaultBoundZSetOperations<K, V> extends DefaultBoundKeyOperations<K> impl
|
||||
this.ops = operations.opsForZSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean add(V value, double score) {
|
||||
return ops.add(getKey(), value, score);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Double incrementScore(V value, double delta) {
|
||||
return ops.incrementScore(getKey(), value, delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisOperations<K, V> getOperations() {
|
||||
return ops.getOperations();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void intersectAndStore(K destKey, K otherKey) {
|
||||
ops.intersectAndStore(getKey(), otherKey, destKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void intersectAndStore(Collection<K> otherKeys, K destKey) {
|
||||
ops.intersectAndStore(getKey(), otherKeys, destKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<V> range(long start, long end) {
|
||||
return ops.range(getKey(), start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<V> rangeByScore(double min, double max) {
|
||||
return ops.rangeByScore(getKey(), min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<TypedTuple<V>> rangeByScoreWithScores(double min, double max) {
|
||||
return ops.rangeByScoreWithScores(getKey(), min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<TypedTuple<V>> rangeWithScores(long start, long end) {
|
||||
return ops.rangeWithScores(getKey(), start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<V> reverseRangeByScore(double min, double max) {
|
||||
return ops.reverseRangeByScore(getKey(), min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<TypedTuple<V>> reverseRangeByScoreWithScores(double min, double max) {
|
||||
return ops.reverseRangeByScoreWithScores(getKey(), min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<TypedTuple<V>> reverseRangeWithScores(long start, long end) {
|
||||
return ops.reverseRangeWithScores(getKey(), start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long rank(Object o) {
|
||||
return ops.rank(getKey(), o);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long reverseRank(Object o) {
|
||||
return ops.reverseRank(getKey(), o);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Double score(Object o) {
|
||||
return ops.score(getKey(), o);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean remove(Object o) {
|
||||
return ops.remove(getKey(), o);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void removeRange(long start, long end) {
|
||||
ops.removeRange(getKey(), start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void removeRangeByScore(double min, double max) {
|
||||
ops.removeRangeByScore(getKey(), min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<V> reverseRange(long start, long end) {
|
||||
return ops.reverseRange(getKey(), start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long count(double min, double max) {
|
||||
return ops.count(getKey(), min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long size() {
|
||||
return ops.size(getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void unionAndStore(K otherKey, K destKey) {
|
||||
ops.unionAndStore(getKey(), otherKey, destKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void unionAndStore(Collection<K> otherKeys, K destKey) {
|
||||
ops.unionAndStore(getKey(), otherKeys, destKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public DataType getType() {
|
||||
return DataType.ZSET;
|
||||
}
|
||||
|
||||
@@ -37,13 +37,13 @@ class DefaultHashOperations<K, HK, HV> extends AbstractOperations<K, Object> imp
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public HV get(K key, Object hashKey) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawHashKey = rawHashKey(hashKey);
|
||||
|
||||
byte[] rawHashValue = execute(new RedisCallback<byte[]>() {
|
||||
@Override
|
||||
|
||||
public byte[] doInRedis(RedisConnection connection) {
|
||||
return connection.hGet(rawKey, rawHashKey);
|
||||
}
|
||||
@@ -52,26 +52,26 @@ class DefaultHashOperations<K, HK, HV> extends AbstractOperations<K, Object> imp
|
||||
return (HV) deserializeHashValue(rawHashValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean hasKey(K key, Object hashKey) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawHashKey = rawHashKey(hashKey);
|
||||
|
||||
return execute(new RedisCallback<Boolean>() {
|
||||
@Override
|
||||
|
||||
public Boolean doInRedis(RedisConnection connection) {
|
||||
return connection.hExists(rawKey, rawHashKey);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long increment(K key, HK hashKey, final long delta) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawHashKey = rawHashKey(hashKey);
|
||||
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
return connection.hIncrBy(rawKey, rawHashKey, delta);
|
||||
}
|
||||
@@ -79,12 +79,12 @@ class DefaultHashOperations<K, HK, HV> extends AbstractOperations<K, Object> imp
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<HK> keys(K key) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
Set<byte[]> rawValues = execute(new RedisCallback<Set<byte[]>>() {
|
||||
@Override
|
||||
|
||||
public Set<byte[]> doInRedis(RedisConnection connection) {
|
||||
return connection.hKeys(rawKey);
|
||||
}
|
||||
@@ -93,19 +93,19 @@ class DefaultHashOperations<K, HK, HV> extends AbstractOperations<K, Object> imp
|
||||
return deserializeHashKeys(rawValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long size(K key) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
return connection.hLen(rawKey);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void putAll(K key, Map<? extends HK, ? extends HV> m) {
|
||||
if (m.isEmpty()) {
|
||||
return;
|
||||
@@ -120,7 +120,7 @@ class DefaultHashOperations<K, HK, HV> extends AbstractOperations<K, Object> imp
|
||||
}
|
||||
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.hMSet(rawKey, hashes);
|
||||
return null;
|
||||
@@ -129,7 +129,7 @@ class DefaultHashOperations<K, HK, HV> extends AbstractOperations<K, Object> imp
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public Collection<HV> multiGet(K key, Collection<HK> fields) {
|
||||
if (fields.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
@@ -145,7 +145,7 @@ class DefaultHashOperations<K, HK, HV> extends AbstractOperations<K, Object> imp
|
||||
}
|
||||
|
||||
List<byte[]> rawValues = execute(new RedisCallback<List<byte[]>>() {
|
||||
@Override
|
||||
|
||||
public List<byte[]> doInRedis(RedisConnection connection) {
|
||||
return connection.hMGet(rawKey, rawHashKeys);
|
||||
}
|
||||
@@ -154,14 +154,14 @@ class DefaultHashOperations<K, HK, HV> extends AbstractOperations<K, Object> imp
|
||||
return deserializeHashValues(rawValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void put(K key, HK hashKey, HV value) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawHashKey = rawHashKey(hashKey);
|
||||
final byte[] rawHashValue = rawHashValue(value);
|
||||
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.hSet(rawKey, rawHashKey, rawHashValue);
|
||||
return null;
|
||||
@@ -169,14 +169,14 @@ class DefaultHashOperations<K, HK, HV> extends AbstractOperations<K, Object> imp
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean putIfAbsent(K key, HK hashKey, HV value) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawHashKey = rawHashKey(hashKey);
|
||||
final byte[] rawHashValue = rawHashValue(value);
|
||||
|
||||
return execute(new RedisCallback<Boolean>() {
|
||||
@Override
|
||||
|
||||
public Boolean doInRedis(RedisConnection connection) {
|
||||
return connection.hSetNX(rawKey, rawHashKey, rawHashValue);
|
||||
}
|
||||
@@ -184,12 +184,12 @@ class DefaultHashOperations<K, HK, HV> extends AbstractOperations<K, Object> imp
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public List<HV> values(K key) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
List<byte[]> rawValues = execute(new RedisCallback<List<byte[]>>() {
|
||||
@Override
|
||||
|
||||
public List<byte[]> doInRedis(RedisConnection connection) {
|
||||
return connection.hVals(rawKey);
|
||||
}
|
||||
@@ -198,13 +198,13 @@ class DefaultHashOperations<K, HK, HV> extends AbstractOperations<K, Object> imp
|
||||
return deserializeHashValues(rawValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void delete(K key, Object hashKey) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawHashKey = rawHashKey(hashKey);
|
||||
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.hDel(rawKey, rawHashKey);
|
||||
return null;
|
||||
@@ -212,12 +212,12 @@ class DefaultHashOperations<K, HK, HV> extends AbstractOperations<K, Object> imp
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Map<HK, HV> entries(K key) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
Map<byte[], byte[]> entries = execute(new RedisCallback<Map<byte[], byte[]>>() {
|
||||
@Override
|
||||
|
||||
public Map<byte[], byte[]> doInRedis(RedisConnection connection) {
|
||||
return connection.hGetAll(rawKey);
|
||||
}
|
||||
|
||||
@@ -33,32 +33,32 @@ class DefaultListOperations<K, V> extends AbstractOperations<K, V> implements Li
|
||||
super(template);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V index(K key, final long index) {
|
||||
return execute(new ValueDeserializingRedisCallback(key) {
|
||||
@Override
|
||||
|
||||
protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
|
||||
return connection.lIndex(rawKey, index);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V leftPop(K key) {
|
||||
return execute(new ValueDeserializingRedisCallback(key) {
|
||||
@Override
|
||||
|
||||
protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
|
||||
return connection.lPop(rawKey);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V leftPop(K key, long timeout, TimeUnit unit) {
|
||||
final int tm = (int) unit.toSeconds(timeout);
|
||||
|
||||
return execute(new ValueDeserializingRedisCallback(key) {
|
||||
@Override
|
||||
|
||||
protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
|
||||
List<byte[]> lPop = connection.bLPop(tm, rawKey);
|
||||
return (CollectionUtils.isEmpty(lPop) ? null : lPop.get(1));
|
||||
@@ -66,94 +66,94 @@ class DefaultListOperations<K, V> extends AbstractOperations<K, V> implements Li
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long leftPush(K key, V value) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawValue = rawValue(value);
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
return connection.lPush(rawKey, rawValue);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long leftPushIfPresent(K key, V value) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawValue = rawValue(value);
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
return connection.lPushX(rawKey, rawValue);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long leftPush(K key, V pivot, V value) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawPivot = rawValue(pivot);
|
||||
final byte[] rawValue = rawValue(value);
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
return connection.lInsert(rawKey, Position.BEFORE, rawPivot, rawValue);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long size(K key) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
return connection.lLen(rawKey);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<V> range(K key, final long start, final long end) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
return execute(new RedisCallback<List<V>>() {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public List<V> doInRedis(RedisConnection connection) {
|
||||
return deserializeValues(connection.lRange(rawKey, start, end));
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long remove(K key, final long count, Object value) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawValue = rawValue(value);
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
return connection.lRem(rawKey, count, rawValue);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V rightPop(K key) {
|
||||
return execute(new ValueDeserializingRedisCallback(key) {
|
||||
@Override
|
||||
|
||||
protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
|
||||
return connection.rPop(rawKey);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V rightPop(K key, long timeout, TimeUnit unit) {
|
||||
final int tm = (int) unit.toSeconds(timeout);
|
||||
|
||||
return execute(new ValueDeserializingRedisCallback(key) {
|
||||
@Override
|
||||
|
||||
protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
|
||||
List<byte[]> bRPop = connection.bRPop(tm, rawKey);
|
||||
return (CollectionUtils.isEmpty(bRPop) ? null : bRPop.get(1));
|
||||
@@ -161,74 +161,74 @@ class DefaultListOperations<K, V> extends AbstractOperations<K, V> implements Li
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long rightPush(K key, V value) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawValue = rawValue(value);
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
return connection.rPush(rawKey, rawValue);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long rightPushIfPresent(K key, V value) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawValue = rawValue(value);
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
return connection.rPushX(rawKey, rawValue);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long rightPush(K key, V pivot, V value) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawPivot = rawValue(pivot);
|
||||
final byte[] rawValue = rawValue(value);
|
||||
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
return connection.lInsert(rawKey, Position.AFTER, rawPivot, rawValue);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V rightPopAndLeftPush(K sourceKey, K destinationKey) {
|
||||
final byte[] rawDestKey = rawKey(destinationKey);
|
||||
|
||||
return execute(new ValueDeserializingRedisCallback(sourceKey) {
|
||||
@Override
|
||||
|
||||
protected byte[] inRedis(byte[] rawSourceKey, RedisConnection connection) {
|
||||
return connection.rPopLPush(rawSourceKey, rawDestKey);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V rightPopAndLeftPush(K sourceKey, K destinationKey, long timeout, TimeUnit unit) {
|
||||
final int tm = (int) unit.toSeconds(timeout);
|
||||
final byte[] rawDestKey = rawKey(destinationKey);
|
||||
|
||||
return execute(new ValueDeserializingRedisCallback(sourceKey) {
|
||||
@Override
|
||||
|
||||
protected byte[] inRedis(byte[] rawSourceKey, RedisConnection connection) {
|
||||
return connection.bRPopLPush(tm, rawSourceKey, rawDestKey);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void set(K key, final long index, V value) {
|
||||
final byte[] rawValue = rawValue(value);
|
||||
execute(new ValueDeserializingRedisCallback(key) {
|
||||
@Override
|
||||
|
||||
protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
|
||||
connection.lSet(rawKey, index, rawValue);
|
||||
return null;
|
||||
@@ -236,10 +236,10 @@ class DefaultListOperations<K, V> extends AbstractOperations<K, V> implements Li
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void trim(K key, final long start, final long end) {
|
||||
execute(new ValueDeserializingRedisCallback(key) {
|
||||
@Override
|
||||
|
||||
protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
|
||||
connection.lTrim(rawKey, start, end);
|
||||
return null;
|
||||
|
||||
@@ -32,29 +32,29 @@ class DefaultSetOperations<K, V> extends AbstractOperations<K, V> implements Set
|
||||
super(template);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean add(K key, V value) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawValue = rawValue(value);
|
||||
return execute(new RedisCallback<Boolean>() {
|
||||
@Override
|
||||
|
||||
public Boolean doInRedis(RedisConnection connection) {
|
||||
return connection.sAdd(rawKey, rawValue);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<V> difference(K key, K otherKey) {
|
||||
return difference(key, Collections.singleton(otherKey));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public Set<V> difference(final K key, final Collection<K> otherKeys) {
|
||||
final byte[][] rawKeys = rawKeys(key, otherKeys);
|
||||
Set<byte[]> rawValues = execute(new RedisCallback<Set<byte[]>>() {
|
||||
@Override
|
||||
|
||||
public Set<byte[]> doInRedis(RedisConnection connection) {
|
||||
return connection.sDiff(rawKeys);
|
||||
}
|
||||
@@ -63,17 +63,17 @@ class DefaultSetOperations<K, V> extends AbstractOperations<K, V> implements Set
|
||||
return deserializeValues(rawValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void differenceAndStore(K key, K otherKey, K destKey) {
|
||||
differenceAndStore(key, Collections.singleton(otherKey), destKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void differenceAndStore(final K key, final Collection<K> otherKeys, K destKey) {
|
||||
final byte[][] rawKeys = rawKeys(key, otherKeys);
|
||||
final byte[] rawDestKey = rawKey(destKey);
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.sDiffStore(rawDestKey, rawKeys);
|
||||
return null;
|
||||
@@ -81,17 +81,17 @@ class DefaultSetOperations<K, V> extends AbstractOperations<K, V> implements Set
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<V> intersect(K key, K otherKey) {
|
||||
return intersect(key, Collections.singleton(otherKey));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public Set<V> intersect(K key, Collection<K> otherKeys) {
|
||||
final byte[][] rawKeys = rawKeys(key, otherKeys);
|
||||
Set<byte[]> rawValues = execute(new RedisCallback<Set<byte[]>>() {
|
||||
@Override
|
||||
|
||||
public Set<byte[]> doInRedis(RedisConnection connection) {
|
||||
return connection.sInter(rawKeys);
|
||||
}
|
||||
@@ -100,17 +100,17 @@ class DefaultSetOperations<K, V> extends AbstractOperations<K, V> implements Set
|
||||
return deserializeValues(rawValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void intersectAndStore(K key, K otherKey, K destKey) {
|
||||
intersectAndStore(key, Collections.singleton(otherKey), destKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void intersectAndStore(K key, Collection<K> otherKeys, K destKey) {
|
||||
final byte[][] rawKeys = rawKeys(key, otherKeys);
|
||||
final byte[] rawDestKey = rawKey(destKey);
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.sInterStore(rawDestKey, rawKeys);
|
||||
return null;
|
||||
@@ -118,12 +118,12 @@ class DefaultSetOperations<K, V> extends AbstractOperations<K, V> implements Set
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean isMember(K key, Object o) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawValue = rawValue(o);
|
||||
return execute(new RedisCallback<Boolean>() {
|
||||
@Override
|
||||
|
||||
public Boolean doInRedis(RedisConnection connection) {
|
||||
return connection.sIsMember(rawKey, rawValue);
|
||||
}
|
||||
@@ -131,11 +131,11 @@ class DefaultSetOperations<K, V> extends AbstractOperations<K, V> implements Set
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public Set<V> members(K key) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
Set<byte[]> rawValues = execute(new RedisCallback<Set<byte[]>>() {
|
||||
@Override
|
||||
|
||||
public Set<byte[]> doInRedis(RedisConnection connection) {
|
||||
return connection.sMembers(rawKey);
|
||||
}
|
||||
@@ -144,75 +144,75 @@ class DefaultSetOperations<K, V> extends AbstractOperations<K, V> implements Set
|
||||
return deserializeValues(rawValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean move(K key, V value, K destKey) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawDestKey = rawKey(destKey);
|
||||
final byte[] rawValue = rawValue(value);
|
||||
|
||||
return execute(new RedisCallback<Boolean>() {
|
||||
@Override
|
||||
|
||||
public Boolean doInRedis(RedisConnection connection) {
|
||||
return connection.sMove(rawKey, rawDestKey, rawValue);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V randomMember(K key) {
|
||||
|
||||
return execute(new ValueDeserializingRedisCallback(key) {
|
||||
@Override
|
||||
|
||||
protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
|
||||
return connection.randomKey();
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean remove(K key, Object o) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawValue = rawValue(o);
|
||||
return execute(new RedisCallback<Boolean>() {
|
||||
@Override
|
||||
|
||||
public Boolean doInRedis(RedisConnection connection) {
|
||||
return connection.sRem(rawKey, rawValue);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V pop(K key) {
|
||||
return execute(new ValueDeserializingRedisCallback(key) {
|
||||
@Override
|
||||
|
||||
protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
|
||||
return connection.sPop(rawKey);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long size(K key) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
return connection.sCard(rawKey);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<V> union(K key, K otherKey) {
|
||||
return union(key, Collections.singleton(otherKey));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public Set<V> union(K key, Collection<K> otherKeys) {
|
||||
final byte[][] rawKeys = rawKeys(key, otherKeys);
|
||||
Set<byte[]> rawValues = execute(new RedisCallback<Set<byte[]>>() {
|
||||
@Override
|
||||
|
||||
public Set<byte[]> doInRedis(RedisConnection connection) {
|
||||
return connection.sUnion(rawKeys);
|
||||
}
|
||||
@@ -221,17 +221,17 @@ class DefaultSetOperations<K, V> extends AbstractOperations<K, V> implements Set
|
||||
return deserializeValues(rawValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void unionAndStore(K key, K otherKey, K destKey) {
|
||||
unionAndStore(key, Collections.singleton(otherKey), destKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void unionAndStore(K key, Collection<K> otherKeys, K destKey) {
|
||||
final byte[][] rawKeys = rawKeys(key, otherKeys);
|
||||
final byte[] rawDestKey = rawKey(destKey);
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.sUnionStore(rawDestKey, rawKeys);
|
||||
return null;
|
||||
|
||||
@@ -38,17 +38,17 @@ class DefaultTypedTuple<V> implements TypedTuple<V> {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Double getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
@@ -57,7 +57,7 @@ class DefaultTypedTuple<V> implements TypedTuple<V> {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
@@ -81,7 +81,7 @@ class DefaultTypedTuple<V> implements TypedTuple<V> {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int compareTo(Double o) {
|
||||
Double d = (score == null ? Double.valueOf(0) : score);
|
||||
Double a = (o == null ? Double.valueOf(0) : o);
|
||||
|
||||
@@ -36,34 +36,34 @@ class DefaultValueOperations<K, V> extends AbstractOperations<K, V> implements V
|
||||
super(template);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V get(final Object key) {
|
||||
|
||||
return execute(new ValueDeserializingRedisCallback(key) {
|
||||
@Override
|
||||
|
||||
protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
|
||||
return connection.get(rawKey);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V getAndSet(K key, V newValue) {
|
||||
final byte[] rawValue = rawValue(newValue);
|
||||
return execute(new ValueDeserializingRedisCallback(key) {
|
||||
@Override
|
||||
|
||||
protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
|
||||
return connection.getSet(rawKey, rawValue);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long increment(K key, final long delta) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
// TODO add conversion service in here ?
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
if (delta == 1) {
|
||||
return connection.incr(rawKey);
|
||||
@@ -82,25 +82,25 @@ class DefaultValueOperations<K, V> extends AbstractOperations<K, V> implements V
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Integer append(K key, String value) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawString = rawString(value);
|
||||
|
||||
return execute(new RedisCallback<Integer>() {
|
||||
@Override
|
||||
|
||||
public Integer doInRedis(RedisConnection connection) {
|
||||
return connection.append(rawKey, rawString).intValue();
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String get(K key, final long start, final long end) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
byte[] rawReturn = execute(new RedisCallback<byte[]>() {
|
||||
@Override
|
||||
|
||||
public byte[] doInRedis(RedisConnection connection) {
|
||||
return connection.getRange(rawKey, start, end);
|
||||
}
|
||||
@@ -110,7 +110,7 @@ class DefaultValueOperations<K, V> extends AbstractOperations<K, V> implements V
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public List<V> multiGet(Collection<K> keys) {
|
||||
if (keys.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
@@ -124,7 +124,7 @@ class DefaultValueOperations<K, V> extends AbstractOperations<K, V> implements V
|
||||
}
|
||||
|
||||
List<byte[]> rawValues = execute(new RedisCallback<List<byte[]>>() {
|
||||
@Override
|
||||
|
||||
public List<byte[]> doInRedis(RedisConnection connection) {
|
||||
return connection.mGet(rawKeys);
|
||||
}
|
||||
@@ -133,7 +133,7 @@ class DefaultValueOperations<K, V> extends AbstractOperations<K, V> implements V
|
||||
return deserializeValues(rawValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void multiSet(Map<? extends K, ? extends V> m) {
|
||||
if (m.isEmpty()) {
|
||||
return;
|
||||
@@ -146,7 +146,7 @@ class DefaultValueOperations<K, V> extends AbstractOperations<K, V> implements V
|
||||
}
|
||||
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.mSet(rawKeys);
|
||||
return null;
|
||||
@@ -154,7 +154,7 @@ class DefaultValueOperations<K, V> extends AbstractOperations<K, V> implements V
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void multiSetIfAbsent(Map<? extends K, ? extends V> m) {
|
||||
if (m.isEmpty()) {
|
||||
return;
|
||||
@@ -167,7 +167,7 @@ class DefaultValueOperations<K, V> extends AbstractOperations<K, V> implements V
|
||||
}
|
||||
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.mSetNX(rawKeys);
|
||||
return null;
|
||||
@@ -175,11 +175,11 @@ class DefaultValueOperations<K, V> extends AbstractOperations<K, V> implements V
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void set(K key, V value) {
|
||||
final byte[] rawValue = rawValue(value);
|
||||
execute(new ValueDeserializingRedisCallback(key) {
|
||||
@Override
|
||||
|
||||
protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
|
||||
connection.set(rawKey, rawValue);
|
||||
return null;
|
||||
@@ -187,14 +187,14 @@ class DefaultValueOperations<K, V> extends AbstractOperations<K, V> implements V
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void set(K key, V value, long timeout, TimeUnit unit) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawValue = rawValue(value);
|
||||
final long rawTimeout = unit.toSeconds(timeout);
|
||||
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) throws DataAccessException {
|
||||
connection.setEx(rawKey, (int) rawTimeout, rawValue);
|
||||
return null;
|
||||
@@ -202,13 +202,13 @@ class DefaultValueOperations<K, V> extends AbstractOperations<K, V> implements V
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean setIfAbsent(K key, V value) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawValue = rawValue(value);
|
||||
|
||||
return execute(new RedisCallback<Boolean>() {
|
||||
@Override
|
||||
|
||||
public Boolean doInRedis(RedisConnection connection) throws DataAccessException {
|
||||
return connection.setNX(rawKey, rawValue);
|
||||
}
|
||||
@@ -216,13 +216,13 @@ class DefaultValueOperations<K, V> extends AbstractOperations<K, V> implements V
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public void set(K key, final V value, final long offset) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawValue = rawValue(value);
|
||||
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.setRange(rawKey, rawValue, offset);
|
||||
return null;
|
||||
@@ -230,12 +230,12 @@ class DefaultValueOperations<K, V> extends AbstractOperations<K, V> implements V
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long size(K key) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
return connection.strLen(rawKey);
|
||||
}
|
||||
|
||||
@@ -33,43 +33,43 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
|
||||
super(template);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean add(final K key, final V value, final double score) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawValue = rawValue(value);
|
||||
|
||||
return execute(new RedisCallback<Boolean>() {
|
||||
@Override
|
||||
|
||||
public Boolean doInRedis(RedisConnection connection) {
|
||||
return connection.zAdd(rawKey, score, rawValue);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Double incrementScore(K key, V value, final double delta) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawValue = rawValue(value);
|
||||
|
||||
return execute(new RedisCallback<Double>() {
|
||||
@Override
|
||||
|
||||
public Double doInRedis(RedisConnection connection) {
|
||||
return connection.zIncrBy(rawKey, delta, rawValue);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void intersectAndStore(K key, K otherKey, K destKey) {
|
||||
intersectAndStore(key, Collections.singleton(otherKey), destKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void intersectAndStore(K key, Collection<K> otherKeys, K destKey) {
|
||||
final byte[][] rawKeys = rawKeys(key, otherKeys);
|
||||
final byte[] rawDestKey = rawKey(destKey);
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.zInterStore(rawDestKey, rawKeys);
|
||||
return null;
|
||||
@@ -77,12 +77,12 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<V> range(K key, final long start, final long end) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
Set<byte[]> rawValues = execute(new RedisCallback<Set<byte[]>>() {
|
||||
@Override
|
||||
|
||||
public Set<byte[]> doInRedis(RedisConnection connection) {
|
||||
return connection.zRange(rawKey, start, end);
|
||||
}
|
||||
@@ -91,12 +91,12 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
|
||||
return deserializeValues(rawValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<V> reverseRange(K key, final long start, final long end) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
Set<byte[]> rawValues = execute(new RedisCallback<Set<byte[]>>() {
|
||||
@Override
|
||||
|
||||
public Set<byte[]> doInRedis(RedisConnection connection) {
|
||||
return connection.zRevRange(rawKey, start, end);
|
||||
}
|
||||
@@ -105,12 +105,12 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
|
||||
return deserializeValues(rawValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<TypedTuple<V>> rangeWithScores(K key, final long start, final long end) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
Set<Tuple> rawValues = execute(new RedisCallback<Set<Tuple>>() {
|
||||
@Override
|
||||
|
||||
public Set<Tuple> doInRedis(RedisConnection connection) {
|
||||
return connection.zRangeWithScores(rawKey, start, end);
|
||||
}
|
||||
@@ -119,12 +119,12 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
|
||||
return deserializeTupleValues(rawValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<TypedTuple<V>> reverseRangeWithScores(K key, final long start, final long end) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
Set<Tuple> rawValues = execute(new RedisCallback<Set<Tuple>>() {
|
||||
@Override
|
||||
|
||||
public Set<Tuple> doInRedis(RedisConnection connection) {
|
||||
return connection.zRevRangeWithScores(rawKey, start, end);
|
||||
}
|
||||
@@ -133,12 +133,12 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
|
||||
return deserializeTupleValues(rawValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<V> rangeByScore(K key, final double min, final double max) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
Set<byte[]> rawValues = execute(new RedisCallback<Set<byte[]>>() {
|
||||
@Override
|
||||
|
||||
public Set<byte[]> doInRedis(RedisConnection connection) {
|
||||
return connection.zRangeByScore(rawKey, min, max);
|
||||
}
|
||||
@@ -148,12 +148,12 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public Set<V> reverseRangeByScore(K key, final double min, final double max) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
Set<byte[]> rawValues = execute(new RedisCallback<Set<byte[]>>() {
|
||||
@Override
|
||||
|
||||
public Set<byte[]> doInRedis(RedisConnection connection) {
|
||||
return connection.zRevRangeByScore(rawKey, min, max);
|
||||
}
|
||||
@@ -162,12 +162,12 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
|
||||
return deserializeValues(rawValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<TypedTuple<V>> rangeByScoreWithScores(K key, final double min, final double max) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
Set<Tuple> rawValues = execute(new RedisCallback<Set<Tuple>>() {
|
||||
@Override
|
||||
|
||||
public Set<Tuple> doInRedis(RedisConnection connection) {
|
||||
return connection.zRangeByScoreWithScores(rawKey, min, max);
|
||||
}
|
||||
@@ -176,12 +176,12 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
|
||||
return deserializeTupleValues(rawValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<TypedTuple<V>> reverseRangeByScoreWithScores(K key, final double min, final double max) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
Set<Tuple> rawValues = execute(new RedisCallback<Set<Tuple>>() {
|
||||
@Override
|
||||
|
||||
public Set<Tuple> doInRedis(RedisConnection connection) {
|
||||
return connection.zRevRangeByScoreWithScores(rawKey, min, max);
|
||||
|
||||
@@ -191,13 +191,13 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
|
||||
return deserializeTupleValues(rawValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long rank(K key, Object o) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawValue = rawValue(o);
|
||||
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
Long zRank = connection.zRank(rawKey, rawValue);
|
||||
return (zRank != null && zRank.longValue() >= 0 ? zRank : null);
|
||||
@@ -205,13 +205,13 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long reverseRank(K key, Object o) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawValue = rawValue(o);
|
||||
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
Long zRank = connection.zRevRank(rawKey, rawValue);
|
||||
return (zRank != null && zRank.longValue() >= 0 ? zRank : null);
|
||||
@@ -219,24 +219,24 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean remove(K key, Object o) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawValue = rawValue(o);
|
||||
|
||||
return execute(new RedisCallback<Boolean>() {
|
||||
@Override
|
||||
|
||||
public Boolean doInRedis(RedisConnection connection) {
|
||||
return connection.zRem(rawKey, rawValue);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void removeRange(K key, final long start, final long end) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.zRemRange(rawKey, start, end);
|
||||
return null;
|
||||
@@ -244,11 +244,11 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void removeRangeByScore(K key, final double min, final double max) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.zRemRangeByScore(rawKey, min, max);
|
||||
return null;
|
||||
@@ -256,54 +256,54 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Double score(K key, Object o) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final byte[] rawValue = rawValue(o);
|
||||
|
||||
return execute(new RedisCallback<Double>() {
|
||||
@Override
|
||||
|
||||
public Double doInRedis(RedisConnection connection) {
|
||||
return connection.zScore(rawKey, rawValue);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long count(K key, final double min, final double max) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
return connection.zCount(rawKey, min, max);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long size(K key) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
return connection.zCard(rawKey);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void unionAndStore(K key, K otherKey, K destKey) {
|
||||
unionAndStore(key, Collections.singleton(otherKey), destKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void unionAndStore(K key, Collection<K> otherKeys, K destKey) {
|
||||
final byte[][] rawKeys = rawKeys(key, otherKeys);
|
||||
final byte[] rawDestKey = rawKey(destKey);
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.zUnionStore(rawDestKey, rawKeys);
|
||||
return null;
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.beans.PropertyEditorSupport;
|
||||
*/
|
||||
class HashOperationsEditor extends PropertyEditorSupport {
|
||||
|
||||
@Override
|
||||
|
||||
public void setValue(Object value) {
|
||||
if (value instanceof RedisOperations) {
|
||||
super.setValue(((RedisOperations) value).opsForHash());
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.beans.PropertyEditorSupport;
|
||||
* @author Costin Leau
|
||||
*/
|
||||
class ListOperationsEditor extends PropertyEditorSupport {
|
||||
@Override
|
||||
|
||||
public void setValue(Object value) {
|
||||
if (value instanceof RedisOperations) {
|
||||
super.setValue(((RedisOperations) value).opsForList());
|
||||
|
||||
@@ -153,12 +153,12 @@ public abstract class RedisConnectionUtils {
|
||||
this.newRedisConnection = newRedisConnection;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected boolean shouldUnbindAtCompletion() {
|
||||
return this.newRedisConnection;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected void releaseResource(RedisConnectionHolder resourceHolder, RedisConnectionFactory resourceKey) {
|
||||
releaseConnection(resourceHolder.getConnection(), resourceKey);
|
||||
}
|
||||
@@ -173,7 +173,7 @@ public abstract class RedisConnectionUtils {
|
||||
this.conn = conn;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean isVoid() {
|
||||
return isVoid;
|
||||
}
|
||||
@@ -182,12 +182,12 @@ public abstract class RedisConnectionUtils {
|
||||
return conn;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void reset() {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void unbound() {
|
||||
this.isVoid = true;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
public RedisTemplate() {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void afterPropertiesSet() {
|
||||
super.afterPropertiesSet();
|
||||
boolean defaultUsed = false;
|
||||
@@ -116,7 +116,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public <T> T execute(RedisCallback<T> action) {
|
||||
return execute(action, isExposeConnection());
|
||||
}
|
||||
@@ -174,7 +174,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public <T> T execute(SessionCallback<T> session) {
|
||||
RedisConnectionFactory factory = getConnectionFactory();
|
||||
// bind connection
|
||||
@@ -407,23 +407,23 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
//
|
||||
// RedisOperations
|
||||
//
|
||||
@Override
|
||||
|
||||
public List<Object> exec() {
|
||||
return execute(new RedisCallback<List<Object>>() {
|
||||
|
||||
@Override
|
||||
|
||||
public List<Object> doInRedis(RedisConnection connection) throws DataAccessException {
|
||||
return connection.exec();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void delete(K key) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.del(rawKey);
|
||||
return null;
|
||||
@@ -431,12 +431,12 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void delete(Collection<K> keys) {
|
||||
final byte[][] rawKeys = rawKeys(keys);
|
||||
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.del(rawKeys);
|
||||
return null;
|
||||
@@ -444,45 +444,45 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean hasKey(K key) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
return execute(new RedisCallback<Boolean>() {
|
||||
@Override
|
||||
|
||||
public Boolean doInRedis(RedisConnection connection) {
|
||||
return connection.exists(rawKey);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean expire(K key, long timeout, TimeUnit unit) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final long rawTimeout = unit.toSeconds(timeout);
|
||||
|
||||
return execute(new RedisCallback<Boolean>() {
|
||||
@Override
|
||||
|
||||
public Boolean doInRedis(RedisConnection connection) {
|
||||
return connection.expire(rawKey, rawTimeout);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean expireAt(K key, Date date) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
final long rawTimeout = date.getTime() / 1000;
|
||||
|
||||
return execute(new RedisCallback<Boolean>() {
|
||||
@Override
|
||||
|
||||
public Boolean doInRedis(RedisConnection connection) {
|
||||
return connection.expireAt(rawKey, rawTimeout);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void convertAndSend(String channel, Object message) {
|
||||
Assert.hasText(channel, "a non-empty channel is required");
|
||||
|
||||
@@ -490,7 +490,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
final byte[] rawMessage = rawValue(message);
|
||||
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.publish(rawChannel, rawMessage);
|
||||
return null;
|
||||
@@ -503,12 +503,12 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
// Value operations
|
||||
//
|
||||
|
||||
@Override
|
||||
|
||||
public Long getExpire(K key) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
return Long.valueOf(connection.ttl(rawKey));
|
||||
}
|
||||
@@ -516,12 +516,12 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public Set<K> keys(K pattern) {
|
||||
final byte[] rawKey = rawKey(pattern);
|
||||
|
||||
Set<byte[]> rawKeys = execute(new RedisCallback<Set<byte[]>>() {
|
||||
@Override
|
||||
|
||||
public Set<byte[]> doInRedis(RedisConnection connection) {
|
||||
return connection.keys(rawKey);
|
||||
}
|
||||
@@ -530,34 +530,34 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
return SerializationUtils.deserialize(rawKeys, keySerializer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean persist(K key) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
return execute(new RedisCallback<Boolean>() {
|
||||
@Override
|
||||
|
||||
public Boolean doInRedis(RedisConnection connection) {
|
||||
return connection.persist(rawKey);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean move(K key, final int dbIndex) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
return execute(new RedisCallback<Boolean>() {
|
||||
@Override
|
||||
|
||||
public Boolean doInRedis(RedisConnection connection) {
|
||||
return connection.move(rawKey, dbIndex);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public K randomKey() {
|
||||
byte[] rawKey = execute(new RedisCallback<byte[]>() {
|
||||
@Override
|
||||
|
||||
public byte[] doInRedis(RedisConnection connection) {
|
||||
return connection.randomKey();
|
||||
}
|
||||
@@ -566,13 +566,13 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
return deserializeKey(rawKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void rename(K oldKey, K newKey) {
|
||||
final byte[] rawOldKey = rawKey(oldKey);
|
||||
final byte[] rawNewKey = rawKey(newKey);
|
||||
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.rename(rawOldKey, rawNewKey);
|
||||
return null;
|
||||
@@ -580,35 +580,35 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean renameIfAbsent(K oldKey, K newKey) {
|
||||
final byte[] rawOldKey = rawKey(oldKey);
|
||||
final byte[] rawNewKey = rawKey(newKey);
|
||||
|
||||
return execute(new RedisCallback<Boolean>() {
|
||||
@Override
|
||||
|
||||
public Boolean doInRedis(RedisConnection connection) {
|
||||
return connection.renameNX(rawOldKey, rawNewKey);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public DataType type(K key) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
return execute(new RedisCallback<DataType>() {
|
||||
@Override
|
||||
|
||||
public DataType doInRedis(RedisConnection connection) {
|
||||
return connection.type(rawKey);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void multi() {
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) throws DataAccessException {
|
||||
connection.multi();
|
||||
return null;
|
||||
@@ -616,11 +616,11 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void discard() {
|
||||
execute(new RedisCallback<Object>() {
|
||||
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) throws DataAccessException {
|
||||
connection.discard();
|
||||
return null;
|
||||
@@ -628,12 +628,12 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void watch(K key) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.watch(rawKey);
|
||||
return null;
|
||||
@@ -641,12 +641,12 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void watch(Collection<K> keys) {
|
||||
final byte[][] rawKeys = rawKeys(keys);
|
||||
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) {
|
||||
connection.watch(rawKeys);
|
||||
return null;
|
||||
@@ -654,10 +654,10 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void unwatch() {
|
||||
execute(new RedisCallback<Object>() {
|
||||
@Override
|
||||
|
||||
public Object doInRedis(RedisConnection connection) throws DataAccessException {
|
||||
connection.unwatch();
|
||||
return null;
|
||||
@@ -668,18 +668,18 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
// Sort operations
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public List<V> sort(SortQuery<K> query) {
|
||||
return sort(query, valueSerializer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public <T> List<T> sort(SortQuery<K> query, RedisSerializer<T> resultSerializer) {
|
||||
final byte[] rawKey = rawKey(query.getKey());
|
||||
final SortParameters params = QueryUtils.convertQuery(query, stringSerializer);
|
||||
|
||||
List<byte[]> vals = execute(new RedisCallback<List<byte[]>>() {
|
||||
@Override
|
||||
|
||||
public List<byte[]> doInRedis(RedisConnection connection) throws DataAccessException {
|
||||
return connection.sort(rawKey, params);
|
||||
}
|
||||
@@ -689,12 +689,12 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public <T> List<T> sort(SortQuery<K> query, BulkMapper<T, V> bulkMapper) {
|
||||
return sort(query, bulkMapper, valueSerializer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public <T, S> List<T> sort(SortQuery<K> query, BulkMapper<T, S> bulkMapper, RedisSerializer<S> resultSerializer) {
|
||||
List<S> values = sort(query, resultSerializer);
|
||||
|
||||
@@ -719,26 +719,26 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long sort(SortQuery<K> query, K storeKey) {
|
||||
final byte[] rawStoreKey = rawKey(storeKey);
|
||||
final byte[] rawKey = rawKey(query.getKey());
|
||||
final SortParameters params = QueryUtils.convertQuery(query, stringSerializer);
|
||||
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
|
||||
public Long doInRedis(RedisConnection connection) throws DataAccessException {
|
||||
return connection.sort(rawKey, params, rawStoreKey);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public BoundValueOperations<K, V> boundValueOps(K key) {
|
||||
return new DefaultBoundValueOperations<K, V>(key, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public ValueOperations<K, V> opsForValue() {
|
||||
if (valueOps == null) {
|
||||
valueOps = new DefaultValueOperations<K, V>(this);
|
||||
@@ -746,7 +746,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
return valueOps;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public ListOperations<K, V> opsForList() {
|
||||
if (listOps == null) {
|
||||
listOps = new DefaultListOperations<K, V>(this);
|
||||
@@ -754,17 +754,17 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
return listOps;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public BoundListOperations<K, V> boundListOps(K key) {
|
||||
return new DefaultBoundListOperations<K, V>(key, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public BoundSetOperations<K, V> boundSetOps(K key) {
|
||||
return new DefaultBoundSetOperations<K, V>(key, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public SetOperations<K, V> opsForSet() {
|
||||
if (setOps == null) {
|
||||
setOps = new DefaultSetOperations<K, V>(this);
|
||||
@@ -772,12 +772,12 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
return setOps;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public BoundZSetOperations<K, V> boundZSetOps(K key) {
|
||||
return new DefaultBoundZSetOperations<K, V>(key, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public ZSetOperations<K, V> opsForZSet() {
|
||||
if (zSetOps == null) {
|
||||
zSetOps = new DefaultZSetOperations<K, V>(this);
|
||||
@@ -785,12 +785,12 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
return zSetOps;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public <HK, HV> BoundHashOperations<K, HK, HV> boundHashOps(K key) {
|
||||
return new DefaultBoundHashOperations<K, HK, HV>(key, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public <HK, HV> HashOperations<K, HK, HV> opsForHash() {
|
||||
return new DefaultHashOperations<K, HK, HV>(this);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.beans.PropertyEditorSupport;
|
||||
*/
|
||||
class SetOperationsEditor extends PropertyEditorSupport {
|
||||
|
||||
@Override
|
||||
|
||||
public void setValue(Object value) {
|
||||
if (value instanceof RedisOperations) {
|
||||
super.setValue(((RedisOperations) value).opsForSet());
|
||||
|
||||
@@ -58,7 +58,7 @@ public class StringRedisTemplate extends RedisTemplate<String, String> {
|
||||
afterPropertiesSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected RedisConnection preProcessConnection(RedisConnection connection, boolean existingConnection) {
|
||||
return new DefaultStringRedisConnection(connection);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.beans.PropertyEditorSupport;
|
||||
*/
|
||||
class ValueOperationsEditor extends PropertyEditorSupport {
|
||||
|
||||
@Override
|
||||
|
||||
public void setValue(Object value) {
|
||||
if (value instanceof RedisOperations) {
|
||||
super.setValue(((RedisOperations) value).opsForValue());
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.beans.PropertyEditorSupport;
|
||||
*/
|
||||
class ZSetOperationsEditor extends PropertyEditorSupport {
|
||||
|
||||
@Override
|
||||
|
||||
public void setValue(Object value) {
|
||||
if (value instanceof RedisOperations) {
|
||||
super.setValue(((RedisOperations) value).opsForZSet());
|
||||
|
||||
@@ -40,36 +40,36 @@ class DefaultSortCriterion<K> implements SortCriterion<K> {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public SortCriterion<K> alphabetical(boolean alpha) {
|
||||
this.alpha = Boolean.valueOf(alpha);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public SortQuery<K> build() {
|
||||
return new DefaultSortQuery<K>(key, by, limit, order, alpha, getKeys);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public SortCriterion<K> limit(long offset, long count) {
|
||||
this.limit = new Range(offset, count);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public SortCriterion<K> limit(Range range) {
|
||||
this.limit = range;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public SortCriterion<K> order(Order order) {
|
||||
this.order = order;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public SortCriterion<K> get(String getPattern) {
|
||||
this.getKeys.add(getPattern);
|
||||
return this;
|
||||
|
||||
@@ -43,37 +43,37 @@ class DefaultSortQuery<K> implements SortQuery<K> {
|
||||
this.gets = gets;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String getBy() {
|
||||
return by;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Range getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Order getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean isAlphabetic() {
|
||||
return alpha;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public K getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<String> getGetPattern() {
|
||||
return gets;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String toString() {
|
||||
return "DefaultSortQuery [alpha=" + alpha + ", by=" + by + ", gets=" + gets + ", key=" + key + ", limit="
|
||||
+ limit + ", order=" + order + "]";
|
||||
|
||||
@@ -32,7 +32,7 @@ public class BeanUtilsHashMapper<T> implements HashMapper<T, String, String> {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public T fromHash(Map<String, String> hash) {
|
||||
T instance = org.springframework.beans.BeanUtils.instantiate(type);
|
||||
try {
|
||||
@@ -43,7 +43,7 @@ public class BeanUtilsHashMapper<T> implements HashMapper<T, String, String> {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Map<String, String> toHash(T object) {
|
||||
try {
|
||||
return BeanUtils.describe(object);
|
||||
|
||||
@@ -33,13 +33,13 @@ public class DecoratingStringHashMapper<T> implements HashMapper<T, String, Stri
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public T fromHash(Map<String, String> hash) {
|
||||
Map h = hash;
|
||||
return delegate.fromHash(h);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Map<String, String> toHash(T object) {
|
||||
Map<?, ?> hash = delegate.toHash(object);
|
||||
Map<String, String> flatten = new LinkedHashMap<String, String>(hash.size());
|
||||
|
||||
@@ -42,12 +42,12 @@ public class JacksonHashMapper<T> implements HashMapper<T, String, Object> {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public T fromHash(Map<String, Object> hash) {
|
||||
return (T) mapper.convertValue(hash, userType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Map<String, Object> toHash(T object) {
|
||||
return mapper.convertValue(object, mapType);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public class RedisMessageListenerContainer implements InitializingBean, Disposab
|
||||
private volatile RedisSerializer<String> serializer = new StringRedisSerializer();
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public void afterPropertiesSet() {
|
||||
if (taskExecutor == null) {
|
||||
manageExecutor = true;
|
||||
@@ -137,7 +137,7 @@ public class RedisMessageListenerContainer implements InitializingBean, Disposab
|
||||
return new SimpleAsyncTaskExecutor(threadNamePrefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void destroy() throws Exception {
|
||||
initialized = false;
|
||||
|
||||
@@ -154,29 +154,29 @@ public class RedisMessageListenerContainer implements InitializingBean, Disposab
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean isAutoStartup() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void stop(Runnable callback) {
|
||||
stop();
|
||||
callback.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int getPhase() {
|
||||
// start the latest
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean isRunning() {
|
||||
return running;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void start() {
|
||||
if (!running) {
|
||||
running = true;
|
||||
@@ -198,7 +198,7 @@ public class RedisMessageListenerContainer implements InitializingBean, Disposab
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void stop() {
|
||||
if (isRunning()) {
|
||||
running = false;
|
||||
@@ -302,7 +302,7 @@ public class RedisMessageListenerContainer implements InitializingBean, Disposab
|
||||
this.connectionFactory = connectionFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void setBeanName(String name) {
|
||||
this.beanName = name;
|
||||
}
|
||||
@@ -511,12 +511,12 @@ public class RedisMessageListenerContainer implements InitializingBean, Disposab
|
||||
private long WAIT = 500;
|
||||
private long ROUNDS = 3;
|
||||
|
||||
@Override
|
||||
|
||||
public boolean isLongLived() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void run() {
|
||||
// wait for subscription to be initialized
|
||||
boolean done = false;
|
||||
@@ -544,12 +544,12 @@ public class RedisMessageListenerContainer implements InitializingBean, Disposab
|
||||
private volatile RedisConnection connection;
|
||||
private final Object localMonitor = new Object();
|
||||
|
||||
@Override
|
||||
|
||||
public boolean isLongLived() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void run() {
|
||||
connection = connectionFactory.getConnection();
|
||||
try {
|
||||
@@ -696,7 +696,7 @@ public class RedisMessageListenerContainer implements InitializingBean, Disposab
|
||||
*/
|
||||
private class DispatchMessageListener implements MessageListener {
|
||||
|
||||
@Override
|
||||
|
||||
public void onMessage(Message message, byte[] pattern) {
|
||||
// do channel matching first
|
||||
byte[] channel = message.getChannel();
|
||||
@@ -721,7 +721,7 @@ public class RedisMessageListenerContainer implements InitializingBean, Disposab
|
||||
private void dispatchChannels(Collection<MessageListener> ch, final Message message) {
|
||||
for (final MessageListener messageListener : ch) {
|
||||
taskExecutor.execute(new Runnable() {
|
||||
@Override
|
||||
|
||||
public void run() {
|
||||
processMessage(messageListener, message, null);
|
||||
}
|
||||
@@ -732,7 +732,7 @@ public class RedisMessageListenerContainer implements InitializingBean, Disposab
|
||||
private void dispatchPatterns(Collection<MessageListener> pt, final Message message, final byte[] pattern) {
|
||||
for (final MessageListener messageListener : pt) {
|
||||
taskExecutor.execute(new Runnable() {
|
||||
@Override
|
||||
|
||||
public void run() {
|
||||
processMessage(messageListener, message, pattern.clone());
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ public class MessageListenerAdapter implements InitializingBean, MessageListener
|
||||
this.stringSerializer = serializer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void afterPropertiesSet() {
|
||||
String methodName = getDefaultListenerMethod();
|
||||
|
||||
@@ -299,7 +299,7 @@ public class MessageListenerAdapter implements InitializingBean, MessageListener
|
||||
* the incoming Redis message
|
||||
* @see #handleListenerException
|
||||
*/
|
||||
@Override
|
||||
|
||||
public void onMessage(Message message, byte[] pattern) {
|
||||
try {
|
||||
// Check whether the delegate is a MessageListener impl itself.
|
||||
|
||||
@@ -64,7 +64,7 @@ public class GenericToStringSerializer<T> implements RedisSerializer<T>, BeanFac
|
||||
converter = new Converter(typeConverter);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public T deserialize(byte[] bytes) {
|
||||
if (bytes == null) {
|
||||
return null;
|
||||
@@ -74,7 +74,7 @@ public class GenericToStringSerializer<T> implements RedisSerializer<T>, BeanFac
|
||||
return converter.convert(string, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] serialize(T object) {
|
||||
if (object == null) {
|
||||
return null;
|
||||
@@ -83,7 +83,7 @@ public class GenericToStringSerializer<T> implements RedisSerializer<T>, BeanFac
|
||||
return string.getBytes(charset);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
if (converter == null && beanFactory instanceof ConfigurableBeanFactory) {
|
||||
ConfigurableBeanFactory cFB = (ConfigurableBeanFactory) beanFactory;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class JacksonJsonRedisSerializer<T> implements RedisSerializer<T> {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public T deserialize(byte[] bytes) throws SerializationException {
|
||||
if (SerializationUtils.isEmpty(bytes)) {
|
||||
return null;
|
||||
@@ -56,7 +56,7 @@ public class JacksonJsonRedisSerializer<T> implements RedisSerializer<T> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] serialize(Object t) throws SerializationException {
|
||||
if (t == null) {
|
||||
return SerializationUtils.EMPTY_ARRAY;
|
||||
|
||||
@@ -32,7 +32,7 @@ public class JdkSerializationRedisSerializer implements RedisSerializer<Object>
|
||||
private Converter<byte[], Object> deserializer = new DeserializingConverter();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public Object deserialize(byte[] bytes) {
|
||||
if (SerializationUtils.isEmpty(bytes)) {
|
||||
return null;
|
||||
@@ -45,7 +45,7 @@ public class JdkSerializationRedisSerializer implements RedisSerializer<Object>
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] serialize(Object object) {
|
||||
if (object == null) {
|
||||
return SerializationUtils.EMPTY_ARRAY;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class OxmSerializer implements InitializingBean, RedisSerializer<Object>
|
||||
afterPropertiesSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(marshaller, "non-null marshaller required");
|
||||
Assert.notNull(unmarshaller, "non-null unmarshaller required");
|
||||
@@ -70,7 +70,7 @@ public class OxmSerializer implements InitializingBean, RedisSerializer<Object>
|
||||
this.unmarshaller = unmarshaller;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Object deserialize(byte[] bytes) throws SerializationException {
|
||||
if (SerializationUtils.isEmpty(bytes)) {
|
||||
return null;
|
||||
@@ -83,7 +83,7 @@ public class OxmSerializer implements InitializingBean, RedisSerializer<Object>
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] serialize(Object t) throws SerializationException {
|
||||
if (t == null) {
|
||||
return SerializationUtils.EMPTY_ARRAY;
|
||||
|
||||
@@ -42,12 +42,12 @@ public class StringRedisSerializer implements RedisSerializer<String> {
|
||||
this.charset = charset;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String deserialize(byte[] bytes) {
|
||||
return (bytes == null ? null : new String(bytes, charset));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public byte[] serialize(String string) {
|
||||
return (string == null ? null : string.getBytes(charset));
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class RedisAtomicInteger extends Number implements Serializable, BoundKey
|
||||
return generalOps.execute(new SessionCallback<Boolean>() {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public Boolean execute(RedisOperations operations) {
|
||||
for (;;) {
|
||||
operations.watch(Collections.singleton(key));
|
||||
@@ -225,38 +225,38 @@ public class RedisAtomicInteger extends Number implements Serializable, BoundKey
|
||||
return (double) get();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean expire(long timeout, TimeUnit unit) {
|
||||
return generalOps.expire(key, timeout, unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean expireAt(Date date) {
|
||||
return generalOps.expireAt(key, date);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long getExpire() {
|
||||
return generalOps.getExpire(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean persist() {
|
||||
return generalOps.persist(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void rename(String newKey) {
|
||||
generalOps.rename(key, newKey);
|
||||
key = newKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public DataType getType() {
|
||||
return DataType.STRING;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class RedisAtomicLong extends Number implements Serializable, BoundKeyOpe
|
||||
return generalOps.execute(new SessionCallback<Boolean>() {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public Boolean execute(RedisOperations operations) {
|
||||
for (;;) {
|
||||
operations.watch(Collections.singleton(key));
|
||||
@@ -229,38 +229,38 @@ public class RedisAtomicLong extends Number implements Serializable, BoundKeyOpe
|
||||
return (double) get();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean expire(long timeout, TimeUnit unit) {
|
||||
return generalOps.expire(key, timeout, unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean expireAt(Date date) {
|
||||
return generalOps.expireAt(key, date);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long getExpire() {
|
||||
return generalOps.getExpire(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean persist() {
|
||||
return generalOps.persist(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void rename(String newKey) {
|
||||
generalOps.rename(key, newKey);
|
||||
key = newKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public DataType getType() {
|
||||
return DataType.STRING;
|
||||
}
|
||||
|
||||
@@ -40,17 +40,17 @@ public abstract class AbstractRedisCollection<E> extends AbstractCollection<E> i
|
||||
this.operations = operations;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisOperations<String, E> getOperations() {
|
||||
return operations;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean addAll(Collection<? extends E> c) {
|
||||
boolean modified = false;
|
||||
for (E e : c) {
|
||||
@@ -63,7 +63,7 @@ public abstract class AbstractRedisCollection<E> extends AbstractCollection<E> i
|
||||
|
||||
public abstract void clear();
|
||||
|
||||
@Override
|
||||
|
||||
public boolean containsAll(Collection<?> c) {
|
||||
boolean contains = true;
|
||||
for (Object object : c) {
|
||||
@@ -75,7 +75,7 @@ public abstract class AbstractRedisCollection<E> extends AbstractCollection<E> i
|
||||
public abstract boolean remove(Object o);
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public boolean removeAll(Collection<?> c) {
|
||||
boolean modified = false;
|
||||
for (Object object : c) {
|
||||
@@ -88,7 +88,7 @@ public abstract class AbstractRedisCollection<E> extends AbstractCollection<E> i
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (o == this)
|
||||
return true;
|
||||
@@ -103,7 +103,7 @@ public abstract class AbstractRedisCollection<E> extends AbstractCollection<E> i
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int hashCode() {
|
||||
int result = 17 + getClass().hashCode();
|
||||
result = result * 31 + key.hashCode();
|
||||
@@ -111,7 +111,7 @@ public abstract class AbstractRedisCollection<E> extends AbstractCollection<E> i
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("RedisStore for key:");
|
||||
@@ -119,27 +119,27 @@ public abstract class AbstractRedisCollection<E> extends AbstractCollection<E> i
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean expire(long timeout, TimeUnit unit) {
|
||||
return operations.expire(key, timeout, unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean expireAt(Date date) {
|
||||
return operations.expireAt(key, date);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long getExpire() {
|
||||
return operations.getExpire(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean persist() {
|
||||
return operations.persist(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void rename(final String newKey) {
|
||||
CollectionUtils.rename(key, newKey, operations);
|
||||
key = newKey;
|
||||
|
||||
@@ -56,7 +56,7 @@ abstract class CollectionUtils {
|
||||
static <K> void rename(final K key, final K newKey, RedisOperations<K, ?> operations) {
|
||||
operations.execute(new SessionCallback<Object>() {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public Object execute(RedisOperations operations) throws DataAccessException {
|
||||
do {
|
||||
operations.watch(key);
|
||||
@@ -77,7 +77,7 @@ abstract class CollectionUtils {
|
||||
static <K> Boolean renameIfAbsent(final K key, final K newKey, RedisOperations<K, ?> operations) {
|
||||
return operations.execute(new SessionCallback<Boolean>() {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public Boolean execute(RedisOperations operations) throws DataAccessException {
|
||||
List<Object> exec = null;
|
||||
do {
|
||||
|
||||
@@ -55,7 +55,7 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
|
||||
super(delegate);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected void removeFromRedisStorage(E item) {
|
||||
DefaultRedisList.this.remove(item);
|
||||
}
|
||||
@@ -102,12 +102,12 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
|
||||
capped = (maxSize > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<E> range(long start, long end) {
|
||||
return listOps.range(start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisList<E> trim(int start, int end) {
|
||||
listOps.trim(start, end);
|
||||
return this;
|
||||
@@ -124,36 +124,36 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public Iterator<E> iterator() {
|
||||
return new DefaultRedisListIterator(content().iterator());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int size() {
|
||||
return listOps.size().intValue();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public boolean add(E value) {
|
||||
listOps.rightPush(value);
|
||||
cap();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void clear() {
|
||||
listOps.trim(size() + 1, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean remove(Object o) {
|
||||
Long result = listOps.remove(1, o);
|
||||
return (result != null && result.longValue() > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void add(int index, E element) {
|
||||
if (index == 0) {
|
||||
listOps.leftPush(element);
|
||||
@@ -176,7 +176,7 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
|
||||
throw new IllegalArgumentException("Redis supports insertion only at the beginning or the end of the list");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean addAll(int index, Collection<? extends E> c) {
|
||||
// insert collection in reverse
|
||||
if (index == 0) {
|
||||
@@ -206,7 +206,7 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
|
||||
throw new IllegalArgumentException("Redis supports insertion only at the beginning or the end of the list");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E get(int index) {
|
||||
if (index < 0 || index > size()) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
@@ -214,40 +214,40 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
|
||||
return listOps.index(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int indexOf(Object o) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int lastIndexOf(Object o) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public ListIterator<E> listIterator() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public ListIterator<E> listIterator(int index) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E remove(int index) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public E set(int index, E e) {
|
||||
E object = get(index);
|
||||
listOps.set(index, e);
|
||||
return object;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@@ -256,7 +256,7 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
|
||||
// Queue methods
|
||||
//
|
||||
|
||||
@Override
|
||||
|
||||
public E element() {
|
||||
E value = peek();
|
||||
if (value == null)
|
||||
@@ -266,7 +266,7 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public boolean offer(E e) {
|
||||
listOps.rightPush(e);
|
||||
cap();
|
||||
@@ -274,19 +274,19 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public E peek() {
|
||||
return listOps.index(0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public E poll() {
|
||||
return listOps.leftPop();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public E remove() {
|
||||
E value = poll();
|
||||
if (value == null)
|
||||
@@ -299,30 +299,30 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
|
||||
// Dequeue
|
||||
//
|
||||
|
||||
@Override
|
||||
|
||||
public void addFirst(E e) {
|
||||
listOps.leftPush(e);
|
||||
cap();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void addLast(E e) {
|
||||
add(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Iterator<E> descendingIterator() {
|
||||
List<E> content = content();
|
||||
Collections.reverse(content);
|
||||
return new DefaultRedisListIterator(content.iterator());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E getFirst() {
|
||||
return element();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E getLast() {
|
||||
E e = peekLast();
|
||||
if (e == null) {
|
||||
@@ -331,39 +331,39 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
|
||||
return e;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean offerFirst(E e) {
|
||||
addFirst(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean offerLast(E e) {
|
||||
addLast(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E peekFirst() {
|
||||
return peek();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E peekLast() {
|
||||
return listOps.index(-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E pollFirst() {
|
||||
return poll();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E pollLast() {
|
||||
return listOps.rightPop();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E pop() {
|
||||
E e = poll();
|
||||
if (e == null) {
|
||||
@@ -372,22 +372,22 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
|
||||
return e;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void push(E e) {
|
||||
addFirst(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E removeFirst() {
|
||||
return pop();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean removeFirstOccurrence(Object o) {
|
||||
return remove(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E removeLast() {
|
||||
E e = pollLast();
|
||||
if (e == null) {
|
||||
@@ -396,7 +396,7 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
|
||||
return e;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean removeLastOccurrence(Object o) {
|
||||
Long result = listOps.remove(-1, o);
|
||||
return (result != null && result.longValue() > 0);
|
||||
@@ -407,7 +407,7 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
|
||||
// BlockingQueue
|
||||
//
|
||||
|
||||
@Override
|
||||
|
||||
public int drainTo(Collection<? super E> c, int maxElements) {
|
||||
if (this.equals(c)) {
|
||||
throw new IllegalArgumentException("Cannot drain a queue to itself");
|
||||
@@ -423,33 +423,33 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
|
||||
return loop;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int drainTo(Collection<? super E> c) {
|
||||
return drainTo(c, size());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException {
|
||||
return offer(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E poll(long timeout, TimeUnit unit) throws InterruptedException {
|
||||
E element = listOps.leftPop(timeout, unit);
|
||||
return (element == null ? null : element);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void put(E e) throws InterruptedException {
|
||||
offer(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int remainingCapacity() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E take() throws InterruptedException {
|
||||
return poll(0, TimeUnit.SECONDS);
|
||||
}
|
||||
@@ -459,48 +459,48 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
|
||||
// BlockingDeque
|
||||
//
|
||||
|
||||
@Override
|
||||
|
||||
public boolean offerFirst(E e, long timeout, TimeUnit unit) throws InterruptedException {
|
||||
return offerFirst(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean offerLast(E e, long timeout, TimeUnit unit) throws InterruptedException {
|
||||
return offerLast(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E pollFirst(long timeout, TimeUnit unit) throws InterruptedException {
|
||||
return poll(timeout, unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E pollLast(long timeout, TimeUnit unit) throws InterruptedException {
|
||||
E element = listOps.rightPop(timeout, unit);
|
||||
return (element == null ? null : element);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void putFirst(E e) throws InterruptedException {
|
||||
add(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void putLast(E e) throws InterruptedException {
|
||||
put(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E takeFirst() throws InterruptedException {
|
||||
return take();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E takeLast() throws InterruptedException {
|
||||
return pollLast(0, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public DataType getType() {
|
||||
return DataType.LIST;
|
||||
}
|
||||
|
||||
@@ -50,17 +50,17 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public K getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V setValue(V value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@@ -85,32 +85,32 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
|
||||
this.hashOps = boundOps;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long increment(K key, long delta) {
|
||||
return hashOps.increment(key, delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisOperations<String, ?> getOperations() {
|
||||
return hashOps.getOperations();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void clear() {
|
||||
getOperations().delete(Collections.singleton(getKey()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean containsKey(Object key) {
|
||||
return hashOps.hasKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean containsValue(Object value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<java.util.Map.Entry<K, V>> entrySet() {
|
||||
Set<K> keySet = keySet();
|
||||
Collection<V> multiGet = hashOps.multiGet(keySet);
|
||||
@@ -126,51 +126,51 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
|
||||
return entries;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V get(Object key) {
|
||||
return hashOps.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean isEmpty() {
|
||||
return size() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<K> keySet() {
|
||||
return hashOps.keys();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V put(K key, V value) {
|
||||
V oldV = get(key);
|
||||
hashOps.put(key, value);
|
||||
return oldV;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void putAll(Map<? extends K, ? extends V> m) {
|
||||
hashOps.putAll(m);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V remove(Object key) {
|
||||
V v = get(key);
|
||||
hashOps.delete(key);
|
||||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int size() {
|
||||
return hashOps.size().intValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Collection<V> values() {
|
||||
return hashOps.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (o == this)
|
||||
return true;
|
||||
@@ -181,7 +181,7 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int hashCode() {
|
||||
int result = 17 + getClass().hashCode();
|
||||
result = result * 31 + getKey().hashCode();
|
||||
@@ -189,7 +189,7 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("RedisStore for key:");
|
||||
@@ -197,7 +197,7 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V putIfAbsent(K key, V value) {
|
||||
return (hashOps.putIfAbsent(key, value) ? null : get(key));
|
||||
|
||||
@@ -219,7 +219,7 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean remove(Object key, Object value) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
@@ -245,7 +245,7 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean replace(K key, V oldValue, V newValue) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
@@ -271,7 +271,7 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public V replace(K key, V value) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
@@ -297,38 +297,38 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean expire(long timeout, TimeUnit unit) {
|
||||
return hashOps.expire(timeout, unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean expireAt(Date date) {
|
||||
return hashOps.expireAt(date);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long getExpire() {
|
||||
return hashOps.getExpire();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean persist() {
|
||||
return hashOps.persist();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public String getKey() {
|
||||
return hashOps.getKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void rename(String newKey) {
|
||||
hashOps.rename(newKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public DataType getType() {
|
||||
return hashOps.getType();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class DefaultRedisSet<E> extends AbstractRedisCollection<E> implements Re
|
||||
super(delegate);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected void removeFromRedisStorage(E item) {
|
||||
DefaultRedisSet.this.remove(item);
|
||||
}
|
||||
@@ -68,79 +68,79 @@ public class DefaultRedisSet<E> extends AbstractRedisCollection<E> implements Re
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public Set<E> diff(RedisSet<?> set) {
|
||||
return boundSetOps.diff(set.getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<E> diff(Collection<? extends RedisSet<?>> sets) {
|
||||
return boundSetOps.diff(CollectionUtils.extractKeys(sets));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public RedisSet<E> diffAndStore(RedisSet<?> set, String destKey) {
|
||||
boundSetOps.diffAndStore(set.getKey(), destKey);
|
||||
return new DefaultRedisSet<E>(boundSetOps.getOperations().boundSetOps(destKey));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisSet<E> diffAndStore(Collection<? extends RedisSet<?>> sets, String destKey) {
|
||||
boundSetOps.diffAndStore(CollectionUtils.extractKeys(sets), destKey);
|
||||
return new DefaultRedisSet<E>(boundSetOps.getOperations().boundSetOps(destKey));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<E> intersect(RedisSet<?> set) {
|
||||
return boundSetOps.intersect(set.getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<E> intersect(Collection<? extends RedisSet<?>> sets) {
|
||||
return boundSetOps.intersect(CollectionUtils.extractKeys(sets));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisSet<E> intersectAndStore(RedisSet<?> set, String destKey) {
|
||||
boundSetOps.intersectAndStore(set.getKey(), destKey);
|
||||
return new DefaultRedisSet<E>(boundSetOps.getOperations().boundSetOps(destKey));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisSet<E> intersectAndStore(Collection<? extends RedisSet<?>> sets, String destKey) {
|
||||
boundSetOps.intersectAndStore(CollectionUtils.extractKeys(sets), destKey);
|
||||
return new DefaultRedisSet<E>(boundSetOps.getOperations().boundSetOps(destKey));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<E> union(RedisSet<?> set) {
|
||||
return boundSetOps.union(set.getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<E> union(Collection<? extends RedisSet<?>> sets) {
|
||||
return boundSetOps.union(CollectionUtils.extractKeys(sets));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisSet<E> unionAndStore(RedisSet<?> set, String destKey) {
|
||||
boundSetOps.unionAndStore(set.getKey(), destKey);
|
||||
return new DefaultRedisSet<E>(boundSetOps.getOperations().boundSetOps(destKey));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisSet<E> unionAndStore(Collection<? extends RedisSet<?>> sets, String destKey) {
|
||||
boundSetOps.unionAndStore(CollectionUtils.extractKeys(sets), destKey);
|
||||
return new DefaultRedisSet<E>(boundSetOps.getOperations().boundSetOps(destKey));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean add(E e) {
|
||||
return boundSetOps.add(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void clear() {
|
||||
// intersect the set with a non existing one
|
||||
// TODO: find a safer way to clean the set
|
||||
@@ -148,27 +148,27 @@ public class DefaultRedisSet<E> extends AbstractRedisCollection<E> implements Re
|
||||
boundSetOps.intersectAndStore(Collections.singleton(randomKey), getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean contains(Object o) {
|
||||
return boundSetOps.isMember(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Iterator<E> iterator() {
|
||||
return new DefaultRedisSetIterator(boundSetOps.members().iterator());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean remove(Object o) {
|
||||
return boundSetOps.remove(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int size() {
|
||||
return boundSetOps.size().intValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public DataType getType() {
|
||||
return DataType.SET;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class DefaultRedisZSet<E> extends AbstractRedisCollection<E> implements R
|
||||
super(delegate);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected void removeFromRedisStorage(E item) {
|
||||
DefaultRedisZSet.this.remove(item);
|
||||
}
|
||||
@@ -92,123 +92,121 @@ public class DefaultRedisZSet<E> extends AbstractRedisCollection<E> implements R
|
||||
this.defaultScore = defaultScore;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisZSet<E> intersectAndStore(RedisZSet<?> set, String destKey) {
|
||||
boundZSetOps.intersectAndStore(set.getKey(), destKey);
|
||||
return new DefaultRedisZSet<E>(boundZSetOps.getOperations().boundZSetOps(destKey), getDefaultScore());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisZSet<E> intersectAndStore(Collection<? extends RedisZSet<?>> sets, String destKey) {
|
||||
boundZSetOps.intersectAndStore(CollectionUtils.extractKeys(sets), destKey);
|
||||
return new DefaultRedisZSet<E>(boundZSetOps.getOperations().boundZSetOps(destKey), getDefaultScore());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<E> range(long start, long end) {
|
||||
return boundZSetOps.range(start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<E> reverseRange(long start, long end) {
|
||||
return boundZSetOps.reverseRange(start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<E> rangeByScore(double min, double max) {
|
||||
return boundZSetOps.rangeByScore(min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<E> reverseRangeByScore(double min, double max) {
|
||||
return boundZSetOps.reverseRangeByScore(min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<TypedTuple<E>> rangeByScoreWithScores(double min, double max) {
|
||||
return boundZSetOps.rangeByScoreWithScores(min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<TypedTuple<E>> rangeWithScores(long start, long end) {
|
||||
return boundZSetOps.rangeWithScores(start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<TypedTuple<E>> reverseRangeByScoreWithScores(double min, double max) {
|
||||
return boundZSetOps.reverseRangeByScoreWithScores(min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Set<TypedTuple<E>> reverseRangeWithScores(long start, long end) {
|
||||
return boundZSetOps.reverseRangeWithScores(start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisZSet<E> remove(long start, long end) {
|
||||
boundZSetOps.removeRange(start, end);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisZSet<E> removeByScore(double min, double max) {
|
||||
boundZSetOps.removeRangeByScore(min, max);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisZSet<E> unionAndStore(RedisZSet<?> set, String destKey) {
|
||||
boundZSetOps.unionAndStore(set.getKey(), destKey);
|
||||
return new DefaultRedisZSet<E>(boundZSetOps.getOperations().boundZSetOps(destKey), getDefaultScore());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedisZSet<E> unionAndStore(Collection<? extends RedisZSet<?>> sets, String destKey) {
|
||||
boundZSetOps.unionAndStore(CollectionUtils.extractKeys(sets), destKey);
|
||||
return new DefaultRedisZSet<E>(boundZSetOps.getOperations().boundZSetOps(destKey), getDefaultScore());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean add(E e) {
|
||||
return add(e, getDefaultScore());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(E e, double score) {
|
||||
return boundZSetOps.add(e, score);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void clear() {
|
||||
boundZSetOps.removeRange(0, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean contains(Object o) {
|
||||
return (boundZSetOps.rank(o) != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Iterator<E> iterator() {
|
||||
return new DefaultRedisSortedSetIterator(boundZSetOps.range(0, -1).iterator());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean remove(Object o) {
|
||||
return boundZSetOps.remove(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int size() {
|
||||
return boundZSetOps.size().intValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Double getDefaultScore() {
|
||||
return defaultScore;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E first() {
|
||||
Iterator<E> iterator = boundZSetOps.range(0, 0).iterator();
|
||||
if (iterator.hasNext())
|
||||
@@ -216,7 +214,7 @@ public class DefaultRedisZSet<E> extends AbstractRedisCollection<E> implements R
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public E last() {
|
||||
Iterator<E> iterator = boundZSetOps.reverseRange(0, 0).iterator();
|
||||
if (iterator.hasNext())
|
||||
@@ -224,22 +222,22 @@ public class DefaultRedisZSet<E> extends AbstractRedisCollection<E> implements R
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long rank(Object o) {
|
||||
return boundZSetOps.rank(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long reverseRank(Object o) {
|
||||
return boundZSetOps.reverseRank(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Double score(Object o) {
|
||||
return boundZSetOps.score(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public DataType getType() {
|
||||
return DataType.ZSET;
|
||||
}
|
||||
|
||||
@@ -39,31 +39,31 @@ public class RedisCollectionFactoryBean implements InitializingBean, BeanNameAwa
|
||||
*/
|
||||
public enum CollectionType {
|
||||
LIST {
|
||||
@Override
|
||||
|
||||
public DataType dataType() {
|
||||
return DataType.LIST;
|
||||
}
|
||||
},
|
||||
SET {
|
||||
@Override
|
||||
|
||||
public DataType dataType() {
|
||||
return DataType.SET;
|
||||
}
|
||||
},
|
||||
ZSET {
|
||||
@Override
|
||||
|
||||
public DataType dataType() {
|
||||
return DataType.ZSET;
|
||||
}
|
||||
},
|
||||
MAP {
|
||||
@Override
|
||||
|
||||
public DataType dataType() {
|
||||
return DataType.HASH;
|
||||
}
|
||||
},
|
||||
PROPERTIES {
|
||||
@Override
|
||||
|
||||
public DataType dataType() {
|
||||
return DataType.HASH;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class RedisCollectionFactoryBean implements InitializingBean, BeanNameAwa
|
||||
private String key;
|
||||
private String beanName;
|
||||
|
||||
@Override
|
||||
|
||||
public void afterPropertiesSet() {
|
||||
if (!StringUtils.hasText(key)) {
|
||||
key = beanName;
|
||||
@@ -124,22 +124,22 @@ public class RedisCollectionFactoryBean implements InitializingBean, BeanNameAwa
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisStore getObject() {
|
||||
return store;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Class<?> getObjectType() {
|
||||
return (store != null ? store.getClass() : RedisStore.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void setBeanName(String name) {
|
||||
this.beanName = name;
|
||||
}
|
||||
|
||||
@@ -89,23 +89,23 @@ public class RedisProperties extends Properties implements RedisMap<Object, Obje
|
||||
this(defaults, operations.<String, String> boundHashOps(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public synchronized Object get(Object key) {
|
||||
return delegate.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public synchronized Object put(Object key, Object value) {
|
||||
return delegate.put((String) key, (String) value);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public synchronized void putAll(Map<? extends Object, ? extends Object> t) {
|
||||
delegate.putAll((Map<? extends String, ? extends String>) t);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Enumeration<?> propertyNames() {
|
||||
Set<String> keys = new LinkedHashSet<String>(delegate.keySet());
|
||||
if (defaults != null) {
|
||||
@@ -114,46 +114,46 @@ public class RedisProperties extends Properties implements RedisMap<Object, Obje
|
||||
return Collections.enumeration(keys);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public synchronized void clear() {
|
||||
delegate.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public synchronized Object clone() {
|
||||
return new RedisProperties(defaults, hashOps);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public synchronized boolean contains(Object value) {
|
||||
return containsValue(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public synchronized boolean containsKey(Object key) {
|
||||
return delegate.containsKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean containsValue(Object value) {
|
||||
return delegate.containsValue(value);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public synchronized Enumeration<Object> elements() {
|
||||
Collection values = delegate.values();
|
||||
return Collections.enumeration(values);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Set<Entry<Object, Object>> entrySet() {
|
||||
Set entries = delegate.entrySet();
|
||||
return entries;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public synchronized boolean equals(Object o) {
|
||||
if (o == this)
|
||||
return true;
|
||||
@@ -164,118 +164,118 @@ public class RedisProperties extends Properties implements RedisMap<Object, Obje
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public synchronized int hashCode() {
|
||||
int hash = RedisProperties.class.hashCode();
|
||||
return hash * 17 + delegate.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public synchronized boolean isEmpty() {
|
||||
return delegate.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public synchronized Enumeration<Object> keys() {
|
||||
Set<Object> keys = keySet();
|
||||
return Collections.enumeration(keys);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public Set<Object> keySet() {
|
||||
Set keys = delegate.keySet();
|
||||
return keys;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public synchronized Object remove(Object key) {
|
||||
return delegate.remove(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public synchronized int size() {
|
||||
return delegate.size();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
public Collection<Object> values() {
|
||||
Collection vals = delegate.values();
|
||||
return vals;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long increment(Object key, long delta) {
|
||||
return hashOps.increment((String) key, delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public RedisOperations<String, ?> getOperations() {
|
||||
return hashOps.getOperations();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean expire(long timeout, TimeUnit unit) {
|
||||
return hashOps.expire(timeout, unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean expireAt(Date date) {
|
||||
return hashOps.expireAt(date);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long getExpire() {
|
||||
return hashOps.getExpire();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String getKey() {
|
||||
return hashOps.getKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public DataType getType() {
|
||||
return hashOps.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Boolean persist() {
|
||||
return hashOps.persist();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void rename(String newKey) {
|
||||
hashOps.rename(newKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Object putIfAbsent(Object key, Object value) {
|
||||
return (hashOps.putIfAbsent((String) key, (String) value) ? null : get(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean remove(Object key, Object value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean replace(Object key, Object oldValue, Object newValue) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Object replace(Object key, Object value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public synchronized void storeToXML(OutputStream os, String comment, String encoding) throws IOException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public synchronized void storeToXML(OutputStream os, String comment) throws IOException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user