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

# 存储集成

> 使用 LangChain Python 与存储集成。

## 概述

LangChain 提供了一个键值存储接口用于通过键存储和检索数据。LangChain 中的键值存储接口主要用于缓存 [嵌入](/oss/python/integrations/embeddings)。

## 接口

所有 [`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>
  基础存储旨在同时处理**多个**键值对以提高效率。这节省了网络往返时间，并可能允许在底层存储中进行更高效的批处理操作。
</Note>

## 本地开发内置存储

<Columns cols={2}>
  <Card title="InMemoryByteStore" icon="link" href="/oss/python/integrations/stores/in_memory" arrow="true" cta="View guide" />

  <Card title="LocalFileStore" icon="link" href="/oss/python/integrations/stores/file_system" arrow="true" cta="View guide" />
</Columns>

## 自定义存储

您也可以通过扩展 [`BaseStore`](https://reference.langchain.com/python/langchain-core/stores/BaseStore) 类来实现自己的自定义存储。有关更多详细信息，请参阅 [存储接口文档](https://reference.langchain.com/python/langchain-core/stores/BaseStore)。

## 所有键值存储

<Columns cols={3}>
  <Card title="AstraDBByteStore" icon="link" href="/oss/python/integrations/stores/astradb" arrow="true" cta="View guide" />

  <Card title="CassandraByteStore" icon="link" href="/oss/python/integrations/stores/cassandra" arrow="true" cta="View guide" />

  <Card title="ElasticsearchEmbeddingsCache" icon="link" href="/oss/python/integrations/stores/elasticsearch" arrow="true" cta="View guide" />

  <Card title="RedisStore" icon="link" href="/oss/python/integrations/stores/redis" arrow="true" cta="View guide" />

  <Card title="UpstashRedisByteStore" icon="link" href="/oss/python/integrations/stores/upstash_redis" arrow="true" cta="View guide" />

  <Card title="BigtableByteStore" icon="link" href="/oss/python/integrations/stores/bigtable" arrow="true" cta="View guide" />
</Columns>

***

<div className="source-links">
  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/i18n\zh-CN\oss\python\integrations\stores\index.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>

  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>
</div>
