Skip to main content

UpstashRedisByteStore

UpstashRedisStoreByteStore 的一种实现,它将所有数据存储在您的 Upstash 托管的 Redis 实例中。

要使用基本的 RedisStore,请参阅此指南

要配置 Upstash Redis,请参考我们的Upstash指南.

%pip install --upgrade --quiet  upstash-redis
from langchain_community.storage import UpstashRedisByteStore
from upstash_redis import Redis
URL = "<UPSTASH_REDIS_REST_URL>"
TOKEN = "<UPSTASH_REDIS_REST_TOKEN>"
redis_client = Redis(url=URL, token=TOKEN)
store = UpstashRedisByteStore(client=redis_client, ttl=None, namespace="test-ns")
store.mset([("k1", b"v1"), ("k2", b"v2")])
print(store.mget(["k1", "k2"]))
[b'v1', b'v2']

Was this page helpful?


You can leave detailed feedback on GitHub.