Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_57962205
redisson
提交
3b9ddc6e
R
redisson
项目概览
weixin_57962205
/
redisson
与 Fork 源项目一致
从无法访问的项目Fork
通知
10
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redisson
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
3b9ddc6e
编写于
2月 21, 2020
作者:
N
Nikita Koksharov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Feature - add SWAPDB command support #2606
上级
4eb63c8c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
86 addition
and
18 deletion
+86
-18
redisson/src/main/java/org/redisson/RedissonKeys.java
redisson/src/main/java/org/redisson/RedissonKeys.java
+9
-0
redisson/src/main/java/org/redisson/api/RKeys.java
redisson/src/main/java/org/redisson/api/RKeys.java
+5
-0
redisson/src/main/java/org/redisson/api/RKeysAsync.java
redisson/src/main/java/org/redisson/api/RKeysAsync.java
+11
-0
redisson/src/main/java/org/redisson/api/RKeysReactive.java
redisson/src/main/java/org/redisson/api/RKeysReactive.java
+31
-18
redisson/src/main/java/org/redisson/api/RKeysRx.java
redisson/src/main/java/org/redisson/api/RKeysRx.java
+29
-0
redisson/src/main/java/org/redisson/client/protocol/RedisCommands.java
...main/java/org/redisson/client/protocol/RedisCommands.java
+1
-0
未找到文件。
redisson/src/main/java/org/redisson/RedissonKeys.java
浏览文件 @
3b9ddc6e
...
...
@@ -519,4 +519,13 @@ public class RedissonKeys implements RKeys {
return
toStream
(
getKeys
(
count
).
iterator
());
}
@Override
public
void
swapdb
(
int
db1
,
int
db2
)
{
commandExecutor
.
get
(
swapdbAsync
(
db1
,
db2
));
}
@Override
public
RFuture
<
Void
>
swapdbAsync
(
int
db1
,
int
db2
)
{
return
commandExecutor
.
writeAsync
(
null
,
RedisCommands
.
SWAPDB
,
db1
,
db2
);
}
}
redisson/src/main/java/org/redisson/api/RKeys.java
浏览文件 @
3b9ddc6e
...
...
@@ -311,6 +311,11 @@ public interface RKeys extends RKeysAsync {
*/
long
count
();
/**
* Swap two databases.
*/
void
swapdb
(
int
db1
,
int
db2
);
/**
* Delete all keys of currently selected database
*/
...
...
redisson/src/main/java/org/redisson/api/RKeysAsync.java
浏览文件 @
3b9ddc6e
...
...
@@ -206,14 +206,25 @@ public interface RKeysAsync {
*/
RFuture
<
Long
>
countAsync
();
/**
* Swap two databases.
* <p>
* Requires Redis 4.0+
*
* @return void
*/
RFuture
<
Void
>
swapdbAsync
(
int
db1
,
int
db2
);
/**
* Delete all keys of currently selected database
*
* @return void
*/
RFuture
<
Void
>
flushdbAsync
();
/**
* Delete all keys of all existing databases
*
* @return void
*/
RFuture
<
Void
>
flushallAsync
();
...
...
redisson/src/main/java/org/redisson/api/RKeysReactive.java
浏览文件 @
3b9ddc6e
...
...
@@ -15,12 +15,11 @@
*/
package
org.redisson.api
;
import
java.util.Collection
;
import
java.util.concurrent.TimeUnit
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
java.util.concurrent.TimeUnit
;
/**
*
* @author Nikita Koksharov
...
...
@@ -207,21 +206,6 @@ public interface RKeysReactive {
*/
Mono
<
Integer
>
getSlot
(
String
key
);
/**
* Find keys by key search pattern by one Redis call.
*
* Uses <code>KEYS</code> Redis command.
*
* Supported glob-style patterns:
* h?llo subscribes to hello, hallo and hxllo
* h*llo subscribes to hllo and heeeello
* h[ae]llo subscribes to hello and hallo, but not hillo
*
* @param pattern - match pattern
* @return collection of keys
*/
Mono
<
Collection
<
String
>>
findKeysByPattern
(
String
pattern
);
/**
* Get random key
*
...
...
@@ -283,6 +267,15 @@ public interface RKeysReactive {
*/
Mono
<
Void
>
flushdb
();
/**
* Swap two databases.
* <p>
* Requires Redis 4.0+
*
* @return void
*/
Mono
<
Void
>
swapdb
(
int
db1
,
int
db2
);
/**
* Delete all the keys of all the existing databases
*
...
...
@@ -292,4 +285,24 @@ public interface RKeysReactive {
*/
Mono
<
Void
>
flushall
();
/**
* Delete all keys of currently selected database
* in background without blocking server.
* <p>
* Requires Redis 4.0+
*
* @return void
*/
Mono
<
Void
>
flushdbParallel
();
/**
* Delete all keys of all existing databases
* in background without blocking server.
* <p>
* Requires Redis 4.0+
*
* @return void
*/
Mono
<
Void
>
flushallParallel
();
}
redisson/src/main/java/org/redisson/api/RKeysRx.java
浏览文件 @
3b9ddc6e
...
...
@@ -269,6 +269,15 @@ public interface RKeysRx {
*/
Completable
flushdb
();
/**
* Swap two databases.
* <p>
* Requires Redis 4.0+
*
* @return void
*/
Completable
swapdb
(
int
db1
,
int
db2
);
/**
* Delete all the keys of all the existing databases
*
...
...
@@ -278,4 +287,24 @@ public interface RKeysRx {
*/
Completable
flushall
();
/**
* Delete all keys of currently selected database
* in background without blocking server.
* <p>
* Requires Redis 4.0+
*
* @return void
*/
Completable
flushdbParallel
();
/**
* Delete all keys of all existing databases
* in background without blocking server.
* <p>
* Requires Redis 4.0+
*
* @return void
*/
Completable
flushallParallel
();
}
redisson/src/main/java/org/redisson/client/protocol/RedisCommands.java
浏览文件 @
3b9ddc6e
...
...
@@ -275,6 +275,7 @@ public interface RedisCommands {
RedisStrictCommand
<
Void
>
CLIENT_SETNAME
=
new
RedisStrictCommand
<
Void
>(
"CLIENT"
,
"SETNAME"
,
new
VoidReplayConvertor
());
RedisStrictCommand
<
String
>
CLIENT_GETNAME
=
new
RedisStrictCommand
<
String
>(
"CLIENT"
,
"GETNAME"
,
new
StringDataDecoder
());
RedisStrictCommand
<
Void
>
FLUSHDB
=
new
RedisStrictCommand
<
Void
>(
"FLUSHDB"
,
new
VoidReplayConvertor
());
RedisStrictCommand
<
Void
>
SWAPDB
=
new
RedisStrictCommand
<
Void
>(
"SWAPDB"
,
new
VoidReplayConvertor
());
RedisStrictCommand
<
Void
>
FLUSHALL
=
new
RedisStrictCommand
<
Void
>(
"FLUSHALL"
,
new
VoidReplayConvertor
());
RedisStrictCommand
<
Void
>
SAVE
=
new
RedisStrictCommand
<
Void
>(
"SAVE"
,
new
VoidReplayConvertor
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录