CACHE_LOCATION.md 1.2 KB

缓存位置说明

本项目的缓存默认存储在用户主目录:

默认缓存位置: ~/cache (即 /Users/semsevens/cache)

目录结构

~/cache/
├── text_embedding/            # 向量相似度计算缓存
├── semantic_similarity/       # 语义相似度计算缓存
└── data/                      # 数据缓存
    ├── search/                # 搜索结果缓存
    ├── detail/                # 详情数据缓存
    └── tools_list/            # 工具列表缓存

配置方式

1. 默认配置(推荐)

无需任何配置,代码默认使用 ~/cache 作为缓存根目录。

2. 通过环境变量覆盖

如果需要使用其他路径,可以设置环境变量:

编辑 ~/.zshrc,添加:

export CACHE_ROOT=/your/custom/path

然后执行:

source ~/.zshrc

3. 通过代码设置

在程序开始时调用:

from lib.config import set_cache_root
set_cache_root("/your/custom/path")

配置优先级

  1. 代码中调用 set_cache_root() - 最高优先级
  2. 环境变量 CACHE_ROOT - 中等优先级
  3. 默认值 ~/cache - 最低优先级

参考 CACHE_CONFIG.md 了解更多配置方式。