Constructor
new SingleProviderStorage(name: string, provider: StorageProviderConstructor)
Parameters:
Name | Type | Description |
---|---|---|
name |
|
Unique identifier for this storage, used by the given StorageProvider |
provider |
|
The storage provider class that will be instantiated and used as the backend for this storage abstraction |
Methods
.clear() → Promise<void>
Remove all key/value pairs from this storage
.exists(key: string) → Promise<boolean>
Check if a value exists in storage
Parameters:
Name | Type | Description |
---|---|---|
key |
|
The key in storage to check |
.get(key: string) → Promise<any>
Get a value from this storage for the specified key
Parameters:
Name | Type | Description |
---|---|---|
key |
|
The key in storage to get |
.init() → Promise<void>
Initialize this storage. Any other method calls should not be made until this method has been called and resolved
.keys() → Promise<string[]>
Get the names of all keys in this storage
.remove(key: string) → Promise<void>
Remove a key/value pair from this storage
Parameters:
Name | Type | Description |
---|---|---|
key |
|
The key in storage to remove |
.set(key: string, value: any) → Promise<void>
Set a value in this storage for the specified key
Parameters:
Name | Type | Description |
---|---|---|
key |
|
The key in storage to set |
value |
|
The value to set |