+ add move operation to RedisTemplate

This commit is contained in:
Costin Leau
2011-03-17 19:46:03 +02:00
parent 5f2875fda6
commit 29f58db6be
2 changed files with 14 additions and 0 deletions

View File

@@ -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);

View File

@@ -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[]>() {