IKeyValueStorage<Async>
Defined in: atomiq-storage-memory-indexed-kv/src/IKeyValueStorage.ts:7
Generic key-value storage interface supporting both synchronous and asynchronous backends. Implement this interface to create custom storage backends for MemoryIndexedKeyValueUnifiedStorage.
Type Parameters
| Type Parameter | Description |
|---|---|
Async extends boolean | When true, all operations return Promises; when false, operations are synchronous |
Properties
async
async: Async;
Defined in: atomiq-storage-memory-indexed-kv/src/IKeyValueStorage.ts:10
Whether this storage backend is asynchronous
Methods
get()
get(key): Async extends true ? Promise<string> : string;
Defined in: atomiq-storage-memory-indexed-kv/src/IKeyValueStorage.ts:20
Retrieves a value by key
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The key to look up |
Returns
Async extends true ? Promise<string> : string
The stored value, or null if not found
getAll()?
optional getAll(keys): Async extends true ? Promise<string[]> : string[];
Defined in: atomiq-storage-memory-indexed-kv/src/IKeyValueStorage.ts:46
Retrieves multiple values by keys (optional batch operation)
Parameters
| Parameter | Type | Description |
|---|---|---|
keys | string[] | Array of keys to look up |
Returns
Async extends true ? Promise<string[]> : string[]
Array of values in the same order as keys, null for missing keys
getKeys()
getKeys(): Async extends true ? Promise<string[]> : string[];
Defined in: atomiq-storage-memory-indexed-kv/src/IKeyValueStorage.ts:39
Returns all keys in the storage
Returns
Async extends true ? Promise<string[]> : string[]
Array of all stored keys
init()
init(): Promise<void>;
Defined in: atomiq-storage-memory-indexed-kv/src/IKeyValueStorage.ts:13
Initializes the storage backend
Returns
Promise<void>
remove()
remove(key): Async extends true ? Promise<void> : void;
Defined in: atomiq-storage-memory-indexed-kv/src/IKeyValueStorage.ts:33
Removes a value by key
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The key to remove |
Returns
Async extends true ? Promise<void> : void
removeAll()?
optional removeAll(keys): Async extends true ? Promise<void> : void;
Defined in: atomiq-storage-memory-indexed-kv/src/IKeyValueStorage.ts:58
Removes multiple values by keys (optional batch operation)
Parameters
| Parameter | Type | Description |
|---|---|---|
keys | string[] | Array of keys to remove |
Returns
Async extends true ? Promise<void> : void
set()
set(key, value): Async extends true ? Promise<void> : void;
Defined in: atomiq-storage-memory-indexed-kv/src/IKeyValueStorage.ts:27
Stores a value at the given key
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The key to store under |
value | string | The string value to store |
Returns
Async extends true ? Promise<void> : void
setAll()?
optional setAll(values): Async extends true ? Promise<void> : void;
Defined in: atomiq-storage-memory-indexed-kv/src/IKeyValueStorage.ts:52
Stores multiple key-value pairs (optional batch operation)
Parameters
| Parameter | Type | Description |
|---|---|---|
values | object[] | Array of key-value pairs to store |
Returns
Async extends true ? Promise<void> : void