import type { CommandOptions } from "./command"; import { Command } from "./command"; /** * @see https://redis.io/commands/copy */ export class CopyCommand extends Command { constructor( [key, destinationKey, opts]: [key: string, destinationKey: string, opts?: { replace: boolean }], commandOptions?: CommandOptions ) { super(["COPY", key, destinationKey, ...(opts?.replace ? ["REPLACE"] : [])], { ...commandOptions, deserialize(result) { if (result > 0) { return "COPIED"; } return "NOT_COPIED"; }, }); } }