Extends
Methods
clearExpired() → {jQuery.Promise}protected
#
Clear any expired items from the store
- Overrides:
- Source:
Returns:
Resolves when items have been expired
- Type
- jQuery.Promise
get(key) → {string|null
|boolean}
#
null
|boolean}
#
Retrieve value from device storage.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Key of item to retrieve |
- Overrides:
- Source:
Returns:
String value, null if no value exists, or false if storage is not available.
- Type
-
string
|
null
| boolean
getExpiryKeys() → {jQuery.Promise}protected
#
Get all keys with expiry values
- Overrides:
- Source:
Returns:
Promise resolving with all the keys which have expiry values (unprefixed), or as many could be retrieved in the allocated time.
- Type
- jQuery.Promise
getObject(key) → {Object|null
|boolean}
#
null
|boolean}
#
Retrieve JSON object from device storage.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Key of item to retrieve |
- Overrides:
- Source:
Returns:
Object, null if no value exists or value is not JSON-parseable, or false if storage is not available.
- Type
-
Object
|
null
| boolean
isExpired(key) → {boolean}protected
#
Check if a given key has expired
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Key name |
- Overrides:
- Source:
Returns:
Whether key is expired
- Type
- boolean
remove(key) → {boolean}
#
Remove a value from device storage.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Key of item to remove |
- Overrides:
- Source:
Returns:
Whether the save succeeded or not
- Type
- boolean
set(key, value, [expiry]) → {boolean}
#
Set a value in device storage.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
string | Key name to store under |
|
value |
string | Value to be stored |
|
expiry |
number |
optional |
Number of seconds after which this item can be deleted |
- Overrides:
- Source:
Returns:
The value was set
- Type
- boolean
setExpires(key, [expiry])
#
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). |
- Overrides:
- Source:
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 |
- Overrides:
- Source:
Returns:
The value was set
- Type
- boolean