SingleProviderStorage

Simple async key/value storage abstraction operating on top of a single StorageProvider instance. Each key in this storage reflects a single key in the given StorageProvider

Supports nested object paths in get/set/remove using . like normal object accessors

Constructor

new SingleProviderStorage(name: string, provider: StorageProviderConstructor)

Parameters:
Name Type Description
name
string

Unique identifier for this storage, used by the given StorageProvider

provider
StorageProviderConstructor

The storage provider class that will be instantiated and used as the backend for this storage abstraction

Source:

Methods

.clear() → Promise<void>

Remove all key/value pairs from this storage

Source:
Returns:
Promise<void>

.exists(key: string) → Promise<boolean>

Check if a value exists in storage

Parameters:
Name Type Description
key
string

The key in storage to check

Source:
Returns:
Promise<boolean>

.get(key: string) → Promise<any>

Get a value from this storage for the specified key

Parameters:
Name Type Description
key
string

The key in storage to get

Source:
Returns:
Promise<any>

.init() → Promise<void>

Initialize this storage. Any other method calls should not be made until this method has been called and resolved

Source:
Returns:
Promise<void>

.keys() → Promise<string[]>

Get the names of all keys in this storage

Source:
Returns:
Promise<string[]>

.remove(key: string) → Promise<void>

Remove a key/value pair from this storage

Parameters:
Name Type Description
key
string

The key in storage to remove

Source:
Returns:
Promise<void>

.set(key: string, value: any) → Promise<void>

Set a value in this storage for the specified key

Parameters:
Name Type Description
key
string

The key in storage to set

value
any

The value to set

Source:
Returns:
Promise<void>