+ change increment return type from V to Long (since we cannot guarantee transformation at this point)
This commit is contained in:
@@ -32,6 +32,6 @@ public interface BoundValueOperations<K, V> extends KeyBound<K> {
|
||||
|
||||
V getAndSet(V value);
|
||||
|
||||
V increment(long delta);
|
||||
Long increment(long delta);
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class DefaultBoundValueOperations<K, V> extends DefaultKeyBound<K> implements Bo
|
||||
}
|
||||
|
||||
@Override
|
||||
public V increment(long delta) {
|
||||
public Long increment(long delta) {
|
||||
return ops.increment(getKey(), delta);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.keyvalue.redis.connection.DataType;
|
||||
import org.springframework.data.keyvalue.redis.connection.RedisConnection;
|
||||
@@ -562,11 +561,10 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}
|
||||
|
||||
@Override
|
||||
public V increment(K key, final long delta) {
|
||||
public Long increment(K key, final long delta) {
|
||||
final byte[] rawKey = rawKey(key);
|
||||
// TODO add conversion service in here ?
|
||||
ConversionService cs;
|
||||
return (V) execute(new RedisCallback<Long>() {
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
if (delta == 1) {
|
||||
|
||||
@@ -42,5 +42,5 @@ public interface ValueOperations<K, V> {
|
||||
|
||||
Collection<V> multiGet(Collection<K> keys);
|
||||
|
||||
V increment(K key, long delta);
|
||||
Long increment(K key, long delta);
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ public class RedisAtomicInteger extends Number implements Serializable {
|
||||
* @return the updated value
|
||||
*/
|
||||
public int incrementAndGet() {
|
||||
return operations.increment(key, 1);
|
||||
return operations.increment(key, 1).intValue();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,7 +174,7 @@ public class RedisAtomicInteger extends Number implements Serializable {
|
||||
* @return the updated value
|
||||
*/
|
||||
public int decrementAndGet() {
|
||||
return operations.increment(key, -1);
|
||||
return operations.increment(key, -1).intValue();
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ public class RedisAtomicInteger extends Number implements Serializable {
|
||||
* @return the updated value
|
||||
*/
|
||||
public int addAndGet(int delta) {
|
||||
return operations.increment(key, delta);
|
||||
return operations.increment(key, delta).intValue();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user