Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Memory

Internal storage for data, can hold any key/value collection.

Hierarchy

  • Memory

Indexable

[key: string]: any

Index signature allows any key value pair to be added to memory.

Index

Constructors

constructor

Properties

private

private: object

Any misc data added without specifying collection.

Type declaration

  • [key: string]: any

users

users: object

All known users assigned to their ID as key.

Type declaration

  • [id: string]: User

Methods

clear

  • clear(): void
  • Empty memory and start fresh with minimal empty collections.

    Returns void

clearSaveInterval

  • clearSaveInterval(): void

get

  • get(key: string, collection?: string): any
  • Retrieve value from memory by key within given (or default) collection.

    Parameters

    • key: string
    • Default value collection: string = "private"

    Returns any

load

  • load(): Promise<void>
  • Update internal memory with any data set (mostly used on load)

    Returns Promise<void>

save

  • save(): Promise<void>
  • Save internal memory back to storage adapter (as memory type).

    Returns Promise<void>

set

  • set(key: string, value: any, collection?: string): "/Volumes/x/code/amazebot/bbot/src/index"
  • Save key-value pair under the collection namespace, extend existing data. Set is used for temporal in-memory data for common interactions. For large data sets that will be infrequently accessed, use keep instead.

    Parameters

    • key: string
    • value: any
    • Default value collection: string = "private"

    Returns "/Volumes/x/code/amazebot/bbot/src/index"

setSaveInterval

  • setSaveInterval(newInterval?: undefined | number): void
  • Save memory every x milliseconds

    Parameters

    • Optional newInterval: undefined | number

    Returns void

shutdown

  • shutdown(): Promise<void>
  • Save data and disconnect storage adapter

    Returns Promise<void>

start

  • start(): Promise<void>
  • Populate brian with temporal data from storage adapter and get started

    Returns Promise<void>

toObject

  • toObject(): any
  • Convert memory to an object with collection attributes.

    Returns any

unset

  • unset(key: string, collection?: string): "/Volumes/x/code/amazebot/bbot/src/index"
  • Remove item from memory by key and collection namespace (optional).

    Parameters

    • key: string
    • Default value collection: string = "private"

    Returns "/Volumes/x/code/amazebot/bbot/src/index"

Generated using TypeDoc