Constructor
new Store(optionsopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Object |
<optional> |
Optional settings for Store (none currently defined for base class) |
Methods
(abstract) put(dict) → {Promise}
Put items in storage
Parameters:
Name | Type | Description |
---|---|---|
dict |
Object | Items to store, keys/property names must be strings. Values must be serializable to strings. |
Returns:
Resolves to the keys of values that were successfully stored.
- Type
- Promise
(abstract) fetch(keys) → {Promise}
Fetch items from storage
Parameters:
Name | Type | Description |
---|---|---|
keys |
Array.<String> | Names of items to fetch from storage. |
Returns:
Resolves to an object with properties for each valid key, and the stored item with that name as the value.
- Type
- Promise
(abstract) discard(keys) → {Promise}
Discard items in storage
Parameters:
Name | Type | Description |
---|---|---|
keys |
Array.<String> | Names of items to discard. |
Returns:
Resolves to an array of names of items that were successfully deleted.
- Type
- Promise
(static) validateKeys(keys) → {Array.<String>}
Validate key names
Ensures that keys are strings and ignores those that aren't.
This method can be overridden in sub-classes if stores have different and/or additional validation requirements.
Parameters:
Name | Type | Description |
---|---|---|
keys |
Array.<String> | String | Names of properties to validate. |
Returns:
Keys that were successfully validated.
(static) sanitizeValues(dict) → {Object}
Sanitize property values
Ensures that values are able to be transformed to JSON strings and back again (or are undefined), ignores those that aren't.
This method can be overridden in sub-classes if stores have different and/or additional validation requirements.
Parameters:
Name | Type | Description |
---|---|---|
dict |
Object | Object containing values to validate. |
Returns:
Contains only those properties which have values that can be converted, and sanitized copies of the original values.
- Type
- Object