# 管理缓存

有效管理 Alluxio 中缓存的数据是实现最大性能和资源效率的关键。本节全面概述了 Alluxio 中数据缓存的生命周期，从将数据加载到缓存到管理其存在和最终删除。

## 数据缓存生命周期

我们可以将缓存数据的生命周期分为三个主要阶段：

1. **加载数据**：数据最初是如何进入缓存的。
2. **管理数据**：如何控制缓存的内容、使用的空间以及缓存的时间。
3. **删除数据**：数据如何从缓存中被驱逐或删除。

### 将数据加载到缓存中

本指南涵盖了将数据加载到 Alluxio 的两种主要方式。

* **被动缓存**：默认行为，即数据在应用程序首次读取时自动缓存。
* **主动预加载**：使用分布式 `job load` 命令在需要数据*之前*主动将数据加载到缓存中。这对于为性能敏感的工作负载预热缓存是理想的选择。

了解更多关于[加载数据](/ee-ai-cn/ai-3.7/cache/loading-data-into-the-cache.md)...

### 管理缓存中的数据

一旦数据进入缓存，Alluxio 提供了一套强大的工具来控制其生命周期和资源消耗。

* **缓存过滤策略**：根据文件路径定义规则以选择性地缓存或忽略文件。这对于管理可变数据和优化缓存空间至关重要。
* **缓存配额**：对特定目录树可以消耗的缓存空间量设置限制，这对于多租户和资源隔离至关重要。
* **生存时间 (TTL)**：在定义的时间段后自动过期和驱逐缓存数据，确保陈旧或临时数据被清理。
* **驱逐优先级**：为不同的数据集分配优先级，以影响在缓存已满时首先驱逐哪些数据，从而保护关键数据不被删除。

了解更多关于[管理数据](/ee-ai-cn/ai-3.7/cache/managing-data-in-the-cache.md)...

### 从缓存中删除数据

本指南详细介绍了从 Alluxio 缓存中删除数据的不同方式，可以是自动的也可以是手动的。

* **自动驱逐**：当缓存达到其容量时，Alluxio 根据 LRU（最近最少使用）等策略删除数据的标准过程。
* **手动驱逐**：使用 `job free` 命令强制从缓存中删除特定文件或目录，让您直接控制缓存内容。
* **陈旧缓存清理**：一种专门的管理工具，用于查找和删除在集群拓扑更改后可能出现的错位或冗余数据。

了解更多关于[删除数据](/ee-ai-cn/ai-3.7/cache/removing-data-from-the-cache.md)...


---

# Agent Instructions: 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:

```
GET https://documentation.alluxio.io/ee-ai-cn/ai-3.7/cache.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
