AbstractStorageService

AbstractStorageService ⇐ Abstract

Kind: global abstract class
Extends: Abstract
Service:
Properties

NameTypeDescription
prefixString

a prefix to use in all keys

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)

ParamTypeDescription
keystring

The key used to identify the storage

valueObject

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)

ParamTypeDefaultDescription
keystring

The key used to identify the storage

optionsObject

Additional options

[options.force]booleanfalse

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)

ParamTypeDescription
keystring

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

ParamTypeDescription
keystring

The key used to identify the storage

jsonStringstring

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

ParamTypeDescription
keystring

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

ParamTypeDescription
keystring

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

ParamTypeDescription
value*

The value to serialize

_onValueStored(key, value) ⇒ Promise

Fired when a value has been stored

Kind: instance method of AbstractStorageService
Access: protected

ParamTypeDescription
keystring

The key used to identify the storage

valueObject

The value stored

_onValueDeleted(key) ⇒ Promise

Fired when a value has been deleted from the storage

Kind: instance method of AbstractStorageService
Access: protected

ParamTypeDescription
keyString

The key that was used to reference the data

_onError(e) ⇒ Promise

Kind: instance method of AbstractStorageService
Access: protected

ParamType
eError

“valueStored” (key, value)

Fired when a value has been stored

Kind: event emitted by AbstractStorageService

ParamTypeDescription
keystring

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

ParamTypeDescription
keystring

The key that was used to reference the data

“error”

Fired when an error occured

Kind: event emitted by AbstractStorageService