Skip to content
Agentmart
Submit a tool

caching-strategy

缓存策略参考 —— 多级缓存架构、失效策略、缓存穿透/击穿/雪崩防护

Skill by Sweetteabittersugar

IndexedMIT★ 3
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/sweetteabittersugar-caching-strategy

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

缓存策略参考 —— 多级缓存架构、失效策略、缓存穿透/击穿/雪崩防护

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/caching-strategy

What's inside

Skill name
caching-strategy
Description
缓存策略参考 —— 多级缓存架构、失效策略、缓存穿透/击穿/雪崩防护
License
MIT
Instructions
32 lines in SKILL.md · view on GitHub

Files (2)

  • SKILL.md
  • SKILL.md.disabled

SKILL.md (first lines)

# 缓存策略

## 概述
提供多级缓存架构的设计原则和常见陷阱的防护策略,覆盖浏览器缓存、CDN、应用缓存、数据库缓存全链路。

## 使用场景
- API 响应慢,需要引入缓存加速
- 高并发场景下保护数据库不被压垮
- 热点数据频繁读取导致数据库负载过高
- 设计缓存键命名规范和过期策略

## 核心原则
1. **缓存是优化而非功能**:系统在缓存失效时应降级到正常查询,而非报错或崩溃。
2. **就近缓存**:数据离用户越近越好 —— 浏览器 → CDN → 应用内存 → 分布式缓存 → 数据库。
3. **设置合理的 TTL**:根据数据变更频率设定过期时间。变化越频繁的数据 TTL 越短。
4. **显式失效优先于被动过期**:数据变更时主动清除缓存,而非仅依赖 TTL 等待过期。
5. **防止缓存穿透**:对不存在的数据缓存空值(短 TTL),或使用布隆过滤器拦截非法查询。

## 常见模式
- **Cache-Aside**:读——先查缓存,miss 则查库并回填;写——更新库后删缓存
- **Read-Through / Write-Through**:缓存层封装库访问,对调用方透明
- **Write-Behind**:异步写库,适合写密集型且能容忍短期数据丢失的场景
- **多级缓存**:本地缓存(Caffeine)→ 分布式缓存(Redis)→ 数据库

## 检查清单
- [ ] 缓存失效后系统是否能正常降级工作?
- [ ] 是否对不存在的数据做了缓存穿透防护?
- [ ] 缓存过期时间是否设置了随机偏移防止雪崩?
- [ ] 热点 Key 是否有单机本地缓存兜底防止击穿?
- [ ] 缓存键是否有明确的命名规范和版本管理策略?

From Sweetteabittersugar/agency, MIT.

More from Sweetteabittersugar/agency

Signals

Stars
3
Forks
1
Open issues
0
Last commit (this folder)
Jun 10, 2026 (4 months ago)
Last release
Aug 24, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from Sweetteabittersugar

Cite this page

caching-strategy skill. Agent Mart. https://agentmart.dev/skills/sweetteabittersugar-caching-strategy (last updated 2026-10-24)