caching-strategies
Skill0 starsChanged 3 months agoMITView on GitHub
缓存全攻略:Redis模式、失效策略、CDN、浏览器缓存.
9 other projects use a version of this.
Adopted by
Most recently taken up by
- novatic-cu/nova-skillstheir own version, first seen Sep 20, 2026
- Bappoz/My-Claude-Skillstheir own version, first seen Jul 15, 2026
- vanara-agents/skillstheir own version, first seen Jul 14, 2026
- shinzoxD/knackboxtheir own version, first seen Jul 10, 2026
- KraitDev/skiLL.Mdtheir own version, first seen May 15, 2026
- michaelsvanbeek/personal-agent-skillstheir own version, first seen Apr 9, 2026
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- wshaddix/dotnet-skills★ 79same name
- vanara-agents/skills★ 9same name
- KraitDev/skiLL.Md★ 6same name
- VersoXBT/claude-initial-setup★ 4same name
- ffsshhttiikk/opencode-agents-skills★ 2same name
- Bappoz/My-Claude-Skills★ 1same name
- michaelsvanbeek/personal-agent-skills★ 1same name
- novatic-cu/nova-skills★ 1same name
- shinzoxD/knackbox★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository219 other files it gives its agents.
- agent-doctrineSkill
- agent-evaluation-frameworkSkill
- agent-visualization-flintSkill
- hermes-agentSkill
- bailian-cliSkill
- edge-browser-automationSkill
- computer-useSkill
- jupyter-live-kernelSkill
- backup-strategiesSkill
- browser-automationSkill
- chinese-ai-free-apiSkill
- cicd-pipeline-templatesSkill
- copybaraSkill
- devops-toolkitSkill
- email-deliverabilitySkill
- monitoring-observabilitySkill
- obsidian-maintenanceSkill
- obsidian-troubleshootingSkill
- openclaw-windowsSkill
- openclaw-workerSkill
- webhook-subscriptionsSkill
- windows-dev-environmentSkill
- windows-masterSkill
- zero-downtime-deploySkill
- codebase-inspectionSkill
- github-workflowSkill
- adaptive-communicationSkill
- agent-cost-dashboardSkill
- agent-evolutionSkill
- agent-governanceSkill
- agent-osSkill
- context-efficient-toolsSkill
- context-loss-awarenessSkill
- creative-synthesisSkill
- hermes-desktop-pluginsSkill
- emotional-intelligenceSkill
- graph-engineering-workflowSkill
- hermes-maintenanceSkill
- hermes-voiceSkill
- hermes-hygieneSkill
- identity-coreSkill
- income-loopSkill
- master-synthesisSkill
- meta-cognitionSkill
- reasoning-engineSkill
- self-preservationSkill
- teaching-abilitySkill
- temporal-awarenessSkill
- hermes-themesSkill
- thinking-visualizationSkill
- user-modelingSkill
- voice-full-restoreSkill
- knowledge-graph-traversalSkill
- mcp-browser-canvasSkill
- free-api-gatewaySkill
- native-mcpSkill
- web-reverse-apiSkill
- ai-edaSkill
- huggingface-hubSkill
- industrial-ai-siemens-mcpSkill
- The first 60 shown.
The file
Files
缓存全攻略
缓存金字塔
浏览器缓存 (Cache-Control/ETag)
→ CDN (CloudFlare)
→ 反向代理 (Nginx)
→ 应用缓存 (Redis/Memcached)
→ 数据库缓存 (Buffer Pool)
→ 数据库越上层越快,但容量越小。
Redis 常用模式
# 1. Cache-Aside(最常用)
def get_user(user_id):
cached = redis.get(f"user:{user_id}")
if cached:
return json.loads(cached)
user = db.query(User).get(user_id)
redis.setex(f"user:{user_id}", 3600, json.dumps(user))
return user
# 2. 计数器
redis.incr("page_views") # 页面访问
redis.incrby("likes:post:42", 1) # 点赞
# 3. 分布式锁
lock = redis.set("lock:task", "1", nx=True, ex=10)
if lock:
try:
do_work()
finally:
redis.delete("lock:task")
# 4. 消息队列
redis.lpush("queue", task_json) # 生产者
task = redis.brpop("queue", timeout=5) # 消费者(阻塞等)
# 5. 排行榜(Sorted Set)
redis.zadd("scores", {"user1": 100, "user2": 95})
redis.zrevrange("scores", 0, 9, withscores=True) # Top10三大缓存问题
缓存穿透:查不存在的数据 → 每次都穿到DB
→ 方案:布隆过滤器 + 缓存空值
缓存击穿:热点数据过期 → 大量请求同时打DB
→ 方案:互斥锁(只有一个线程去查DB重建缓存)
缓存雪崩:大量缓存同时过期 → DB瞬间被打爆
→ 方案:过期时间加随机值(3600±600秒)缓存失效策略
TTL(生存时间):设过期时间,到期自动删除
LRU(最近最少用):内存满时淘汰最久没用的
LFU(最不常用):内存满时淘汰使用频率最低的
Redis 默认:volatile-lru(有过期时间的键用LRU)浏览器缓存
# 强缓存(不发请求)
Cache-Control: max-age=3600 # 缓存1小时
Cache-Control: immutable # 永远不变(适合带hash的文件)
# 协商缓存(发请求验证)
ETag: "abc123" # 内容指纹
Last-Modified: Wed, 30 Jul 2026 # 最后修改时间
If-None-Match: "abc123" # 请求时带上,304表示没变CDN
原理:把静态资源推到离用户最近的节点。
适合:图片、CSS/JS、视频、下载文件
不适合:动态内容、用户相关数据
回源:CDN节点没有 → 回源站取 → 缓存到CDN
刷新:主动清除CDN缓存
预热:提前把资源推到CDN节点Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

