COPY

Since 1.1.0Keys

Syntax

COPY source destination [DB destination-db] [REPLACE]
  • Flags: write
  • ACL categories: @generic, @keyspace, @slow, @write
  • Arity: -3

Copies the value at source to destination, with its expiry. source is left as it is.

Options

OptionEffect
DB destination-dbCopy into another database.
REPLACEReplace destination if it exists.

Reply

  • 1 if the value was copied.
  • 0 if source does not exist, or destination exists and REPLACE was not given.

Examples

> SET src v EX 100
OK
> COPY src dst
(integer) 1
> TTL dst
(integer) 100
> COPY src dst
(integer) 0
> COPY src dst REPLACE
(integer) 1
> COPY src other DB 1
(integer) 1