DataStore

Extends Collection

Base class that manages the creation, retrieval and deletion of a specific data model.

To create a new DataStore, initialise the class like below.

const DS = new QDB.DataStore(Iterable?);

Take a look at the extended Collection class.

Properties

.LRR

Last Recently Resolved - Caches the last data model that got resolved.
Type - DataModel | Null

Methods

.set(Key, Val)

Extended

Main interaction point of the DataStore. Extended method to integrate DataStore enhancements.

Parameter Type Description
Key String | Number The key of this entry to the DataStore.
Model DataModel The model to be set as this key.

Returns - DataStore
Returns the DataStore itself with the new model.

.delete(Key)

Extended

Deletes a model from the DataStore. Extended to update the cached LRR if needed.

Parameter Type Description
Key String | Number The key of this entry to the DataStore.

Returns - DataStore
Returns the updated DataStore.

.resolve(Key)

Main interaction point of the DataStore. Essentially a Col.get(Key);, but integrates caching and should rather be used due to optimisation purposes in the DataStore.

Parameter Type Description
Key String | Number Key of the model to be resolved and cached.

Returns - DataModel
Returns the resolved or cached model.