Skip to content

Abstract Class: CachedManager<K, V>

Abstract manager for handling cached data structures

Type Parameters

K

K

V

V

Constructors

Constructor

new CachedManager<K, V>(client, holds, iterable?): CachedManager<K, V>

Parameters

client

Client

The client that instantiated this manager

holds

(...args) => V

The data structure this manager holds

iterable?

Iterable<V, any, any>

An iterable of items to cache

Returns

CachedManager<K, V>

Overrides

DataManager<K, V>.constructor

Properties

holds()

readonly holds: (...args) => V

Parameters

args

...any[]

Returns

V

Inherited from

DataManager.holds

Accessors

cache

Get Signature

get cache(): Map<K, V>

The cache of items for this manager

Returns

Map<K, V>

Overrides

DataManager.cache

Methods

_add()

protected _add(data, cache?, options?): V

Adds an item to the cache

Parameters

data

any

The data to add

cache?

boolean = true

Whether to cache the item

options?

Additional options

extras?

any[] = []

Extra parameters for the constructor

id?

K

The ID of the item

Returns

V

The cached item


resolve()

resolve(idOrInstance): null | V

Resolves a data entry to a data Object.

Parameters

idOrInstance

K | V

Returns

null | V

Inherited from

DataManager.resolve


resolveId()

resolveId(idOrInstance): null | K

Resolves a data entry to an instance id.

Parameters

idOrInstance

K | V

Returns

null | K

Inherited from

DataManager.resolveId


valueOf()

valueOf(): Map<K, V>

Returns the primitive value of the specified object.

Returns

Map<K, V>

Inherited from

DataManager.valueOf