+ add move operation to RedisTemplate
This commit is contained in:
@@ -97,6 +97,8 @@ public interface RedisOperations<K, V> {
|
||||
|
||||
Boolean persist(K key);
|
||||
|
||||
Boolean move(K key, int dbIndex);
|
||||
|
||||
Long getExpire(K key);
|
||||
|
||||
void watch(K keys);
|
||||
|
||||
@@ -562,6 +562,18 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}, 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[]>() {
|
||||
|
||||
Reference in New Issue
Block a user