Methods
get(key) → {string|null
|boolean}
#
null
|boolean}
#
Retrieve value from device storage.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Key of item to retrieve |
- Source:
Returns:
String value, null if no value exists, or false if storage is not available.
getObject(key) → {Object|null
|boolean}
#
null
|boolean}
#
Retrieve JSON object from device storage.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Key of item to retrieve |
- Source:
Returns:
Object, null if no value exists or value is not JSON-parseable, or false if storage is not available.
remove(key) → {boolean}
#
set(key, value, [expiry]) → {boolean}
#
setExpires(key, [expiry]) → {boolean}
#
Set the expiry time for an item in the store.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
string | Key name |
|
expiry |
number |
optional |
Number of seconds after which this item can be deleted, omit to clear the expiry (either making the item never expire, or to clean up when deleting a key). |
- Source:
Returns:
The expiry was set (or cleared) [since 1.41]
- Type
- boolean
setObject(key, value, [expiry]) → {boolean}
#
Set an object value in device storage by JSON encoding.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
string | Key name to store under |
|
value |
Object | Object value to be stored |
|
expiry |
number |
optional |
Number of seconds after which this item can be deleted |
- Source:
Returns:
The value was set
- Type
- boolean