Interface for storage providers to implement, providing compile-time errors for incorrect implementations alongside the abstract StorageProvider class to extend which provides runtime errors for missing method implementations
Note: This is a TypeScript feature and you do not need to worry about this bit so much if you are using JavaScript.
Methods
.clear() → Promise<void>
Async method that removes all keys and their values from storage
.get(key: string) → Promise<string>
Async method that gets the value of a key in storage
Parameters:
Name | Type | Description |
---|---|---|
key |
|
The name of the key in storage |
.init() → Promise<void>
Async method to be run that will set up the storage provider for use. Calls to other provider methods should not be made until this method has been called and resolved
.keys() → Promise<string[]>
Async method returning an array of stored key names
.remove(key: string) → Promise<void>
Async method that removes a key and its value from storage
Parameters:
Name | Type | Description |
---|---|---|
key |
|
The name of the key in storage |
.set(key: string, value: string) → Promise<void>
Async method that sets the value of a key in storage
Parameters:
Name | Type | Description |
---|---|---|
key |
|
The name of the key in storage |
value |
|
The value to set in storage |