Interface RedisConnection

Interface representing a Redis connection with various methods for interacting with Redis. RedisConnection

interface RedisConnection {
    del: (key: string) => number;
    execute: (command: string, args: RedisParameter[]) => RedisResult[];
    get: (key: string) => undefined | Uint8Array;
    incr: (key: string) => bigint;
    publish: (channel: string, payload: Uint8Array) => void;
    sadd: (key: string, value: string[]) => number;
    set: (key: string, value: Uint8Array) => void;
    smembers: (key: string) => string[];
    srem: (key: string, value: string[]) => number;
}

Properties

del: (key: string) => number

Deletes the given key.

Type declaration

    • (key: string): number
    • Parameters

      • key: string

        The key to delete.

      Returns number

execute: (command: string, args: RedisParameter[]) => RedisResult[]

Execute an arbitrary Redis command and receive the result.

Type declaration

get: (key: string) => undefined | Uint8Array

Get a value for the given key. Returns null if the key does not exist.

Type declaration

    • (key: string): undefined | Uint8Array
    • Parameters

      • key: string

        The key to retrieve the value for.

      Returns undefined | Uint8Array

incr: (key: string) => bigint

Increment the value of a key.

Type declaration

    • (key: string): bigint
    • Parameters

      • key: string

        The key to increment.

      Returns bigint

publish: (channel: string, payload: Uint8Array) => void

Publish a Redis message to the specified channel.

Type declaration

    • (channel: string, payload: Uint8Array): void
    • Parameters

      • channel: string

        The channel to publish the message to.

      • payload: Uint8Array

        The message payload.

      Returns void

sadd: (key: string, value: string[]) => number

Adds a value to a set.

Type declaration

    • (key: string, value: string[]): number
    • Parameters

      • key: string

        The key of the set.

      • value: string[]

        The values to add to the set.

      Returns number

set: (key: string, value: Uint8Array) => void

Set a value for the given key.

Type declaration

    • (key: string, value: Uint8Array): void
    • Parameters

      • key: string

        The key to set the value for.

      • value: Uint8Array

        The value to set.

      Returns void

smembers: (key: string) => string[]

Retrieves the members of a set.

Type declaration

    • (key: string): string[]
    • Parameters

      • key: string

        The key of the set.

      Returns string[]

srem: (key: string, value: string[]) => number

Removes values from a set.

Type declaration

    • (key: string, value: string[]): number
    • Parameters

      • key: string

        The key of the set.

      • value: string[]

        The values to remove from the set.

      Returns number