COPY

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

Copy data.

Usage is copy key1 key2 [type].
📍 type is one of string/list/set/zset/hash/stream.
      type was added from ent811. Please use it.

Example

Command>set key1 value
Result>OK
Command>copy key1 key2 string
Result>1
Command>get key1
Result>value1
Command>get key2
Result>value2
  • You can specify a db. copy key1 key2 db 2
  • To copy even if the destination key exists, use the REPLACE option.
    copy key1 key2 replace

Syntax

COPY source destination [DB destination-db] [REPLACE] [type]

  • Available since version 6.2.0.
  • Time complexity is O(1) for String. For collection data types it is O(N) by the number of elements.
  • ent811 type added.
Related commands MOVE

<< RANDOMKEY COPY MOVE >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.