Redis Move 命令

更新时间: 2019-07-07 15:54

Redis Move 命令用于将当前数据库的 key 移动到给定的数据库 db 当中。

语法

redis 127.0.0.1:6379> MOVE KEY_NAME DESTINATION_DATABASE

返回值

  • 移动成功返回 1 ,失败则返回 0 。

实例

实例1: old_db 存在 key,new_db 不存在 key

127.0.0.1:6379> select 0
OK
127.0.0.1:6379> set domain www.codercto.com
OK
127.0.0.1:6379> move domain 1
(integer) 1
127.0.0.1:6379> get domain
(nil)
127.0.0.1:6379> select 1
OK
127.0.0.1:6379[1]> get domain
"www.codercto.com"

实例2: old_db 不存在 key,new_db 不存在 key

127.0.0.1:6379[1]> exists domain
(integer) 0
127.0.0.1:6379[1]> move domain 0
(integer) 0
127.0.0.1:6379[1]> select 0
OK
127.0.0.1:6379> exists domain
(integer) 0

实例3: old_db 存在 key,new_db 存在 key

127.0.0.1:6379> set domain www.codercto.com
OK
127.0.0.1:6379> exists domain
(integer) 1
127.0.0.1:6379> select 1
OK
127.0.0.1:6379[1]> set domain www.codercto.com1
OK
127.0.0.1:6379[1]> exists domain
(integer) 1
127.0.0.1:6379[1]> move domain 0
(integer) 0

查看更多 Redis key 命令

Introduction to Semi-Supervised Learning

Introduction to Semi-Supervised Learning

Xiaojin Zhu、Andrew B. Goldberg / Morgan and Claypool Publishers / 2009-6-29 / USD 40.00

Semi-supervised learning is a learning paradigm concerned with the study of how computers and natural systems such as humans learn in the presence of both labeled and unlabeled data. Traditionally, le......一起来看看 《Introduction to Semi-Supervised Learning》 这本书的介绍吧!

CSS 压缩/解压工具

CSS 压缩/解压工具

在线压缩/解压 CSS 代码

RGB CMYK 转换工具

RGB CMYK 转换工具

RGB CMYK 互转工具

HEX CMYK 转换工具

HEX CMYK 转换工具

HEX CMYK 互转工具