@xylabs/storage
v5.0.90
Published
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Downloads
8,668
Readme
@xylabs/storage
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Reference
@xylabs/storage
Interfaces
| Interface | Description | | ------ | ------ | | ReadonlyKeyValueStore | A readonly storage device. | | KeyValueStore | A read/write storage device. |
interfaces
KeyValueStore
A read/write storage device.
Extends
ReadonlyKeyValueStore<TValue,TKey>
Type Parameters
| Type Parameter | Default type |
| ------ | ------ |
| TValue | - |
| TKey | string |
Methods
get()
get(key: TKey): Promisable<TValue | undefined>;Returns a promise that resolves to the value for the given key.
Parameters
| Parameter | Type | Description |
| ------ | ------ | ------ |
| key | TKey | The key to get the value for. |
Returns
Promisable<TValue | undefined>
Inherited from
keys()?
optional keys(): Promisable<TKey[]>;The keys an array of keys.
Returns
Promisable<TKey[]>
Inherited from
clear()?
optional clear(): Promisable<void>;Removes all entries from the store.
Returns
Promisable<void>
delete()
delete(key: TKey): Promisable<void>;Deletes the entry with the given key.
Parameters
| Parameter | Type | Description |
| ------ | ------ | ------ |
| key | TKey | The key of the entry to delete |
Returns
Promisable<void>
set()
set(key: TKey, value: TValue): Promisable<void>;Sets a value for the given key, creating or updating the entry.
Parameters
| Parameter | Type | Description |
| ------ | ------ | ------ |
| key | TKey | The key to set |
| value | TValue | The value to store |
Returns
Promisable<void>
ReadonlyKeyValueStore
A readonly storage device.
Extended by
Type Parameters
| Type Parameter | Default type |
| ------ | ------ |
| TValue | - |
| TKey | string |
Methods
get()
get(key: TKey): Promisable<TValue | undefined>;Returns a promise that resolves to the value for the given key.
Parameters
| Parameter | Type | Description |
| ------ | ------ | ------ |
| key | TKey | The key to get the value for. |
Returns
Promisable<TValue | undefined>
keys()?
optional keys(): Promisable<TKey[]>;The keys an array of keys.
Returns
Promisable<TKey[]>
Part of sdk-js
Maintainers
License
See the LICENSE file for license details
