修改本页

Redis 命令 客户端 文档 社区 下载 问题 支持 许可

RENAME key newkey

相关命令

始于1.0.0可用。

时间复杂度: O(1)

Renames key to newkey. It returns an error when the source and destination names are the same, or when key does not exist. If newkey already exists it is overwritten, when this happens RENAME executes an implicit DEL operation, so if the deleted key contains a very big value it may cause high latency even if RENAME itself is usually a constant-time operation.

返回值

Simple string reply

例子

redis> SET mykey "Hello"

  1. OK

redis> RENAME mykey myotherkey

  1. OK

redis> GET myotherkey

  1. "Hello"
redis>

Comments powered by Disqus

This website is open source software developed by Citrusbyte.

The Redis logo was designed by Carlos Prioglio. See more credits.

Sponsored by Redis Support