> For the complete documentation index, see [llms.txt](https://docs.zongsoft.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zongsoft.com/framework/core/caching.md).

# Zongsoft.Caching

Zongsoft.Caching 命名空间的职责和主要类型。

`Zongsoft.Caching` 提供[核心类库](https://github.com/Zongsoft/framework/tree/main/Zongsoft.Core)中的缓存抽象和内存缓存实现，用于支撑进程内缓存、缓存过期、容量控制、缓冲刷新和缓存事件通知。

## 主要职责

* 定义 `IDistributedCache` 等缓存访问抽象。
* 提供 `MemoryCache`、`MemoryCacheOptions` 等进程内缓存实现和配置。
* 表达缓存过期策略、缓存优先级、淘汰原因和缓存变更事件。
* 提供 `Spooler<T>` 异步缓冲器，用于高频写入的批量刷新。
* 为其它模块提供统一的缓存依赖，而不是直接绑定某个具体缓存实现。

## 类型

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref">页面</th></tr></thead><tbody><tr><td><strong>MemoryCache</strong></td><td>进程内缓存、过期策略、依赖令牌、淘汰事件和容量提醒。</td><td><a href="/framework/core/caching/memory-cache.md">缓存</a></td></tr><tr><td><strong>Spooler&#x3C;T></strong></td><td>基于 Channel 的异步缓冲器，用于高频写入的批量刷新。</td><td><a href="/framework/core/caching/spooler.md">缓冲器</a></td></tr></tbody></table>

## 相关资源

* [Caching 源码目录](https://github.com/Zongsoft/framework/tree/main/Zongsoft.Core/src/Caching)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.zongsoft.com/framework/core/caching.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
