class UpstashRedisStoreBaseStore<string, Uint8Array>Class that extends the BaseStore class to interact with an Upstash 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 Upstash Redis database.
Gets multiple keys from the Upstash Redis database.
Sets multiple keys in the Upstash Redis database.
Yields keys from the Upstash 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 UpstashRedisStore({
client: new Redis({
url: "your-upstash-redis-url",
token: "your-upstash-redis-token",
}),
});
await store.mset([
["message:id:0", "encoded-ai-message"],
["message:id:1", "encoded-human-message"],
]);
const retrievedMessages = await store.mget(["message:id:0", "message:id:1"]);
const yieldedKeys = [];
for await (const key of store.yieldKeys("message:id")) {
yieldedKeys.push(key);
}
await store.mdelete(yieldedKeys);