langchain.storage.upstash_redis.UpstashRedisStore¶

class langchain.storage.upstash_redis.UpstashRedisStore(*, client: Any = None, url: Optional[str] = None, token: Optional[str] = None, ttl: Optional[int] = None, namespace: Optional[str] = None)[source]¶

BaseStore implementation using Upstash Redis as the underlying store.

Initialize the UpstashRedisStore with HTTP API.

Must provide either an Upstash Redis client or a url.

Parameters
  • client – An Upstash Redis instance

  • url – UPSTASH_REDIS_REST_URL

  • token – UPSTASH_REDIS_REST_TOKEN

  • ttl – time to expire keys in seconds if provided, if None keys will never expire

  • namespace – if provided, all keys will be prefixed with this namespace

Methods

__init__(*[, client, url, token, ttl, namespace])

Initialize the UpstashRedisStore with HTTP API.

mdelete(keys)

Delete the given keys.

mget(keys)

Get the values associated with the given keys.

mset(key_value_pairs)

Set the given key-value pairs.

yield_keys(*[, prefix])

Yield keys in the store.

__init__(*, client: Any = None, url: Optional[str] = None, token: Optional[str] = None, ttl: Optional[int] = None, namespace: Optional[str] = None) None[source]¶

Initialize the UpstashRedisStore with HTTP API.

Must provide either an Upstash Redis client or a url.

Parameters
  • client – An Upstash Redis instance

  • url – UPSTASH_REDIS_REST_URL

  • token – UPSTASH_REDIS_REST_TOKEN

  • ttl – time to expire keys in seconds if provided, if None keys will never expire

  • namespace – if provided, all keys will be prefixed with this namespace

mdelete(keys: Sequence[str]) None[source]¶

Delete the given keys.

mget(keys: Sequence[str]) List[Optional[str]][source]¶

Get the values associated with the given keys.

mset(key_value_pairs: Sequence[Tuple[str, str]]) None[source]¶

Set the given key-value pairs.

yield_keys(*, prefix: Optional[str] = None) Iterator[str][source]¶

Yield keys in the store.