AbstractStorageService
On this page
- AbstractStorageService ⇐
Abstract- AbstractStorageService()
- store(key, value) ⇒
Promise.<Object.<string, string>, Error> - retrieve(key, options) ⇒
Promise.<string, Error> - delete(key) ⇒
Promise.<string, error> - clear() ⇒
Promise - _store(key, jsonString) ⇒
Promise.<Object.<string, string>, Error> - _retrieve(key) ⇒
Promise.<string, Error> - _delete(key) ⇒
Promise.<string, Error> - _clear() ⇒
Promise - _serialize(value) ⇒
Promise.<string, Error> - _onValueStored(key, value) ⇒
Promise - _onValueDeleted(key) ⇒
Promise - _onError(e) ⇒
Promise - “valueStored” (key, value)
- “valueDeleted” (key)
- “error”
AbstractStorageService ⇐ Abstract
Kind: global abstract class
Extends: Abstract
Service:
Properties
| Name | Type | Description |
|---|---|---|
| prefix | String | a prefix to use in all keys |
- AbstractStorageService ⇐
Abstract- new AbstractStorageService()
- .store(key, value) ⇒
Promise.<Object.<string, string>, Error> - .retrieve(key, options) ⇒
Promise.<string, Error> - .delete(key) ⇒
Promise.<string, error> - .clear() ⇒
Promise - ._store(key, jsonString) ⇒
Promise.<Object.<string, string>, Error> - ._retrieve(key) ⇒
Promise.<string, Error> - ._delete(key) ⇒
Promise.<string, Error> - ._clear() ⇒
Promise - ._serialize(value) ⇒
Promise.<string, Error> - ._onValueStored(key, value) ⇒
Promise - ._onValueDeleted(key) ⇒
Promise - ._onError(e) ⇒
Promise - “valueStored” (key, value)
- “valueDeleted” (key)
- “error”
AbstractStorageService()
A service to store/restore values in the form of key/value pairs from a persistent storage.
store(key, value) ⇒ Promise.<Object.<string, string>, Error>
Store the given value referenced by the key
Kind: instance method of AbstractStorageService
Returns: Promise.<Object.<string, string>, Error> - A promise ({key,value}, error)
| Param | Type | Description |
|---|---|---|
| key | string | The key used to identify the storage |
| value | Object | The value to store |
retrieve(key, options) ⇒ Promise.<string, Error>
Retrieve a previously stored value referenced by it’s key
Kind: instance method of AbstractStorageService
Returns: Promise.<string, Error> - A promise (value, error)
| Param | Type | Default | Description |
|---|---|---|---|
| key | string | The key used to identify the storage | |
| options | Object | Additional options | |
| [options.force] | boolean | false | If true, renew the cache |
delete(key) ⇒ Promise.<string, error>
Delete a value referenced by the key
Kind: instance method of AbstractStorageService
Returns: Promise.<string, error> - A promise ({key}, error)
| Param | Type | Description |
|---|---|---|
| key | string | The key that was used to reference the data |
clear() ⇒ Promise
Clear storage
Kind: instance method of AbstractStorageService
Returns: Promise - A promise ()
_store(key, jsonString) ⇒ Promise.<Object.<string, string>, Error>
Vendor implementation to store the given value referenced by the key
Kind: instance abstract method of AbstractStorageService
Returns: Promise.<Object.<string, string>, Error> - A promise ({key,value}, error)
Access: protected
| Param | Type | Description |
|---|---|---|
| key | string | The key used to identify the storage |
| jsonString | string | The value to store, serialized as a JSON string |
_retrieve(key) ⇒ Promise.<string, Error>
Vendor implementation to retrieve a previously stored value referenced by it’s key
Kind: instance abstract method of AbstractStorageService
Returns: Promise.<string, Error> - A promise (value, error)
Access: protected
| Param | Type | Description |
|---|---|---|
| key | string | The key used to identify the storage |
_delete(key) ⇒ Promise.<string, Error>
Vendor implementation to delete a value referenced by the key
Kind: instance abstract method of AbstractStorageService
Returns: Promise.<string, Error> - A promise ({key}, error)
Access: protected
| Param | Type | Description |
|---|---|---|
| key | string | The key that was used to reference the data |
_clear() ⇒ Promise
Vendor implementation to clear storage.
Kind: instance abstract method of AbstractStorageService
Returns: Promise - A promise
Access: protected
_serialize(value) ⇒ Promise.<string, Error>
Return a JSON string
Kind: instance method of AbstractStorageService
Returns: Promise.<string, Error> - The serialized value
Access: protected
| Param | Type | Description |
|---|---|---|
| value | * | The value to serialize |
_onValueStored(key, value) ⇒ Promise
Fired when a value has been stored
Kind: instance method of AbstractStorageService
Access: protected
| Param | Type | Description |
|---|---|---|
| key | string | The key used to identify the storage |
| value | Object | The value stored |
_onValueDeleted(key) ⇒ Promise
Fired when a value has been deleted from the storage
Kind: instance method of AbstractStorageService
Access: protected
| Param | Type | Description |
|---|---|---|
| key | String | The key that was used to reference the data |
_onError(e) ⇒ Promise
Kind: instance method of AbstractStorageService
Access: protected
| Param | Type |
|---|---|
| e | Error |
“valueStored” (key, value)
Fired when a value has been stored
Kind: event emitted by AbstractStorageService
| Param | Type | Description |
|---|---|---|
| key | string | The key used to identify the storage |
| value | * | The value stored |
“valueDeleted” (key)
Fired when a value has been deleted from the storage
Kind: event emitted by AbstractStorageService
| Param | Type | Description |
|---|---|---|
| key | string | The key that was used to reference the data |
“error”
Fired when an error occured
Kind: event emitted by AbstractStorageService