Memory API
The memory module of the @codebolt/plugin-sdk.
import plugin from '@codebolt/plugin-sdk';
Quick Reference
| Method | Description |
|---|---|
addKnowledge | Adds a key-value pair to the in-memory database. |
getKnowledge | Retrieves a value from the in-memory database by key. |
Methods
addKnowledge
plugin.memory.addKnowledge(key: string, value: MemoryValue): Promise<MemorySetResponse>
Adds a key-value pair to the in-memory database.
| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | Yes | The key under which to store the value. |
value | MemoryValue | Yes | The value to be stored. |
Returns: Promise<MemorySetResponse> — A promise that resolves with the response from the memory set event.
getKnowledge
plugin.memory.getKnowledge(key: string): Promise<MemoryGetResponse>
Retrieves a value from the in-memory database by key.
| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | Yes | The key of the value to retrieve. |
Returns: Promise<MemoryGetResponse> — A promise that resolves with the response from the memory get event.