+ add select() to RedisOperations
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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[]>() {
|
||||
|
||||
Reference in New Issue
Block a user