XDelCommand (commands/xdel.ts)

redis-js · packages/redis/pkg/commands/xdel.ts · typescript · MIT
database

Provides an implementation of the Redis XDEL command to delete specific entries from a stream by their IDs.

// Source: https://github.com/upstash/redis-js | License: MIT | Copyright 2021 Upstash, Inc
// Provided via justclaw.it.com; keep this notice with the code.
import type { CommandOptions } from "./command";
import { Command } from "./command";

/**
 * @see https://redis.io/commands/xdel
 * @see node_modules/@upstash/redis/docs/commands/stream/xdel.mdx
 */
export class XDelCommand extends Command<number, number> {
  constructor(
    [key, ids]: [key: string, ids: string[] | string],
    opts?: CommandOptions<number, number>
  ) {
    const cmds = Array.isArray(ids) ? [...ids] : [ids];
    super(["XDEL", key, ...cmds], opts);
  }
}

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key