Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

  • T

Hierarchy

  • _BaseCache

Index

Properties

Static Readonly default

default: typeof _BaseCache = _BaseCache

Optional boundGuild

boundGuild?: string

guild id bound to this cache

boundObject

boundObject: null | Partial<T> = null

dataTimestamp

dataTimestamp: null | Date = null

namespace

namespace: string = "base"

rain

rain: RainCache<any, any>

storageEngine

storageEngine: null | BaseStorageEngine<T> = null

Methods

addToIndex

  • addToIndex(id: string, objectId?: string): Promise<void>
  • Add ids to the index of a namespace

    Parameters

    • id: string

      ids to add

    • objectId: string = ...

      id of the parent object of the index

    Returns Promise<void>

bindGuild

  • Bind a guild id to the cache

    Parameters

    • guildId: string

      id of the guild that should be bound to this cache

    Returns _BaseCache<T>

bindObject

  • bindObject(boundObject: Partial<T>): void
  • Bind an object to the cache instance, you can read more on binding on the landing page of the documentation

    Parameters

    • boundObject: Partial<T>

      Object to bind to this cache instance

    Returns void

buildId

  • buildId(id: string): string
  • Build an id consisting of $namespace.$id

    Parameters

    • id: string

      id to append to namespace

    Returns string

    constructed id

getIndexCount

  • getIndexCount(objectId?: string): Promise<number>
  • Get the number of elements that are within an index

    Parameters

    • objectId: string = ...

      id of the parent object of the index

    Returns Promise<number>

getIndexMembers

  • getIndexMembers(objectId?: string): Promise<string[]>
  • Get all members from an index

    Parameters

    • objectId: string = ...

      id of the parent object of the index

    Returns Promise<string[]>

isIndexed

  • isIndexed(id: string, objectId?: string): Promise<boolean>
  • Check if an id is a member of an index

    Parameters

    • id: string

      id to check

    • objectId: string = ...

      id of the parent object of the index

    Returns Promise<boolean>

    returns true if it is a part of the index, false otherwise

removeFromIndex

  • removeFromIndex(id: string, objectId?: string): Promise<void>
  • Remove an id from the index

    Parameters

    • id: string

      id to be removed

    • objectId: string = ...

      id of the parent object of the index

    Returns Promise<void>

removeIndex

  • removeIndex(objectId?: string): Promise<void>
  • Delete an index

    Parameters

    • objectId: string = ...

      id of the parent object of the index

    Returns Promise<void>

structurize

  • structurize<D>(data: Partial<D>): Partial<D>
  • Delete keys from data if necessary based on RainCache structureDefs options and return the cleaned data

    Type parameters

    • D

    Parameters

    • data: Partial<D>

      The data to possibly delete object entries from

    Returns Partial<D>

Constructors

constructor

  • Base class for all cache classes.

    You should not create BaseCache by itself, but instead create a class that extends from it.

    All Methods from BaseCache are also available on every class that is extending it.

    Type parameters

    • T

    Parameters

    Returns _BaseCache<T>

Generated using TypeDoc