Class: MemoryStore

store/memory~ MemoryStore

MemoryStore

new MemoryStore(name)

Constructor for store objects that use a sorted array as the underlying mechanism.
Parameters:
Name Type Description
name String Store name.
Source:

Members

mechanism

Identifies the underlying mechanism used by the store.
Source:

Methods

add(key, value, success, error)

Adds a new value identified by a key to the store.

This method errors out if the store already contains the specified key.
Parameters:
Name Type Description
key String Key string.
value Value that is going to be added to the store.
success function Callback for a successful add operation.
error function Callback for handling errors. If not specified then store.defaultError is invoked.
Source:

addOrUpdate(key, value, success, error)

Adds or updates a value identified by a key to the store.

This method will overwrite the key's current value if it already exists in the store; otherwise it simply adds the new key and value.
Parameters:
Name Type Argument Description
key String Key string.
value Value that is going to be added or updated to the store.
success function Callback for a successful add or update operation.
error function <optional>
Callback for handling errors. If not specified then store.defaultError is invoked.
Source:

clear(success)

Removes all the data associated with this store object.
Parameters:
Name Type Description
success function Callback for a successful clear operation.
Source:

close()

This function does nothing in MemoryStore as it does not have a connection model.
Source:

contains(key, success)

Checks whether a key exists in the store.
Parameters:
Name Type Description
key String Key string.
success function Callback indicating whether the store contains the key or not.
Source:

getAllKeys(success)

Gets all the keys that exist in the store.
Parameters:
Name Type Description
success function Callback for a successful get operation.
Source:

read(key, success, error)

Reads the value associated to a key in the store.
Parameters:
Name Type Description
key String Key string.
success function Callback for a successful reads operation.
error function Callback for handling errors. If not specified then store.defaultError is invoked.
Source:

remove(key, success, error)

Removes a key and its value from the store.
Parameters:
Name Type Argument Description
key String Key string.
success function Callback for a successful remove operation.
error function <optional>
Callback for handling errors. If not specified then store.defaultError is invoked.
Source:

update(key, value, success, error)

Updates the value associated to a key in the store.
Parameters:
Name Type Argument Description
key String Key string.
value New value.
success function Callback for a successful update operation.
error function <optional>
Callback for handling errors. If not specified then store.defaultError is invoked. This method errors out if the specified key is not found in the store.
Source:

<inner> validateKeyInput(key, error) → {Boolean}

Validates that the specified key is not undefined, not null, and not an array
Parameters:
Name Type Description
key Key value.
error function Error callback.
Source:
Returns:
True if the key is valid. False if the key is invalid and the error callback has been queued for execution.
Type
Boolean