UpstashRedisByteStore#
- class langchain_community.storage.upstash_redis.UpstashRedisByteStore(*, client: Any = None, url: str | None = None, token: str | None = None, ttl: int | None = None, namespace: str | None = None)[source]#
BaseStore implementation using Upstash Redis as the underlying store to store raw bytes.
Methods
__init__(*[, client, url, token, ttl, namespace])amdelete(keys)Async delete the given keys and their associated values.
amget(keys)Async get the values associated with the given keys.
amset(key_value_pairs)Async set the values for the given keys.
ayield_keys(*[, prefix])Async get an iterator over keys that match the given prefix.
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.
- Parameters:
client (Any) –
url (str | None) –
token (str | None) –
ttl (int | None) –
namespace (str | None) –
- __init__(*, client: Any = None, url: str | None = None, token: str | None = None, ttl: int | None = None, namespace: str | None = None) None[source]#
- Parameters:
client (Any) –
url (str | None) –
token (str | None) –
ttl (int | None) –
namespace (str | None) –
- Return type:
None
- async amdelete(keys: Sequence[K]) None#
Async delete the given keys and their associated values.
- Parameters:
keys (Sequence[K]) – A sequence of keys to delete.
- Return type:
None
- async amget(keys: Sequence[K]) List[V | None]#
Async get the values associated with the given keys.
- Parameters:
keys (Sequence[K]) – A sequence of keys.
- Returns:
A sequence of optional values associated with the keys. If a key is not found, the corresponding value will be None.
- Return type:
List[V | None]
- async amset(key_value_pairs: Sequence[Tuple[K, V]]) None#
Async set the values for the given keys.
- Parameters:
key_value_pairs (Sequence[Tuple[K, V]]) – A sequence of key-value pairs.
- Return type:
None
- async ayield_keys(*, prefix: str | None = None) AsyncIterator[K] | AsyncIterator[str]#
Async get an iterator over keys that match the given prefix.
- Parameters:
prefix (str) – The prefix to match.
- Yields:
Iterator[K | str] – An iterator over keys that match the given prefix. This method is allowed to return an iterator over either K or str depending on what makes more sense for the given store.
- Return type:
AsyncIterator[K] | AsyncIterator[str]
- mdelete(keys: Sequence[str]) None[source]#
Delete the given keys.
- Parameters:
keys (Sequence[str]) –
- Return type:
None
- mget(keys: Sequence[str]) List[bytes | None][source]#
Get the values associated with the given keys.
- Parameters:
keys (Sequence[str]) –
- Return type:
List[bytes | None]
Examples using UpstashRedisByteStore