sccache
$ sccache 官方出品 低风险Mozilla 出品的类 ccache 编译缓存工具,支持 Rust(rustc)、C/C++ 与 CUDA,可使用本地磁盘或 S3、GCS、Azure、Redis 等远程缓存后端,并通过 sccache --show-stats --stats-format json 输出结构化指标。
brew install sccache 本地/分布式编译器包装工具,通常通过 RUSTC_WRAPPER=sccache 或 CMake 启动器配置。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
支持 --show-stats --stats-format json 与零交互执行,可透明包装 rustc 与 C/C++ 编译器。
- Native
--stats-format jsonstats output - Non-interactive daemon and CLI commands
安全的编译缓存包装;远程写入仅限于配置的缓存桶,凭证通过标准环境变量注入。
- No destructive source mutations; read-only stats inspection
单个 Rust 静态二进制,通过 Homebrew、Cargo 与 GitHub Releases 覆盖 macOS、Linux 与 Windows。
- Prebuilt binaries on all three major OSes
支持 RUSTC_WRAPPER=sccache 与 S3/GCS/Redis 共享缓存,大幅加快跨机构建。
- Supports
RUSTC_WRAPPER=sccacheplus S3/GCS/Redis/GHA backends
源自 Mozilla(mozilla/sccache),以 Apache-2.0 协议持续维护。
- Active
mozilla/sccacherepository
仓库 docs/ 目录对各后端、环境变量与 CLI 参数说明清晰。
- Backend and CLI documentation in repository
docs/
安全边界、鉴权与放权指南
本地磁盘缓存无需认证;远程后端通过 SCCACHE_* 环境变量(如 AWS/GCS/Redis 凭证)或 ~/.config/sccache/config 读取配置。
Apache-2.0 开源 CLI;若启用云端远程缓存,需承担对应 S3/GCS/Redis 存储费用。
# sccache Agent Rules - Always pass `--stats-format json` with `sccache --show-stats` for structured cache inspection. - Avoid printing `env` or config files when `SCCACHE_S3_KEY` or Redis credentials are configured.
Agent 高频安全命令配方
只读查询(安全推荐)
sccache --show-stats --stats-format json
以结构化 JSON 输出缓存命中、未命中及后端错误计数。
sccache --version
报告已安装的 sccache 二进制版本,不启动后台守护进程。
受控写入与预演
sccache --zero-stats
在执行纯净构建基准测试前,将运行中守护进程的命中/未命中计数归零。
核心优势
- +
sccache --show-stats --stats-format json为 Agent 提供精确的 JSON 命中率遥测。 - + 同时支持
rustc与 C/C++/CUDA 编译缓存,并可接入多种共享远程后端。
注意事项与踩坑点
- ! 首次运行会拉起本地后台守护进程(可通过
--stop-server停止)。 - ! 若远程缓存环境变量配置不当可能拖慢或阻塞编译,需配合合理调整
SCCACHE_IDLE_TIMEOUT与降级设置。