SWAPDB

Syntax
SWAPDB index1 index2
Available since:
4.0.0
Time complexity:
O(N) where N is the count of clients watching or blocking on keys from both databases.
ACL categories:
@keyspace, @write, @fast, @dangerous,

此命令交换两个Redis数据库,使得所有连接到给定数据库的客户端立即看到另一个数据库的数据,反之亦然。示例:

SWAPDB 0 1

这将交换数据库0和数据库1。所有连接到数据库0的客户端将立即看到新数据,就像所有连接到数据库1的客户端将看到以前属于数据库0的数据一样。

示例

SWAPDB 0 1

RESP2/RESP3 回复

Simple string reply: OK.
RATE THIS PAGE
Back to top ↑