class RedisByteStoreBaseStore<string, Uint8Array>Class that extends the BaseStore class to interact with a Redis database. It provides methods for getting, setting, and deleting data, as well as yielding keys from the database.
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.
Deletes multiple keys from the Redis database.
Gets multiple keys from the Redis database.
Sets multiple keys in the Redis database.
Yields keys from the Redis database.
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.
const store = new RedisByteStore({ client: new Redis({}) });
await store.mset([
[
"message:id:0",
new TextEncoder().encode(JSON.stringify(new AIMessage("ai stuff..."))),
],
[
"message:id:1",
new TextEncoder().encode(
JSON.stringify(new HumanMessage("human stuff...")),
),
],
]);
const retrievedMessages = await store.mget(["message:id:0", "message:id:1"]);
console.log(retrievedMessages.map((v) => new TextDecoder().decode(v)));
const yieldedKeys = [];
for await (const key of store.yieldKeys("message:id:")) {
yieldedKeys.push(key);
}
console.log(yieldedKeys);
await store.mdelete(yieldedKeys);