A DataProvider implemented with a Redis backend.

Hierarchy

  • DataProvider
    • RedisDataProvider

Implements

  • ClearableDataProvider

Constructors

  • Parameters

    • client: ExtendedClient

      The client that this data provider will be used by.

    • options: RedisClientOptions<any, any, RedisScripts>

      The options passed to the Redis client.

    Returns RedisDataProvider

Properties

client: ExtendedClient

The client that this data provider will be used by.

Memberof

DataProvider

redis: RedisClientType<any, any, RedisScripts>

The Redis client for this data provider.

Memberof

RedisDataProvider

Methods

  • Private

    Clear all data that start with the given pattern.

    Parameters

    • startsWith: string

      The pattern to look for the keys to delete.

    Returns Promise<void>

    A promise that resolves once all data has been deleted.

  • Private

    Delete a value stored for a given absolute key.

    Type Parameters

    • T = any

    Parameters

    • key: string

      The key of the data to be set.

    Returns Promise<undefined | T>

    A promise that resolves once the data has been deleted.

  • Private

    Get a value for a given absolute key.

    Type Parameters

    • T = any

    Parameters

    • key: string

      The key of the data to be queried.

    Returns Promise<undefined | T>

    A promise that resolves the queried data.

  • Private

    Get a value for a given absolute key.

    Type Parameters

    • T = any

    Parameters

    • key: string

      The key of the data to be queried.

    • defaultValue: T

      The default value in case there is no entry found.

    Returns Promise<T>

    A promise that resolves the queried data.

  • Private

    Set a value for an absolute key.

    Type Parameters

    • T = any

    Parameters

    • key: string

      The key of the data to be set.

    • value: T

      The value to set.

    Returns Promise<void>

    A promise that resolves once the data is saved.

  • Clear all data in a guild.

    Parameters

    • guild: Guild

      The guild to clear the data from.

    Returns Promise<void>

    A promise that resolves once all data has been deleted.

    Emits

    client#dataProviderClear

  • Clear all data in a global scope.

    Returns Promise<void>

    A promise that resolves once all data has been deleted.

    Emits

    client#dataProviderClear

  • Delete a key-value pair in a guild.

    Type Parameters

    • T = any

    Parameters

    • guild: Guild

      The guild for which the key-value pair will be deleted.

    • key: string

      The key to delete.

    Returns Promise<undefined | T>

    A promise that resolves the data that has been deleted.

  • Delete a key-value pair in a global scope.

    Type Parameters

    • T = any

    Parameters

    • key: string

      The key to delete.

    Returns Promise<undefined | T>

    A promise that resolves the data that has been deleted.

  • Gracefully destroy this Redis data provider. This closes the connection to the Redis service after queued up operations have ended.

    Returns Promise<void>

    Emits

    client#dataProviderDestroy

  • Get a value for a key in a guild.

    Type Parameters

    • T = any

    Parameters

    • guild: Guild

      The guild for which the data will be queried.

    • key: string

      The key of the data to be queried.

    Returns Promise<undefined | T>

    A promise that resolves the queried data.

  • Get a value for a key in a guild.

    Type Parameters

    • T = any

    Parameters

    • guild: Guild

      The guild for which the data will be queried.

    • key: string

      The key of the data to be queried.

    • defaultValue: T

      The default value in case there is no entry found.

    Returns Promise<T>

    A promise that resolves the queried data.

  • Get a value for a key in a global scope.

    Type Parameters

    • T = any

    Parameters

    • key: string

      The key of the data to be queried.

    Returns Promise<undefined | T>

    A promise that resolves the queried data.

  • Get a value for a key in a global scope.

    Type Parameters

    • T = any

    Parameters

    • key: string

      The key of the data to be queried.

    • defaultValue: T

      The default value in case there is no entry found.

    Returns Promise<T>

    A promise that resolves the queried data.

  • Initialize this Redis data provider. This connects the data provider to the Redis service. It also delegates the Redis client error handling to the client's error event handler.

    Returns Promise<RedisDataProvider>

    A promise that resolves this Redis data provider once it's ready.

    Emits

    client#dataProviderInit

  • Private

    Resolve the key for the provided guild or for the global scope if not provided.

    Parameters

    • key: string

      The key to resolve.

    • Optional guild: Guild

      The guild for which the key will be resolved.

    Returns string

    The resolved key.

  • Set a value for a key in a guild.

    Type Parameters

    • T = any

    Parameters

    • guild: Guild

      The guild for which the data will be set.

    • key: string

      The key of the data to be set.

    • value: T

      The value to set.

    Returns Promise<void>

    A promise that resolves once the data is saved.

  • Set a value for a key in a global scope.

    Type Parameters

    • T = any

    Parameters

    • key: string

      The key of the data to be set.

    • value: T

      The value to set.

    Returns Promise<void>

    A promise that resolves once the data is saved.

Generated using TypeDoc