+ add select() to RedisOperations

This commit is contained in:
Costin Leau
2011-03-17 20:33:24 +02:00
parent 29f58db6be
commit b62abeec50
2 changed files with 14 additions and 0 deletions

View File

@@ -87,6 +87,8 @@ public interface RedisOperations<K, V> {
K randomKey();
void select(int dbIndex);
void rename(K oldKey, K newKey);
Boolean renameIfAbsent(K oldKey, K newKey);

View File

@@ -574,6 +574,18 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
}, true);
}
@Override
public void select(final int dbIndex) {
execute(new RedisCallback<Object>() {
@Override
public Object doInRedis(RedisConnection connection) {
connection.select(dbIndex);
return null;
}
}, true);
}
@Override
public K randomKey() {
byte[] rawKey = execute(new RedisCallback<byte[]>() {