Interface: KeyValueStore<K, V> ​
Defined in: store.ts:4
Re-implmentation of a interface for a generic key-value store.
Type Parameters ​
K ​
K
V ​
V
Methods ​
clear() ​
clear():
void
Defined in: store.ts:10
Clears the store, removing all key-value pairs.
Returns ​
void
when the store has been cleared.
close() ​
close():
void
Defined in: store.ts:17
Closes the store, freeing up any resources used. After calling this method, no other operations can be performed on the store.
Returns ​
void
when the store has been closed.
delete() ​
delete(
key):boolean|void
Defined in: store.ts:25
Deletes a key-value pair from the store.
Parameters ​
key ​
K
The key of the value to delete.
Returns ​
boolean | void
True if the element existed and has been removed, or false if the element does not exist.
entries() ​
entries(): [
K,V][]
Defined in: store.ts:49
Fetches the keys and values as a nested array.
Returns ​
[K, V][]
An array of key-value pair arrays in the store.
get() ​
get(
key):V|undefined
Defined in: store.ts:33
Fetches a value from the store given its key.
Parameters ​
key ​
K
The key of the value to retrieve.
Returns ​
V | undefined
The value associated with the key, or undefined if no value exists for that key.
set() ​
set(
key,value):void
Defined in: store.ts:42
Sets the value for a key in the store.
Parameters ​
key ​
K
The key under which to store the value.
value ​
V
The value to be stored.
Returns ​
void
once the value has been set.