In-memory implementation of the BaseStore using a dictionary. Used for storing key-value pairs in memory.
class InMemoryStoreBaseStore<string, T>const store = new InMemoryStore<BaseMessage>();
await store.mset(
Array.from({ length: 5 }).map((_, index) => [
`message:id:${index}`,
index % 2 === 0
? new AIMessage("ai stuff...")
: new HumanMessage("human stuff..."),
]),
);
const retrievedMessages = await store.mget(["message:id:0", "message:id:1"]);
await store.mdelete(await store.yieldKeys("message:id:").toArray());A path to the module that contains the class, eg. ["langchain", "llms"] Usually should be the same as the entrypoint the class is exported from.
Abstract method to delete multiple keys.
Abstract method to get multiple values for a set of keys.
Abstract method to set a value for multiple keys.
Abstract method to yield keys optionally based on a prefix.
The name of the serializable. Override to provide an alias or to preserve the serialized module name in minified environments.
Implemented as a static method to support loading logic.
A path to the module that contains the class, eg. ["langchain", "llms"]
Abstract method to delete multiple keys.
Abstract method to get multiple values for a set of keys.
Abstract method to set a value for multiple keys.
Abstract method to yield keys optionally based on a prefix.
The name of the serializable. Override to provide an alias or
A path to the module that contains the class, eg. ["langchain", "llms"]