> 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/externals/projects/garnet.md).

# Garnet (garnet)

Garnet 项目的能力范围、部署产物、接入入口与使用边界。

通过宿主[工作器](https://github.com/Zongsoft/framework/blob/main/Zongsoft.Core/src/Components/IWorker.cs)运行支持 Redis 协议的 Garnet 服务器。项目承担服务器托管职责，业务客户端仍需要相应的访问适配器。

| 项目项  | 值                                           |
| ---- | ------------------------------------------- |
| 源码目录 | `externals/garnet`                          |
| 主包   | `Zongsoft.Externals.Garnet`                 |
| 配套主题 | [缓存与分布式协作](/framework/externals/caching.md) |

## 部署与使用入口

将主包追加到已有宿主的[部署清单](/references/deploy-files.md)，并保留包中的插件清单、程序集及附属运行资源：

{% code title="Application.deploy（追加片段）" %}

```ini
[plugins zongsoft externals garnet]
nuget:Zongsoft.Externals.Garnet
```

{% endcode %}

设置位于 `/Externals/Garnet`，具名 server 的 value 转换为服务器选项。启动[工作器](https://github.com/Zongsoft/framework/blob/main/Zongsoft.Core/src/Components/IWorker.cs)会使用相应端口和存储目录。

## 接入步骤

1. 明确绑定地址、端口、认证和持久化目录后再启用[工作器](https://github.com/Zongsoft/framework/blob/main/Zongsoft.Core/src/Components/IWorker.cs)。
2. 使用选定客户端验证应用实际依赖的命令和数据类型。
3. 如启用 AOF 或检查点，验证停止、重新启动和数据恢复。

具体配置、调用示例和相关基础概念见[缓存与分布式协作](/framework/externals/caching.md)。

## 项目边界

{% hint style="info" %}
💡 服务器与宿主共享进程资源及故障边界。相对目录通常相对适配器程序集解析，`~/` 相对应用根目录；Redis 协议兼容不等于全部命令和持久化行为相同。
{% endhint %}

## 继续阅读

[按项目浏览扩展](/framework/externals/projects.md) · [缓存与分布式协作](/framework/externals/caching.md) · [源码与项目说明](https://github.com/Zongsoft/framework/tree/main/externals/garnet)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.zongsoft.com/framework/externals/projects/garnet.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
