A Bucket holding number values

The values being numbers allows them to be sorted easily giving you access to incr and sortedList.

{@see } Bucket for more info on buckets.

Hierarchy (view full)

Properties

name: string
pluginId: null | string

Methods

  • Counts the number of entries in a bucket (optionally filtering by pattern).

    Parameters

    • Optional keyPattern: string

      Optional key pattern to filter by

      • %: A percent sign (%) matches any sequence of zero or more characters.
      • _: An underscore (_) matches any single character.

      To match _ and % as literals escape them with backslash (\_ and \%).

    Returns Promise<number>

    Number of entries

  • Deletes an entry from the bucket permanently.

    Parameters

    • key: string

      The key to delete

    Returns Promise<undefined | Entry<number>>

    The deleted entry, or undefined if none

  • Deletes all entries (optionally filtering by pattern) permanently.

    Parameters

    • Optional keyPattern: string

      Optional key pattern to filter by

      • %: A percent sign (%) matches any sequence of zero or more characters.
      • _: An underscore (_) matches any single character.

      To match _ and % as literals escape them with backslash (\_ and \%).

    Returns Promise<number>

    Number of deleted entries

  • Fetches a entry from the bucket.

    Parameters

    • key: string

      The key for the value you want returned

    Returns Promise<undefined | Entry<number>>

    The entry, or undefined if it did not exist

  • Atomically increments the value stored at key. If the entry did not exist beforehand a new one is created and set to amount

    Parameters

    • key: string

      The key whose value to increment

    • amount: number

      The amount to increment the value by

    Returns Promise<Entry<number>>

    The entry after incrementing the value

  • Retrieve a list of entries from the database, you can use after to paginate through all the items in the bucket.

    Parameters

    Returns Promise<Entry<number>[]>

    A list of entries

  • Store a value at the provided key in the bucket, this will overwrite the previous value stored there, if any.

    Parameters

    • key: string

      The key that you're storing the value in

    • value: number

      The value you're storing, for objects this will be converted to json behind the scenes

    • Optional options: SetValueOptions

      Optional options

    Returns Promise<Entry<number>>

    The storage entry

  • Similar to set but stores the value conditionally.

    Parameters

    • key: string

      The key where you're storing the value

    • value: number

      The value you're storing, for objects this will be converted to json behind the scenes

    • cond: "IfExists" | "IfNotExists"

      The condition that has to pass to store the value.

      • IfExists: will only store the value if the key existed beforehand.
      • IfNotExists: will only store the value if the key did not exist.
    • Optional options: SetValueOptions

      Optional options

    Returns Promise<undefined | Entry<number>>

    Either the new entry, or undefined if the condition failed.

  • Returns a list of entries in the bucket sorted by values

    Parameters

    • order: "Ascending" | "Descending"

      The order of which you want the entries in the bucket sorted by

    • Optional options: SortedListOptions

      Pagination options

    Returns Promise<Entry<number>[]>

Generated using TypeDoc