> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-docs-zh.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 存储集成

> 使用 LangChain Python 集成存储。

## 概述

LangChain 提供了键值存储接口用于存储和检索数据。该键值存储接口主要用于缓存 [嵌入](https://langchain-docs-zh.mintlify.site/langchain/oss/python/integrations/embeddings.md)。

## 接口

所有 [`BaseStores`](https://reference.langchain.com/python/langchain-core/stores/BaseStore) 支持以下接口：

* `mget(key: Sequence[str]) -> List[Optional[bytes]]`: 获取多个键的内容，不存在键时返回 `None`
* `mset(key_value_pairs: Sequence[Tuple[str, bytes]]) -> None`: 设置多个键的内容
* `mdelete(key: Sequence[str]) -> None`: 删除多个键
* `yield_keys(prefix: Optional[str] = None) -> Iterator[str]`: 生成存储中的所有键，可按前缀过滤

> [!NOTE]
>
> 基座存储设计用于同时处理 **多个** 键值对以提升效率。这减少了网络往返次数，可能允许底层存储进行更高效的批量操作。

## 本地开发内置存储

> [card] [InMemoryByteStore](https://langchain-docs-zh.mintlify.site/langchain/oss/python/integrations/stores/in_memory.md)

> [card] [LocalFileStore](https://langchain-docs-zh.mintlify.site/langchain/oss/python/integrations/stores/file_system.md)

## 定制存储

您还可以通过扩展 @\[`BaseStore`] 类来实现自己的定制存储。更多细节请参考 [存储接口文档](https://reference.langchain.com/python/langchain-core/stores/BaseStore)。

## 所有键值存储

| 集成 | 下载 |
| :- | :- |
| [`AstraDBByteStore`](https://langchain-docs-zh.mintlify.site/langchain/oss/python/integrations/stores/astradb) | [  ![Downloads per month](https://static.pepy.tech/badge/langchain-astradb/month)](https://pypi.org/project/langchain-astradb/) |
| [`ElasticsearchEmbeddingsCache`](https://langchain-docs-zh.mintlify.site/langchain/oss/python/integrations/stores/elasticsearch) | [  ![Downloads per month](https://static.pepy.tech/badge/langchain-elasticsearch/month)](https://pypi.org/project/langchain-elasticsearch/) |
| [`M3Store`](https://github.com/skynetcmd/m3-memory/blob/main/docs/integrations/LANGCHAIN.md) | [  ![Downloads per month](https://static.pepy.tech/badge/m3-memory/month)](https://pypi.org/project/m3-memory/) |
| [`CockroachDBStore`](https://cockroachdb.github.io/langchain-cockroachdb/guides/long-term-memory/) | [  ![Downloads per month](https://static.pepy.tech/badge/langchain-cockroachdb/month)](https://pypi.org/project/langchain-cockroachdb/) |
| [`HindsightStore`](https://docs.hindsight.vectorize.io/sdks/integrations/langgraph) | [  ![Downloads per month](https://static.pepy.tech/badge/hindsight-langgraph/month)](https://pypi.org/project/hindsight-langgraph/) |
| [`OmemStore`](https://infrastructure.omem-cloud.com/docs) | [  ![Downloads per month](https://static.pepy.tech/badge/omem-infrastructure/month)](https://pypi.org/project/omem-infrastructure/) |
| [`PplStore`](https://github.com/ppl-crm/ppl-memory) | [  ![Downloads per month](https://static.pepy.tech/badge/ppl-memory/month)](https://pypi.org/project/ppl-memory/) |
| [`PostgresStore`](https://skamalj.github.io/agentstate-reducer/langgraph/stores/) | [  ![Downloads per month](https://static.pepy.tech/badge/langgraph-store-postgres/month)](https://pypi.org/project/langgraph-store-postgres/) |
| [`BigtableByteStore`](https://langchain-docs-zh.mintlify.site/langchain/oss/python/integrations/stores/bigtable) | [  ![Downloads per month](https://static.pepy.tech/badge/langchain-google-bigtable/month)](https://pypi.org/project/langchain-google-bigtable/) |
| [`DynamoDBStore`](https://skamalj.github.io/agentstate-reducer/langgraph/stores/) | [  ![Downloads per month](https://static.pepy.tech/badge/langgraph-store-dynamodb/month)](https://pypi.org/project/langgraph-store-dynamodb/) |
| [`QdrantStore`](https://pypi.org/project/langgraph-store-qdrant/) | [  ![Downloads per month](https://static.pepy.tech/badge/langgraph-store-qdrant/month)](https://pypi.org/project/langgraph-store-qdrant/) |
| [`LithtrixStore`](https://docs.lithtrix.ai/integrations/langgraph) | [  ![Downloads per month](https://static.pepy.tech/badge/lithtrix-langgraph/month)](https://pypi.org/project/lithtrix-langgraph/) |
| [`XNSByteStore`](https://docs.xns.tech) | [  ![Downloads per month](https://static.pepy.tech/badge/langchain-xns/month)](https://pypi.org/project/langchain-xns/) |
| [`CosmosDBStore`](https://skamalj.github.io/agentstate-reducer/langgraph/stores/) | [  ![Downloads per month](https://static.pepy.tech/badge/langgraph-store-cosmosdb/month)](https://pypi.org/project/langgraph-store-cosmosdb/) |
| [`FirestoreStore`](https://skamalj.github.io/agentstate-reducer/langgraph/stores/) | [  ![Downloads per month](https://static.pepy.tech/badge/langgraph-store-firestore/month)](https://pypi.org/project/langgraph-store-firestore/) |
| [`GridGainCheckpointSaver`](https://pypi.org/project/langgraph-checkpoint-gridgain/) | [  ![Downloads per month](https://static.pepy.tech/badge/langgraph-checkpoint-gridgain/month)](https://pypi.org/project/langgraph-checkpoint-gridgain/) |
| [`UpstashStore`](https://github.com/Tghez/langgraph-store-upstash) | [  ![Downloads per month](https://static.pepy.tech/badge/langgraph-store-upstash/month)](https://pypi.org/project/langgraph-store-upstash/) |
| [`InspeximusStore`](https://dancenitra.github.io/inspeximus/) | [  ![Downloads per month](https://static.pepy.tech/badge/langgraph-store-inspeximus/month)](https://pypi.org/project/langgraph-store-inspeximus/) |
| [`TypeDBStore`](https://typedb.com/docs) | [  ![Downloads per month](https://static.pepy.tech/badge/langgraph-store-typedb/month)](https://pypi.org/project/langgraph-store-typedb/) |
| [`InMemoryByteStore`](https://langchain-docs-zh.mintlify.site/langchain/oss/python/integrations/stores/in_memory) | N/A |
| [`LocalFileStore`](https://langchain-docs-zh.mintlify.site/langchain/oss/python/integrations/stores/file_system) | N/A |

***

> 官方原文：[src/oss/python/integrations/stores/index.mdx](https://github.com/langchain-ai/docs/blob/main/src/oss/python/integrations/stores/index.mdx) · 非官方翻译，译文由 AI 生成，以英文原文为准。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.