> ## Documentation Index
> Fetch the complete documentation index at: https://jmail.world/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 缓存

> 基于 ETag 的缓存机制工作原理

Python 客户端使用 **基于 ETag 的条件请求** 来避免重复下载未更改的文件。

## 工作原理

1. 在首次下载时，客户端会将文件及其 ETag 保存到 `~/.cache/jmail/`
2. 在后续请求时，客户端会发送带有 `If-None-Match: &lt;etag&gt;` 的条件 `HEAD` 请求
3. 如果服务器返回 **304 Not Modified**，则使用本地缓存的文件（无需重新下载）
4. 如果 ETag 发生变化，则会重新下载该文件

## 缓存位置

```
~/.cache/jmail/
  emails.parquet
  emails.etag
  emails-slim.parquet
  emails-slim.etag
  documents.parquet
  documents.etag
  ...
```

## 关闭缓存

### Python

```python theme={null}
client = JmailClient(cache=False)
```

### 命令行界面

```bash theme={null}
uv run jmail.py emails --no-cache --head 5
```

## 清除缓存

```bash theme={null}
rm -rf ~/.cache/jmail/
```

## Manifest

`/v1/manifest.json` 接口提供数据集元数据和校验和，可用于以编程方式检查数据是否为最新：

```bash theme={null}
curl https://data.jmail.world/v1/manifest.json | python -m json.tool
```

```python theme={null}
client = JmailClient()
manifest = client.manifest()
print(manifest)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.