Class: KeyValueStore

KeyValueStore

new KeyValueStore(nameopt)

The key value store class used when storing basic in-memory KV data, and can be queried for quick retrieval. Mostly used for collection primary key indexes and lookups.
Parameters:
Name Type Attributes Description
name String <optional>
Optional KV store name.
Source:

Methods

get(key) → {*}

Gets data stored for the passed key.
Parameters:
Name Type Description
key String The key to get data for.
Source:
Returns:
Type
*

lookup(obj) → {*}

Get / set the primary key.
Parameters:
Name Type Description
obj * A lookup query, can be a string key, an array of string keys, an object with further query clauses or a regular expression that should be run against all keys.
Source:
Returns:
Type
*

primaryKey(key) → {*}

Get / set the primary key.
Parameters:
Name Type Description
key String The key to set.
Source:
Returns:
Type
*

set(key, value) → {*}

Sets data against a key in the store.
Parameters:
Name Type Description
key String The key to set data for.
value * The value to assign to the key.
Source:
Returns:
Type
*

truncate() → {*}

Removes all data from the store.
Source:
Returns:
Type
*

uniqueSet(key, value) → {Boolean}

Sets data for the give key in the store only where the given key does not already have a value in the store.
Parameters:
Name Type Description
key String The key to set data for.
value * The value to assign to the key.
Source:
Returns:
True if data was set or false if data already exists for the key.
Type
Boolean

unSet(key) → {*}

Removes data for the given key from the store.
Parameters:
Name Type Description
key String The key to un-set.
Source:
Returns:
Type
*