InMemoryBaseStore#
- class langchain_core.stores.InMemoryBaseStore[source]#
In-memory implementation of the BaseStore using a dictionary.
Initialize an empty store.
Methods
__init__()Initialize an empty store.
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 async iterator over keys that match the given prefix.
mdelete(keys)Delete the given keys and their associated values.
mget(keys)Get the values associated with the given keys.
mset(key_value_pairs)Set the values for the given keys.
yield_keys([prefix])Get an iterator over keys that match the given prefix.
- async amdelete(
- keys: Sequence[str],
Async delete the given keys and their associated values.
- Parameters:
keys (Sequence[str]) – A sequence of keys to delete.
- Return type:
None
- async amget(
- keys: Sequence[str],
Async get the values associated with the given keys.
- Parameters:
keys (Sequence[str]) – 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[str, V]],
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,
Async get an async iterator over keys that match the given prefix.
- Parameters:
prefix (str, optional) – The prefix to match. Defaults to None.
- Yields:
AsyncIterator[str] – An async iterator over keys that match the given prefix.
- Return type:
AsyncIterator[str]
- mdelete(
- keys: Sequence[str],
Delete the given keys and their associated values.
- Parameters:
keys (Sequence[str]) – A sequence of keys to delete.
- Return type:
None
- mget(
- keys: Sequence[str],
Get the values associated with the given keys.
- Parameters:
keys (Sequence[str]) – 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]