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

# 存储集成

> 使用 LangChain Python 集成存储。

## 概述

LangChain 提供了一个键值存储接口，用于按键存储和检索数据。 LangChain 中的键值存储接口主要用于缓存 [embeddings](/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) 类来实现自定义存储。详见 [store interface documentation](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="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>

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