module Redis::Commands::Keys

def copy(source, destination, db: nil, replace: false)

Returns:
  • (Boolean) - whether the key was copied or not

Parameters:
  • replace (Boolean) -- removes the `destination` key before copying value to it
  • db (Integer) --
  • destination (String) --
  • source (String) --

Other tags:
    Example: Copy a value to a key in another database -
    Example: Copy a value to another key -
def copy(source, destination, db: nil, replace: false)
  command = [:copy, source, destination]
  command << "DB" << db if db
  command << "REPLACE" if replace
  send_command(command, &Boolify)
end