SWAPDB

SWAPDB

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

This command swaps two Redict databases, so that immediately all the clients connected to a given database will see the data of the other database, and the other way around. Example:

SWAPDB 0 1

This will swap database 0 with database 1. All the clients connected with database 0 will immediately see the new data, exactly like all the clients connected with database 1 will see the data that was formerly of database 0.

Examples #

SWAPDB 0 1

Redict logo courtesy of @janWilejan, CC-BY-SA-4.0. Download SVG ⤑

Portions of this website courtesy of Salvatore Sanfilippo, CC-BY-SA-4.0.