+ replaced usage of int/Integers to long/Long for consistent results between x86/x64 Redis instances

+ updated some method names to be consistent between interfaces
+ converted return types from primitives to objects
+ updated to Jedis 1.5.0-RC1
This commit is contained in:
Costin Leau
2010-12-02 14:04:36 +02:00
parent bcbb6d67ae
commit 9b0067ce72
38 changed files with 320 additions and 324 deletions

View File

@@ -13,7 +13,7 @@
<properties>
<jredis.ver>02112010</jredis.ver>
<jedis.ver>1.4.0</jedis.ver>
<jedis.ver>1.5.0-RC1</jedis.ver>
</properties>
<dependencies>
@@ -115,12 +115,6 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.commons</groupId>
<artifactId>spring-commons-serializer</artifactId>
<version>1.0.0.M1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>

View File

@@ -28,7 +28,7 @@ public interface RedisCommands extends RedisTxCommands, RedisStringCommands, Red
Boolean exists(byte[] key);
Integer del(byte[]... keys);
Long del(byte[]... keys);
DataType type(byte[] key);
@@ -40,15 +40,15 @@ public interface RedisCommands extends RedisTxCommands, RedisStringCommands, Red
Boolean renameNX(byte[] oldName, byte[] newName);
Integer dbSize();
Long dbSize();
Boolean expire(byte[] key, int seconds);
Boolean expire(byte[] key, long seconds);
Boolean expireAt(byte[] key, long unixTime);
Boolean persist(byte[] key);
Integer ttl(byte[] key);
Long ttl(byte[] key);
void select(int dbIndex);

View File

@@ -37,13 +37,13 @@ public interface RedisHashCommands {
void hMSet(byte[] key, Map<byte[], byte[]> hashes);
Integer hIncrBy(byte[] key, byte[] field, int delta);
Long hIncrBy(byte[] key, byte[] field, long delta);
Boolean hExists(byte[] key, byte[] field);
Boolean hDel(byte[] key, byte[] field);
Integer hLen(byte[] key);
Long hLen(byte[] key);
Set<byte[]> hKeys(byte[] key);

View File

@@ -25,21 +25,21 @@ import java.util.List;
*/
public interface RedisListCommands {
Integer rPush(byte[] key, byte[] value);
Long rPush(byte[] key, byte[] value);
Integer lPush(byte[] key, byte[] value);
Long lPush(byte[] key, byte[] value);
Integer lLen(byte[] key);
Long lLen(byte[] key);
List<byte[]> lRange(byte[] key, int start, int end);
List<byte[]> lRange(byte[] key, long start, long end);
void lTrim(byte[] key, int start, int end);
void lTrim(byte[] key, long start, long end);
byte[] lIndex(byte[] key, int index);
byte[] lIndex(byte[] key, long index);
void lSet(byte[] key, int index, byte[] value);
void lSet(byte[] key, long index, byte[] value);
Integer lRem(byte[] key, int count, byte[] value);
Long lRem(byte[] key, long count, byte[] value);
byte[] lPop(byte[] key);

View File

@@ -33,7 +33,7 @@ public interface RedisSetCommands {
Boolean sMove(byte[] srcKey, byte[] destKey, byte[] value);
Integer sCard(byte[] key);
Long sCard(byte[] key);
Boolean sIsMember(byte[] key, byte[] value);

View File

@@ -36,21 +36,21 @@ public interface RedisStringCommands {
Boolean setNX(byte[] key, byte[] value);
void setEx(byte[] key, int seconds, byte[] value);
void setEx(byte[] key, long seconds, byte[] value);
void mSet(Map<byte[], byte[]> tuple);
void mSetNX(Map<byte[], byte[]> tuple);
Integer incr(byte[] key);
Long incr(byte[] key);
Integer incrBy(byte[] key, int value);
Long incrBy(byte[] key, long value);
Integer decr(byte[] key);
Long decr(byte[] key);
Integer decrBy(byte[] key, int value);
Long decrBy(byte[] key, long value);
Integer append(byte[] key, byte[] value);
Long append(byte[] key, byte[] value);
byte[] substr(byte[] key, int start, int end);
byte[] substr(byte[] key, long start, long end);
}

View File

@@ -42,41 +42,41 @@ public interface RedisZSetCommands {
Double zIncrBy(byte[] key, double increment, byte[] value);
Integer zRank(byte[] key, byte[] value);
Long zRank(byte[] key, byte[] value);
Integer zRevRank(byte[] key, byte[] value);
Long zRevRank(byte[] key, byte[] value);
Set<byte[]> zRange(byte[] key, int start, int end);
Set<byte[]> zRange(byte[] key, long start, long end);
Set<Tuple> zRangeWithScore(byte[] key, int start, int end);
Set<Tuple> zRangeWithScore(byte[] key, long start, long end);
Set<byte[]> zRevRange(byte[] key, int start, int end);
Set<byte[]> zRevRange(byte[] key, long start, long end);
Set<Tuple> zRevRangeWithScore(byte[] key, int start, int end);
Set<Tuple> zRevRangeWithScore(byte[] key, long start, long end);
Set<byte[]> zRangeByScore(byte[] key, double min, double max);
Set<Tuple> zRangeByScoreWithScore(byte[] key, double min, double max);
Set<byte[]> zRangeByScore(byte[] key, double min, double max, int offset, int count);
Set<byte[]> zRangeByScore(byte[] key, double min, double max, long offset, long count);
Set<Tuple> zRangeByScoreWithScore(byte[] key, double min, double max, int offset, int count);
Set<Tuple> zRangeByScoreWithScore(byte[] key, double min, double max, long offset, long count);
Integer zCount(byte[] key, double min, double max);
Long zCount(byte[] key, double min, double max);
Integer zCard(byte[] key);
Long zCard(byte[] key);
Double zScore(byte[] key, byte[] value);
Integer zRemRange(byte[] key, int start, int end);
Long zRemRange(byte[] key, long start, long end);
Integer zRemRangeByScore(byte[] key, double min, double max);
Long zRemRangeByScore(byte[] key, double min, double max);
Integer zUnionStore(byte[] destKey, byte[]... sets);
Long zUnionStore(byte[] destKey, byte[]... sets);
Integer zUnionStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets);
Long zUnionStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets);
Integer zInterStore(byte[] destKey, byte[]... sets);
Long zInterStore(byte[] destKey, byte[]... sets);
Integer zInterStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets);
Long zInterStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets);
}

View File

@@ -108,7 +108,7 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Integer dbSize() {
public Long dbSize() {
try {
if (isQueueing()) {
transaction.dbSize();
@@ -134,7 +134,7 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Integer del(byte[]... keys) {
public Long del(byte[]... keys) {
try {
if (isQueueing()) {
transaction.del(keys);
@@ -178,10 +178,10 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Boolean expire(byte[] key, int seconds) {
public Boolean expire(byte[] key, long seconds) {
try {
if (isQueueing()) {
transaction.expire(key, seconds);
transaction.expire(key, (int) seconds);
return null;
}
return (jedis.expire(key, (int) seconds) == 1);
@@ -289,7 +289,7 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Integer ttl(byte[] key) {
public Long ttl(byte[] key) {
try {
if (isQueueing()) {
transaction.ttl(key);
@@ -381,7 +381,7 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Integer append(byte[] key, byte[] value) {
public Long append(byte[] key, byte[] value) {
try {
if (isQueueing()) {
transaction.append(key, value);
@@ -431,12 +431,12 @@ public class JedisConnection implements RedisConnection {
}
@Override
public void setEx(byte[] key, int time, byte[] value) {
public void setEx(byte[] key, long time, byte[] value) {
try {
if (isQueueing()) {
transaction.setex(key, time, value);
transaction.setex(key, (int) time, value);
}
jedis.setex(key, time, value);
jedis.setex(key, (int) time, value);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
@@ -455,20 +455,20 @@ public class JedisConnection implements RedisConnection {
}
@Override
public byte[] substr(byte[] key, int start, int end) {
public byte[] substr(byte[] key, long start, long end) {
try {
if (isQueueing()) {
transaction.substr(key, start, end);
transaction.substr(key, (int) start, (int) end);
return null;
}
return jedis.substr(key, start, end);
return jedis.substr(key, (int) start, (int) end);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
@Override
public Integer decr(byte[] key) {
public Long decr(byte[] key) {
try {
if (isQueueing()) {
transaction.decr(key);
@@ -481,20 +481,20 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Integer decrBy(byte[] key, int value) {
public Long decrBy(byte[] key, long value) {
try {
if (isQueueing()) {
transaction.decrBy(key, value);
transaction.decrBy(key, (int) value);
return null;
}
return jedis.decrBy(key, value);
return jedis.decrBy(key, (int) value);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
@Override
public Integer incr(byte[] key) {
public Long incr(byte[] key) {
try {
if (isQueueing()) {
transaction.incr(key);
@@ -507,13 +507,13 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Integer incrBy(byte[] key, int value) {
public Long incrBy(byte[] key, long value) {
try {
if (isQueueing()) {
transaction.incrBy(key, value);
transaction.incrBy(key, (int) value);
return null;
}
return jedis.incrBy(key, value);
return jedis.incrBy(key, (int) value);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
@@ -525,7 +525,7 @@ public class JedisConnection implements RedisConnection {
@Override
public Integer lPush(byte[] key, byte[] value) {
public Long lPush(byte[] key, byte[] value) {
try {
if (isQueueing()) {
transaction.lpush(key, value);
@@ -538,7 +538,7 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Integer rPush(byte[] key, byte[] value) {
public Long rPush(byte[] key, byte[] value) {
try {
if (isQueueing()) {
transaction.rpush(key, value);
@@ -575,20 +575,20 @@ public class JedisConnection implements RedisConnection {
}
@Override
public byte[] lIndex(byte[] key, int index) {
public byte[] lIndex(byte[] key, long index) {
try {
if (isQueueing()) {
transaction.lindex(key, index);
transaction.lindex(key, (int) index);
return null;
}
return jedis.lindex(key, index);
return jedis.lindex(key, (int) index);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
@Override
public Integer lLen(byte[] key) {
public Long lLen(byte[] key) {
try {
if (isQueueing()) {
transaction.llen(key);
@@ -614,50 +614,50 @@ public class JedisConnection implements RedisConnection {
}
@Override
public List<byte[]> lRange(byte[] key, int start, int end) {
public List<byte[]> lRange(byte[] key, long start, long end) {
try {
if (isQueueing()) {
transaction.lrange(key, start, end);
transaction.lrange(key, (int) start, (int) end);
return null;
}
return jedis.lrange(key, start, end);
return jedis.lrange(key, (int) start, (int) end);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
@Override
public Integer lRem(byte[] key, int count, byte[] value) {
public Long lRem(byte[] key, long count, byte[] value) {
try {
if (isQueueing()) {
transaction.lrem(key, count, value);
transaction.lrem(key, (int) count, value);
return null;
}
return jedis.lrem(key, count, value);
return jedis.lrem(key, (int) count, value);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
@Override
public void lSet(byte[] key, int index, byte[] value) {
public void lSet(byte[] key, long index, byte[] value) {
try {
if (isQueueing()) {
transaction.lset(key, index, value);
transaction.lset(key, (int) index, value);
}
jedis.lset(key, index, value);
jedis.lset(key, (int) index, value);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
@Override
public void lTrim(byte[] key, int start, int end) {
public void lTrim(byte[] key, long start, long end) {
try {
if (isQueueing()) {
transaction.ltrim(key, start, end);
transaction.ltrim(key, (int) start, (int) end);
}
jedis.ltrim(key, start, end);
jedis.ltrim(key, (int) start, (int) end);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
@@ -708,7 +708,7 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Integer sCard(byte[] key) {
public Long sCard(byte[] key) {
try {
if (isQueueing()) {
transaction.scard(key);
@@ -891,7 +891,7 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Integer zCard(byte[] key) {
public Long zCard(byte[] key) {
try {
if (isQueueing()) {
transaction.zcard(key);
@@ -904,7 +904,7 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Integer zCount(byte[] key, double min, double max) {
public Long zCount(byte[] key, double min, double max) {
try {
if (isQueueing()) {
throw new UnsupportedOperationException();
@@ -929,7 +929,7 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Integer zInterStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets) {
public Long zInterStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets) {
try {
if (isQueueing()) {
throw new UnsupportedOperationException();
@@ -943,7 +943,7 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Integer zInterStore(byte[] destKey, byte[]... sets) {
public Long zInterStore(byte[] destKey, byte[]... sets) {
try {
if (isQueueing()) {
throw new UnsupportedOperationException();
@@ -955,26 +955,26 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Set<byte[]> zRange(byte[] key, int start, int end) {
public Set<byte[]> zRange(byte[] key, long start, long end) {
try {
if (isQueueing()) {
transaction.zrange(key, start, end);
transaction.zrange(key, (int) start, (int) end);
return null;
}
return jedis.zrange(key, start, end);
return jedis.zrange(key, (int) start, (int) end);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
@Override
public Set<Tuple> zRangeWithScore(byte[] key, int start, int end) {
public Set<Tuple> zRangeWithScore(byte[] key, long start, long end) {
try {
if (isQueueing()) {
transaction.zrangeWithScores(key, start, end);
transaction.zrangeWithScores(key, (int) start, (int) end);
return null;
}
return JedisUtils.convertJedisTuple(jedis.zrangeWithScores(key, start, end));
return JedisUtils.convertJedisTuple(jedis.zrangeWithScores(key, (int) start, (int) end));
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
@@ -1005,44 +1005,44 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Set<Tuple> zRevRangeWithScore(byte[] key, int start, int end) {
public Set<Tuple> zRevRangeWithScore(byte[] key, long start, long end) {
try {
if (isQueueing()) {
transaction.zrangeWithScores(key, start, end);
transaction.zrangeWithScores(key, (int) start, (int) end);
return null;
}
return JedisUtils.convertJedisTuple(jedis.zrangeByScoreWithScores(key, start, end));
return JedisUtils.convertJedisTuple(jedis.zrangeByScoreWithScores(key, (int) start, (int) end));
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
@Override
public Set<byte[]> zRangeByScore(byte[] key, double min, double max, int offset, int count) {
public Set<byte[]> zRangeByScore(byte[] key, double min, double max, long offset, long count) {
try {
if (isQueueing()) {
throw new UnsupportedOperationException();
}
return jedis.zrangeByScore(key, min, max, offset, count);
return jedis.zrangeByScore(key, min, max, (int) offset, (int) count);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
@Override
public Set<Tuple> zRangeByScoreWithScore(byte[] key, double min, double max, int offset, int count) {
public Set<Tuple> zRangeByScoreWithScore(byte[] key, double min, double max, long offset, long count) {
try {
if (isQueueing()) {
throw new UnsupportedOperationException();
}
return JedisUtils.convertJedisTuple(jedis.zrangeByScoreWithScores(key, min, max, offset, count));
return JedisUtils.convertJedisTuple(jedis.zrangeByScoreWithScores(key, min, max, (int) offset, (int) count));
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
@Override
public Integer zRank(byte[] key, byte[] value) {
public Long zRank(byte[] key, byte[] value) {
try {
if (isQueueing()) {
transaction.zrank(key, value);
@@ -1068,19 +1068,19 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Integer zRemRange(byte[] key, int start, int end) {
public Long zRemRange(byte[] key, long start, long end) {
try {
if (isQueueing()) {
throw new UnsupportedOperationException();
}
return jedis.zremrangeByRank(key, start, end);
return jedis.zremrangeByRank(key, (int) start, (int) end);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
@Override
public Integer zRemRangeByScore(byte[] key, double min, double max) {
public Long zRemRangeByScore(byte[] key, double min, double max) {
try {
if (isQueueing()) {
throw new UnsupportedOperationException();
@@ -1092,20 +1092,20 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Set<byte[]> zRevRange(byte[] key, int start, int end) {
public Set<byte[]> zRevRange(byte[] key, long start, long end) {
try {
if (isQueueing()) {
transaction.zrevrange(key, start, end);
transaction.zrevrange(key, (int) start, (int) end);
return null;
}
return jedis.zrevrange(key, start, end);
return jedis.zrevrange(key, (int) start, (int) end);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
@Override
public Integer zRevRank(byte[] key, byte[] value) {
public Long zRevRank(byte[] key, byte[] value) {
try {
if (isQueueing()) {
transaction.zrevrank(key, value);
@@ -1131,7 +1131,7 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Integer zUnionStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets) {
public Long zUnionStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets) {
try {
if (isQueueing()) {
throw new UnsupportedOperationException();
@@ -1145,7 +1145,7 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Integer zUnionStore(byte[] destKey, byte[]... sets) {
public Long zUnionStore(byte[] destKey, byte[]... sets) {
try {
if (isQueueing()) {
throw new UnsupportedOperationException();
@@ -1239,13 +1239,13 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Integer hIncrBy(byte[] key, byte[] field, int delta) {
public Long hIncrBy(byte[] key, byte[] field, long delta) {
try {
if (isQueueing()) {
transaction.hincrBy(key, field, delta);
transaction.hincrBy(key, field, (int) delta);
return null;
}
return jedis.hincrBy(key, field, delta);
return jedis.hincrBy(key, field, (int) delta);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
@@ -1265,7 +1265,7 @@ public class JedisConnection implements RedisConnection {
}
@Override
public Integer hLen(byte[] key) {
public Long hLen(byte[] key) {
try {
if (isQueueing()) {
transaction.hlen(key);

View File

@@ -16,13 +16,13 @@
package org.springframework.data.keyvalue.redis.connection.jedis;
import java.util.concurrent.TimeoutException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.pool.impl.GenericObjectPool;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.DataAccessResourceFailureException;
import org.springframework.data.keyvalue.redis.connection.RedisConnection;
import org.springframework.data.keyvalue.redis.connection.RedisConnectionFactory;
import org.springframework.util.Assert;
@@ -99,8 +99,8 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean,
return pool.getResource();
}
return new Jedis(getShardInfo());
} catch (TimeoutException ex) {
throw JedisUtils.convertJedisAccessException(ex);
} catch (Exception ex) {
throw new DataAccessResourceFailureException("Cannot get Jedis connection", ex);
}
}
@@ -115,15 +115,18 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean,
if (usePool) {
int size = getPoolSize();
pool = new JedisPool(shardInfo);
pool.setResourcesNumber(size);
pool.init();
pool = new JedisPool(new GenericObjectPool.Config(), shardInfo.getHost(), shardInfo.getPort(),
shardInfo.getTimeout(), shardInfo.getPassword());
}
}
public void destroy() {
if (usePool && pool != null) {
pool.destroy();
try {
pool.destroy();
} catch (Exception ex) {
log.warn("Cannot properly close Jedis pool", ex);
}
pool = null;
}
}

View File

@@ -70,8 +70,8 @@ public abstract class JedisUtils {
return status != null && (OK_CODE.equals(status) || OK_MULTI_CODE.equals(status));
}
static Boolean convertCodeReply(Integer code) {
return (code != null ? code == 1 : null);
static Boolean convertCodeReply(Number code) {
return (code != null ? code.intValue() == 1 : null);
}
static Set<Tuple> convertJedisTuple(Set<redis.clients.jedis.Tuple> tuples) {

View File

@@ -76,9 +76,9 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Integer dbSize() {
public Long dbSize() {
try {
return Integer.valueOf((int) jredis.dbsize());
return jredis.dbsize();
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}
@@ -94,9 +94,9 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Integer del(byte[]... keys) {
public Long del(byte[]... keys) {
try {
return Integer.valueOf((int) jredis.del(JredisUtils.convertMultiple(charset, keys)));
return jredis.del(JredisUtils.convertMultiple(charset, keys));
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}
@@ -126,9 +126,9 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Boolean expire(byte[] key, int seconds) {
public Boolean expire(byte[] key, long seconds) {
try {
return jredis.expire(JredisUtils.convert(charset, key), seconds);
return jredis.expire(JredisUtils.convert(charset, key), (int) seconds);
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}
@@ -195,9 +195,9 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Integer ttl(byte[] key) {
public Long ttl(byte[] key) {
try {
return Integer.valueOf((int) jredis.ttl(JredisUtils.convert(charset, key)));
return jredis.ttl(JredisUtils.convert(charset, key));
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}
@@ -254,9 +254,9 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Integer append(byte[] key, byte[] value) {
public Long append(byte[] key, byte[] value) {
try {
return Integer.valueOf((int) jredis.append(JredisUtils.convert(charset, key), value));
return jredis.append(JredisUtils.convert(charset, key), value);
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}
@@ -290,7 +290,7 @@ public class JredisConnection implements RedisConnection {
}
@Override
public void setEx(byte[] key, int seconds, byte[] value) {
public void setEx(byte[] key, long seconds, byte[] value) {
throw new UnsupportedOperationException();
}
@@ -304,7 +304,7 @@ public class JredisConnection implements RedisConnection {
}
@Override
public byte[] substr(byte[] key, int start, int end) {
public byte[] substr(byte[] key, long start, long end) {
try {
return jredis.substr(JredisUtils.convert(charset, key), (long) start, (long) end);
} catch (RedisException ex) {
@@ -313,36 +313,36 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Integer decr(byte[] key) {
public Long decr(byte[] key) {
try {
return (int) jredis.decr(JredisUtils.convert(charset, key));
return jredis.decr(JredisUtils.convert(charset, key));
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}
}
@Override
public Integer decrBy(byte[] key, int value) {
public Long decrBy(byte[] key, long value) {
try {
return (int) jredis.decrby(JredisUtils.convert(charset, key), value);
return jredis.decrby(JredisUtils.convert(charset, key), (int) value);
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}
}
@Override
public Integer incr(byte[] key) {
public Long incr(byte[] key) {
try {
return (int) jredis.incr(JredisUtils.convert(charset, key));
return jredis.incr(JredisUtils.convert(charset, key));
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}
}
@Override
public Integer incrBy(byte[] key, int value) {
public Long incrBy(byte[] key, long value) {
try {
return (int) jredis.incrby(JredisUtils.convert(charset, key), value);
return jredis.incrby(JredisUtils.convert(charset, key), (int) value);
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}
@@ -363,7 +363,7 @@ public class JredisConnection implements RedisConnection {
}
@Override
public byte[] lIndex(byte[] key, int index) {
public byte[] lIndex(byte[] key, long index) {
try {
return jredis.lindex(JredisUtils.convert(charset, key), (long) index);
} catch (RedisException ex) {
@@ -372,9 +372,9 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Integer lLen(byte[] key) {
public Long lLen(byte[] key) {
try {
return Integer.valueOf((int) jredis.llen(JredisUtils.convert(charset, key)));
return jredis.llen(JredisUtils.convert(charset, key));
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}
@@ -390,7 +390,7 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Integer lPush(byte[] key, byte[] value) {
public Long lPush(byte[] key, byte[] value) {
try {
jredis.lpush(JredisUtils.convert(charset, key), value);
return null;
@@ -400,7 +400,7 @@ public class JredisConnection implements RedisConnection {
}
@Override
public List<byte[]> lRange(byte[] key, int start, int end) {
public List<byte[]> lRange(byte[] key, long start, long end) {
try {
List<byte[]> lrange = jredis.lrange(JredisUtils.convert(charset, key), start, end);
@@ -411,16 +411,16 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Integer lRem(byte[] key, int count, byte[] value) {
public Long lRem(byte[] key, long count, byte[] value) {
try {
return Integer.valueOf((int) jredis.lrem(JredisUtils.convert(charset, key), value, count));
return jredis.lrem(JredisUtils.convert(charset, key), value, (int) count);
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}
}
@Override
public void lSet(byte[] key, int index, byte[] value) {
public void lSet(byte[] key, long index, byte[] value) {
try {
jredis.lset(JredisUtils.convert(charset, key), index, value);
} catch (RedisException ex) {
@@ -429,7 +429,7 @@ public class JredisConnection implements RedisConnection {
}
@Override
public void lTrim(byte[] key, int start, int end) {
public void lTrim(byte[] key, long start, long end) {
try {
jredis.ltrim(JredisUtils.convert(charset, key), start, end);
} catch (RedisException ex) {
@@ -456,7 +456,7 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Integer rPush(byte[] key, byte[] value) {
public Long rPush(byte[] key, byte[] value) {
try {
jredis.rpush(JredisUtils.convert(charset, key), value);
return null;
@@ -479,9 +479,9 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Integer sCard(byte[] key) {
public Long sCard(byte[] key) {
try {
return Integer.valueOf((int) jredis.scard(JredisUtils.convert(charset, key)));
return jredis.scard(JredisUtils.convert(charset, key));
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}
@@ -630,18 +630,18 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Integer zCard(byte[] key) {
public Long zCard(byte[] key) {
try {
return Integer.valueOf((int) jredis.zcard(JredisUtils.convert(charset, key)));
return jredis.zcard(JredisUtils.convert(charset, key));
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}
}
@Override
public Integer zCount(byte[] key, double min, double max) {
public Long zCount(byte[] key, double min, double max) {
try {
return Integer.valueOf((int) jredis.zcount(JredisUtils.convert(charset, key), min, max));
return jredis.zcount(JredisUtils.convert(charset, key), min, max);
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}
@@ -657,17 +657,17 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Integer zInterStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets) {
public Long zInterStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets) {
throw new UnsupportedOperationException();
}
@Override
public Integer zInterStore(byte[] destKey, byte[]... sets) {
public Long zInterStore(byte[] destKey, byte[]... sets) {
throw new UnsupportedOperationException();
}
@Override
public Set<byte[]> zRange(byte[] key, int start, int end) {
public Set<byte[]> zRange(byte[] key, long start, long end) {
try {
return new LinkedHashSet<byte[]>(jredis.zrange(JredisUtils.convert(charset, key), (long) start, (long) end));
} catch (RedisException ex) {
@@ -676,7 +676,7 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Set<Tuple> zRangeWithScore(byte[] key, int start, int end) {
public Set<Tuple> zRangeWithScore(byte[] key, long start, long end) {
throw new UnsupportedOperationException();
}
@@ -696,19 +696,19 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Set<byte[]> zRangeByScore(byte[] key, double min, double max, int offset, int count) {
public Set<byte[]> zRangeByScore(byte[] key, double min, double max, long offset, long count) {
throw new UnsupportedOperationException();
}
@Override
public Set<Tuple> zRangeByScoreWithScore(byte[] key, double min, double max, int offset, int count) {
public Set<Tuple> zRangeByScoreWithScore(byte[] key, double min, double max, long offset, long count) {
throw new UnsupportedOperationException();
}
@Override
public Integer zRank(byte[] key, byte[] value) {
public Long zRank(byte[] key, byte[] value) {
try {
return Integer.valueOf((int) jredis.zrank(JredisUtils.convert(charset, key), value));
return jredis.zrank(JredisUtils.convert(charset, key), value);
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}
@@ -724,25 +724,25 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Integer zRemRange(byte[] key, int start, int end) {
public Long zRemRange(byte[] key, long start, long end) {
try {
return Integer.valueOf((int) jredis.zremrangebyrank(JredisUtils.convert(charset, key), start, end));
return jredis.zremrangebyrank(JredisUtils.convert(charset, key), start, end);
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}
}
@Override
public Integer zRemRangeByScore(byte[] key, double min, double max) {
public Long zRemRangeByScore(byte[] key, double min, double max) {
try {
return Integer.valueOf((int) jredis.zremrangebyscore(JredisUtils.convert(charset, key), min, max));
return jredis.zremrangebyscore(JredisUtils.convert(charset, key), min, max);
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}
}
@Override
public Set<byte[]> zRevRange(byte[] key, int start, int end) {
public Set<byte[]> zRevRange(byte[] key, long start, long end) {
try {
return new LinkedHashSet<byte[]>(jredis.zrevrange(JredisUtils.convert(charset, key), start, end));
} catch (RedisException ex) {
@@ -751,14 +751,14 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Set<Tuple> zRevRangeWithScore(byte[] key, int start, int end) {
public Set<Tuple> zRevRangeWithScore(byte[] key, long start, long end) {
throw new UnsupportedOperationException();
}
@Override
public Integer zRevRank(byte[] key, byte[] value) {
public Long zRevRank(byte[] key, byte[] value) {
try {
return Integer.valueOf((int) jredis.zrevrank(JredisUtils.convert(charset, key), value));
return jredis.zrevrank(JredisUtils.convert(charset, key), value);
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}
@@ -779,12 +779,12 @@ public class JredisConnection implements RedisConnection {
//
@Override
public Integer zUnionStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets) {
public Long zUnionStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets) {
throw new UnsupportedOperationException();
}
@Override
public Integer zUnionStore(byte[] destKey, byte[]... sets) {
public Long zUnionStore(byte[] destKey, byte[]... sets) {
throw new UnsupportedOperationException();
}
@@ -825,7 +825,7 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Integer hIncrBy(byte[] key, byte[] field, int delta) {
public Long hIncrBy(byte[] key, byte[] field, long delta) {
throw new UnsupportedOperationException();
}
@@ -840,9 +840,9 @@ public class JredisConnection implements RedisConnection {
}
@Override
public Integer hLen(byte[] key) {
public Long hLen(byte[] key) {
try {
return Integer.valueOf((int) jredis.hlen(JredisUtils.convert(charset, key)));
return jredis.hlen(JredisUtils.convert(charset, key));
} catch (RedisException ex) {
throw JredisUtils.convertJredisAccessException(ex);
}

View File

@@ -30,7 +30,7 @@ public interface BoundHashOperations<H, HK, HV> extends KeyBound<H> {
boolean hasKey(Object key);
Integer increment(HK key, int delta);
Long increment(HK key, long delta);
HV get(Object key);
@@ -44,7 +44,7 @@ public interface BoundHashOperations<H, HK, HV> extends KeyBound<H> {
Collection<HV> values();
Integer length();
Long size();
void delete(Object key);

View File

@@ -26,23 +26,23 @@ public interface BoundListOperations<K, V> extends KeyBound<K> {
RedisOperations<K, V> getOperations();
List<V> range(int start, int end);
List<V> range(long start, long end);
void trim(int start, int end);
void trim(long start, long end);
Integer length();
Long size();
Integer leftPush(V value);
Long leftPush(V value);
Integer rightPush(V value);
Long rightPush(V value);
V leftPop();
V rightPop();
Integer remove(int i, Object value);
Long remove(long i, Object value);
V index(int index);
V index(long index);
void set(int index, V value);
void set(long index, V value);
}

View File

@@ -41,11 +41,11 @@ public interface BoundSetOperations<K, V> extends KeyBound<K> {
Boolean add(V value);
boolean isMember(Object o);
Boolean isMember(Object o);
Set<V> members();
boolean remove(Object o);
Boolean remove(Object o);
int size();
Long size();
}

View File

@@ -32,6 +32,6 @@ public interface BoundValueOperations<K, V> extends KeyBound<K> {
V getAndSet(V value);
V increment(int delta);
V increment(long delta);
}

View File

@@ -30,27 +30,27 @@ public interface BoundZSetOperations<K, V> extends KeyBound<K> {
void intersectAndStore(K destKey, K... keys);
Set<V> range(int start, int end);
Set<V> range(long start, long end);
Set<V> rangeByScore(double min, double max);
Set<V> reverseRange(int start, int end);
Set<V> reverseRange(long start, long end);
void removeRange(int start, int end);
void removeRange(long start, long end);
void removeRangeByScore(double min, double max);
void unionAndStore(K destKey, K... keys);
boolean add(V value, double score);
Boolean add(V value, double score);
Integer rank(Object o);
Long rank(Object o);
Integer reverseRank(Object o);
Long reverseRank(Object o);
boolean remove(Object o);
Boolean remove(Object o);
int size();
Long size();
Double score(Object o);
}

View File

@@ -65,7 +65,7 @@ class DefaultBoundHashOperations<H, HK, HV> extends DefaultKeyBound<H> implement
}
@Override
public Integer increment(HK key, int delta) {
public Long increment(HK key, long delta) {
return ops.increment(getKey(), key, delta);
}
@@ -75,7 +75,7 @@ class DefaultBoundHashOperations<H, HK, HV> extends DefaultKeyBound<H> implement
}
@Override
public Integer length() {
public Long size() {
return ops.size(getKey());
}

View File

@@ -45,7 +45,7 @@ class DefaultBoundListOperations<K, V> extends DefaultKeyBound<K> implements Bou
}
@Override
public V index(int index) {
public V index(long index) {
return ops.index(getKey(), index);
}
@@ -55,22 +55,22 @@ class DefaultBoundListOperations<K, V> extends DefaultKeyBound<K> implements Bou
}
@Override
public Integer leftPush(V value) {
public Long leftPush(V value) {
return ops.leftPush(getKey(), value);
}
@Override
public Integer length() {
public Long size() {
return ops.size(getKey());
}
@Override
public List<V> range(int start, int end) {
public List<V> range(long start, long end) {
return ops.range(getKey(), start, end);
}
@Override
public Integer remove(int i, Object value) {
public Long remove(long i, Object value) {
return ops.remove(getKey(), i, value);
}
@@ -80,17 +80,17 @@ class DefaultBoundListOperations<K, V> extends DefaultKeyBound<K> implements Bou
}
@Override
public Integer rightPush(V value) {
public Long rightPush(V value) {
return ops.rightPush(getKey(), value);
}
@Override
public void trim(int start, int end) {
public void trim(long start, long end) {
ops.trim(getKey(), start, end);
}
@Override
public void set(int index, V value) {
public void set(long index, V value) {
ops.set(getKey(), index, value);
}
}

View File

@@ -70,7 +70,7 @@ class DefaultBoundSetOperations<K, V> extends DefaultKeyBound<K> implements Boun
}
@Override
public boolean isMember(Object o) {
public Boolean isMember(Object o) {
return ops.isMember(getKey(), o);
}
@@ -80,12 +80,12 @@ class DefaultBoundSetOperations<K, V> extends DefaultKeyBound<K> implements Boun
}
@Override
public boolean remove(Object o) {
public Boolean remove(Object o) {
return ops.remove(getKey(), o);
}
@Override
public int size() {
public Long size() {
return ops.size(getKey());
}

View File

@@ -46,7 +46,7 @@ class DefaultBoundValueOperations<K, V> extends DefaultKeyBound<K> implements Bo
}
@Override
public V increment(int delta) {
public V increment(long delta) {
return ops.increment(getKey(), delta);
}

View File

@@ -39,7 +39,7 @@ class DefaultBoundZSetOperations<K, V> extends DefaultKeyBound<K> implements Bou
}
@Override
public boolean add(V value, double score) {
public Boolean add(V value, double score) {
return ops.add(getKey(), value, score);
}
@@ -54,7 +54,7 @@ class DefaultBoundZSetOperations<K, V> extends DefaultKeyBound<K> implements Bou
}
@Override
public Set<V> range(int start, int end) {
public Set<V> range(long start, long end) {
return ops.range(getKey(), start, end);
}
@@ -64,12 +64,12 @@ class DefaultBoundZSetOperations<K, V> extends DefaultKeyBound<K> implements Bou
}
@Override
public Integer rank(Object o) {
public Long rank(Object o) {
return ops.rank(getKey(), o);
}
@Override
public Integer reverseRank(Object o) {
public Long reverseRank(Object o) {
return ops.reverseRank(getKey(), o);
}
@@ -79,12 +79,12 @@ class DefaultBoundZSetOperations<K, V> extends DefaultKeyBound<K> implements Bou
}
@Override
public boolean remove(Object o) {
public Boolean remove(Object o) {
return ops.remove(getKey(), o);
}
@Override
public void removeRange(int start, int end) {
public void removeRange(long start, long end) {
ops.removeRange(getKey(), start, end);
}
@@ -94,12 +94,12 @@ class DefaultBoundZSetOperations<K, V> extends DefaultKeyBound<K> implements Bou
}
@Override
public Set<V> reverseRange(int start, int end) {
public Set<V> reverseRange(long start, long end) {
return ops.reverseRange(getKey(), start, end);
}
@Override
public int size() {
public Long size() {
return ops.size(getKey());
}

View File

@@ -34,11 +34,11 @@ public interface HashOperations<H, HK, HV> {
Collection<HV> multiGet(H key, Set<HK> hashKeys);
Integer increment(H key, HK hashKey, int delta);
Long increment(H key, HK hashKey, long delta);
Set<HK> keys(H key);
Integer size(H key);
Long size(H key);
void multiSet(H key, Map<? extends HK, ? extends HV> m);

View File

@@ -24,21 +24,21 @@ import java.util.List;
*/
public interface ListOperations<K, V> {
List<V> range(K key, int start, int end);
List<V> range(K key, long start, long end);
void trim(K key, int start, int end);
void trim(K key, long start, long end);
Integer size(K key);
Long size(K key);
Integer leftPush(K key, V value);
Long leftPush(K key, V value);
Integer rightPush(K key, V value);
Long rightPush(K key, V value);
void set(K key, int index, V value);
void set(K key, long index, V value);
Integer remove(K key, int i, Object value);
Long remove(K key, long i, Object value);
V index(K key, int index);
V index(K key, long index);
V leftPop(K key);

View File

@@ -537,12 +537,12 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
}
@Override
public V increment(K key, final int delta) {
public V increment(K key, final long delta) {
final byte[] rawKey = rawKey(key);
// TODO add conversion service in here ?
return (V) execute(new RedisCallback<Integer>() {
return (V) execute(new RedisCallback<Long>() {
@Override
public Integer doInRedis(RedisConnection connection) {
public Long doInRedis(RedisConnection connection) {
if (delta == 1) {
return connection.incr(rawKey);
}
@@ -731,7 +731,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
}
@Override
public V index(K key, final int index) {
public V index(K key, final long index) {
return execute(new ValueDeserializingRedisCallback(key) {
@Override
protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
@@ -751,30 +751,30 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
}
@Override
public Integer leftPush(K key, V value) {
public Long leftPush(K key, V value) {
final byte[] rawKey = rawKey(key);
final byte[] rawValue = rawValue(value);
return execute(new RedisCallback<Integer>() {
return execute(new RedisCallback<Long>() {
@Override
public Integer doInRedis(RedisConnection connection) {
public Long doInRedis(RedisConnection connection) {
return connection.lPush(rawKey, rawValue);
}
}, true);
}
@Override
public Integer size(K key) {
public Long size(K key) {
final byte[] rawKey = rawKey(key);
return execute(new RedisCallback<Integer>() {
return execute(new RedisCallback<Long>() {
@Override
public Integer doInRedis(RedisConnection connection) {
public Long doInRedis(RedisConnection connection) {
return connection.lLen(rawKey);
}
}, true);
}
@Override
public List<V> range(K key, final int start, final int end) {
public List<V> range(K key, final long start, final long end) {
final byte[] rawKey = rawKey(key);
return execute(new RedisCallback<List<V>>() {
@Override
@@ -785,12 +785,12 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
}
@Override
public Integer remove(K key, final int count, Object value) {
public Long remove(K key, final long count, Object value) {
final byte[] rawKey = rawKey(key);
final byte[] rawValue = rawValue(value);
return execute(new RedisCallback<Integer>() {
return execute(new RedisCallback<Long>() {
@Override
public Integer doInRedis(RedisConnection connection) {
public Long doInRedis(RedisConnection connection) {
return connection.lRem(rawKey, count, rawValue);
}
}, true);
@@ -807,19 +807,19 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
}
@Override
public Integer rightPush(K key, V value) {
public Long rightPush(K key, V value) {
final byte[] rawKey = rawKey(key);
final byte[] rawValue = rawValue(value);
return execute(new RedisCallback<Integer>() {
return execute(new RedisCallback<Long>() {
@Override
public Integer doInRedis(RedisConnection connection) {
public Long doInRedis(RedisConnection connection) {
return connection.rPush(rawKey, rawValue);
}
}, true);
}
@Override
public void set(K key, final int index, V value) {
public void set(K key, final long index, V value) {
final byte[] rawValue = rawValue(value);
execute(new ValueDeserializingRedisCallback(key) {
@Override
@@ -831,7 +831,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
}
@Override
public void trim(K key, final int start, final int end) {
public void trim(K key, final long start, final long end) {
execute(new ValueDeserializingRedisCallback(key) {
@Override
protected byte[] inRedis(byte[] rawKey, RedisConnection connection) {
@@ -943,7 +943,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
}
@Override
public boolean isMember(K key, Object o) {
public Boolean isMember(K key, Object o) {
final byte[] rawKey = rawKey(key);
final byte[] rawValue = rawValue(o);
return execute(new RedisCallback<Boolean>() {
@@ -968,7 +968,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
}
@Override
public boolean remove(K key, Object o) {
public Boolean remove(K key, Object o) {
final byte[] rawKey = rawKey(key);
final byte[] rawValue = rawValue(o);
return execute(new RedisCallback<Boolean>() {
@@ -980,11 +980,11 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
}
@Override
public int size(K key) {
public Long size(K key) {
final byte[] rawKey = rawKey(key);
return execute(new RedisCallback<Integer>() {
return execute(new RedisCallback<Long>() {
@Override
public Integer doInRedis(RedisConnection connection) {
public Long doInRedis(RedisConnection connection) {
return connection.sCard(rawKey);
}
}, true);
@@ -1034,7 +1034,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
private class DefaultZSetOperations implements ZSetOperations<K, V> {
@Override
public boolean add(final K key, final V value, final double score) {
public Boolean add(final K key, final V value, final double score) {
final byte[] rawKey = rawKey(key);
final byte[] rawValue = rawValue(value);
@@ -1065,7 +1065,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
}
@Override
public Set<V> range(K key, final int start, final int end) {
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[]>>() {
@@ -1093,33 +1093,33 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
}
@Override
public Integer rank(K key, Object o) {
public Long rank(K key, Object o) {
final byte[] rawKey = rawKey(key);
final byte[] rawValue = rawValue(o);
return execute(new RedisCallback<Integer>() {
return execute(new RedisCallback<Long>() {
@Override
public Integer doInRedis(RedisConnection connection) {
public Long doInRedis(RedisConnection connection) {
return connection.zRank(rawKey, rawValue);
}
}, true);
}
@Override
public Integer reverseRank(K key, Object o) {
public Long reverseRank(K key, Object o) {
final byte[] rawKey = rawKey(key);
final byte[] rawValue = rawValue(o);
return execute(new RedisCallback<Integer>() {
return execute(new RedisCallback<Long>() {
@Override
public Integer doInRedis(RedisConnection connection) {
public Long doInRedis(RedisConnection connection) {
return connection.zRevRank(rawKey, rawValue);
}
}, true);
}
@Override
public boolean remove(K key, Object o) {
public Boolean remove(K key, Object o) {
final byte[] rawKey = rawKey(key);
final byte[] rawValue = rawValue(o);
@@ -1132,7 +1132,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
}
@Override
public void removeRange(K key, final int start, final int end) {
public void removeRange(K key, final long start, final long end) {
final byte[] rawKey = rawKey(key);
execute(new RedisCallback<Object>() {
@Override
@@ -1156,7 +1156,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
}
@Override
public Set<V> reverseRange(K key, final int start, final int end) {
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[]>>() {
@@ -1183,12 +1183,12 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
}
@Override
public int size(K key) {
public Long size(K key) {
final byte[] rawKey = rawKey(key);
return execute(new RedisCallback<Integer>() {
return execute(new RedisCallback<Long>() {
@Override
public Integer doInRedis(RedisConnection connection) {
public Long doInRedis(RedisConnection connection) {
return connection.zCard(rawKey);
}
}, true);
@@ -1259,13 +1259,13 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
}
@Override
public Integer increment(K key, HK hashKey, final int delta) {
public Long increment(K key, HK hashKey, final long delta) {
final byte[] rawKey = rawKey(key);
final byte[] rawHashKey = rawHashKey(hashKey);
return execute(new RedisCallback<Integer>() {
return execute(new RedisCallback<Long>() {
@Override
public Integer doInRedis(RedisConnection connection) {
public Long doInRedis(RedisConnection connection) {
return connection.hIncrBy(rawKey, rawHashKey, delta);
}
}, true);
@@ -1287,12 +1287,12 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
}
@Override
public Integer size(K key) {
public Long size(K key) {
final byte[] rawKey = rawKey(key);
return execute(new RedisCallback<Integer>() {
return execute(new RedisCallback<Long>() {
@Override
public Integer doInRedis(RedisConnection connection) {
public Long doInRedis(RedisConnection connection) {
return connection.hLen(rawKey);
}
}, true);

View File

@@ -41,12 +41,12 @@ public interface SetOperations<K, V> {
Boolean add(K key, V value);
boolean isMember(K key, Object o);
Boolean isMember(K key, Object o);
Set<V> members(K key);
boolean remove(K key, Object o);
Boolean remove(K key, Object o);
int size(K key);
Long size(K key);
}

View File

@@ -43,5 +43,5 @@ public interface ValueOperations<K, V> {
Collection<V> multiGet(Set<K> keys);
V increment(K key, int delta);
V increment(K key, long delta);
}

View File

@@ -27,29 +27,29 @@ public interface ZSetOperations<K, V> {
void intersectAndStore(K key, K destKey, K... keys);
Set<V> range(K key, int start, int end);
Set<V> range(K key, long start, long end);
Set<V> rangeByScore(K key, double min, double max);
Set<V> reverseRange(K key, int start, int end);
Set<V> reverseRange(K key, long start, long end);
void removeRange(K key, int start, int end);
void removeRange(K key, long start, long end);
void removeRangeByScore(K key, double min, double max);
void unionAndStore(K key, K destKey, K... keys);
boolean add(K key, V value, double score);
Boolean add(K key, V value, double score);
Integer rank(K key, Object o);
Long rank(K key, Object o);
Integer reverseRank(K key, Object o);
Long reverseRank(K key, Object o);
Double score(K key, Object o);
boolean remove(K key, Object o);
Boolean remove(K key, Object o);
int size(K key);
Long size(K key);
RedisOperations<K, V> getOperations();
}

View File

@@ -62,7 +62,7 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
}
@Override
public List<E> range(int start, int end) {
public List<E> range(long start, long end) {
return listOps.range(start, end);
}
@@ -83,7 +83,7 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
@Override
public int size() {
return listOps.length();
return listOps.size().intValue();
}
@@ -100,8 +100,8 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
@Override
public boolean remove(Object o) {
Integer result = listOps.remove(0, o);
return (result != null && result.intValue() > 0);
Long result = listOps.remove(0, o);
return (result != null && result.longValue() > 0);
}
@Override

View File

@@ -80,7 +80,7 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
}
@Override
public Integer increment(K key, int delta) {
public Long increment(K key, long delta) {
return hashOps.increment(key, delta);
}
@@ -161,7 +161,7 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
@Override
public int size() {
return hashOps.length();
return hashOps.size().intValue();
}
@Override

View File

@@ -125,7 +125,7 @@ public class DefaultRedisSet<E> extends AbstractRedisCollection<E> implements Re
@Override
public int size() {
return boundSetOps.size();
return boundSetOps.size().intValue();
}
private String[] extractKeys(RedisSet<?>... sets) {

View File

@@ -96,12 +96,12 @@ public class DefaultRedisZSet<E> extends AbstractRedisCollection<E> implements R
}
@Override
public Set<E> range(int start, int end) {
public Set<E> range(long start, long end) {
return boundZSetOps.range(start, end);
}
@Override
public Set<E> reverseRange(int start, int end) {
public Set<E> reverseRange(long start, long end) {
return boundZSetOps.reverseRange(start, end);
}
@@ -111,7 +111,7 @@ public class DefaultRedisZSet<E> extends AbstractRedisCollection<E> implements R
}
@Override
public RedisZSet<E> remove(int start, int end) {
public RedisZSet<E> remove(long start, long end) {
boundZSetOps.removeRange(start, end);
return this;
}
@@ -160,7 +160,7 @@ public class DefaultRedisZSet<E> extends AbstractRedisCollection<E> implements R
@Override
public int size() {
return boundZSetOps.size();
return boundZSetOps.size().intValue();
}
@Override
@@ -185,12 +185,12 @@ public class DefaultRedisZSet<E> extends AbstractRedisCollection<E> implements R
}
@Override
public Integer rank(Object o) {
public Long rank(Object o) {
return boundZSetOps.rank(o);
}
@Override
public Integer reverseRank(Object o) {
public Long reverseRank(Object o) {
return boundZSetOps.reverseRank(o);
}

View File

@@ -26,7 +26,7 @@ import java.util.Queue;
*/
public interface RedisList<E> extends RedisStore<String>, List<E>, Queue<E> {
List<E> range(int start, int end);
List<E> range(long start, long end);
RedisList<E> trim(int start, int end);
}

View File

@@ -25,5 +25,5 @@ import java.util.concurrent.ConcurrentMap;
*/
public interface RedisMap<K, V> extends RedisStore<String>, ConcurrentMap<K, V> {
Integer increment(K key, int delta);
Long increment(K key, long delta);
}

View File

@@ -32,13 +32,13 @@ public interface RedisZSet<E> extends RedisStore<String>, Set<E> {
RedisZSet<E> unionAndStore(String destKey, RedisZSet<E>... sets);
Set<E> range(int start, int end);
Set<E> range(long start, long end);
Set<E> reverseRange(int start, int end);
Set<E> reverseRange(long start, long end);
Set<E> rangeByScore(double min, double max);
RedisZSet<E> remove(int start, int end);
RedisZSet<E> remove(long start, long end);
RedisZSet<E> removeByScore(double min, double max);
@@ -78,7 +78,7 @@ public interface RedisZSet<E> extends RedisStore<String>, Set<E> {
* @param o object
* @return rank of the given object
*/
Integer rank(Object o);
Long rank(Object o);
/**
* Returns the rank (position) of the given element in the set, in descending order.
@@ -87,7 +87,7 @@ public interface RedisZSet<E> extends RedisStore<String>, Set<E> {
* @param o object
* @return reverse rank of the given object
*/
Integer reverseRank(Object o);
Long reverseRank(Object o);
/**
* Returns the default score used by this set.

View File

@@ -23,8 +23,6 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.data.keyvalue.redis.Person;
import org.springframework.data.keyvalue.redis.connection.RedisConnection;
import org.springframework.data.keyvalue.redis.connection.RedisConnectionFactory;
public abstract class AbstractConnectionIntegrationTests {
@@ -46,9 +44,9 @@ public abstract class AbstractConnectionIntegrationTests {
@Test
public void testLPush() throws Exception {
Integer index = connection.lPush(listName.getBytes(), "bar".getBytes());
Long index = connection.lPush(listName.getBytes(), "bar".getBytes());
if (index != null) {
assertEquals((Integer) (index + 1), connection.lPush(listName.getBytes(), "bar".getBytes()));
assertEquals((Long) (index + 1), connection.lPush(listName.getBytes(), "bar".getBytes()));
}
}

View File

@@ -202,7 +202,7 @@ public abstract class AbstractRedisMapTests<K, V> {
V v1 = getValue();
map.put(k1, v1);
Integer value = map.increment(k1, 1);
Long value = map.increment(k1, 1);
System.out.println("Value is " + value);
}

View File

@@ -136,9 +136,9 @@ public abstract class AbstractRedisZSetTest<T> extends AbstractRedisCollectionTe
zSet.add(t2, 4);
zSet.add(t3, 5);
assertEquals(Integer.valueOf(0), zSet.rank(t1));
assertEquals(Integer.valueOf(1), zSet.rank(t2));
assertEquals(Integer.valueOf(2), zSet.rank(t3));
assertEquals(Long.valueOf(0), zSet.rank(t1));
assertEquals(Long.valueOf(1), zSet.rank(t2));
assertEquals(Long.valueOf(2), zSet.rank(t3));
assertNull(zSet.rank(getT()));
}
@@ -152,9 +152,9 @@ public abstract class AbstractRedisZSetTest<T> extends AbstractRedisCollectionTe
zSet.add(t2, 4);
zSet.add(t3, 5);
assertEquals(Integer.valueOf(0), zSet.reverseRank(t3));
assertEquals(Integer.valueOf(1), zSet.reverseRank(t2));
assertEquals(Integer.valueOf(2), zSet.reverseRank(t1));
assertEquals(Long.valueOf(0), zSet.reverseRank(t3));
assertEquals(Long.valueOf(1), zSet.reverseRank(t2));
assertEquals(Long.valueOf(2), zSet.reverseRank(t1));
assertNull(zSet.rank(getT()));
}

View File

@@ -1,5 +1,5 @@
Bundle-SymbolicName: org.springframework.data.redis
Bundle-Name: Spring Datastore Redis Support
Bundle-Name: Spring Data Redis Support
Bundle-Vendor: SpringSource
Bundle-ManifestVersion: 2
Import-Package:
@@ -22,4 +22,5 @@ Import-Template:
org.springframework.transaction.support.*;version="[3.0.0, 4.0.0)",
redis.clients.jedis.*;version="[1.0.0, 2.0.0)",
redis.clients.util.*;version="[1.0.0, 2.0.0)",
org.apache.commons.pool.impl.*;version="[1.0.0, 3.0.0)"