In-memory store for any type of data. Attributes: store (Dict[str, Any]): The underlying dictionary that stores the key-value pairs. Examples: .. code-block:: python from langchain.storage import InMemoryStore store = InMemoryStore()
| 288 | |
| 289 | |
| 290 | class InMemoryStore(InMemoryBaseStore[Any]): |
| 291 | """In-memory store for any type of data. |
| 292 | |
| 293 | Attributes: |
| 294 | store (Dict[str, Any]): The underlying dictionary that stores |
| 295 | the key-value pairs. |
| 296 | |
| 297 | Examples: |
| 298 | |
| 299 | .. code-block:: python |
| 300 | |
| 301 | from langchain.storage import InMemoryStore |
| 302 | |
| 303 | store = InMemoryStore() |
| 304 | store.mset([('key1', 'value1'), ('key2', 'value2')]) |
| 305 | store.mget(['key1', 'key2']) |
| 306 | # ['value1', 'value2'] |
| 307 | store.mdelete(['key1']) |
| 308 | list(store.yield_keys()) |
| 309 | # ['key2'] |
| 310 | list(store.yield_keys(prefix='k')) |
| 311 | # ['key2'] |
| 312 | """ |
| 313 | |
| 314 | |
| 315 | class InMemoryByteStore(InMemoryBaseStore[bytes]): |
no outgoing calls