Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
git clone --depth 1 https://github.com/hhx465453939/mcp-pubmed-serverWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/hhx465453939/mcp-pubmed-server/caching-management)<a href="https://agentmods.dev/rules/hhx465453939/mcp-pubmed-server/caching-management"><img src="https://agentmods.dev/badge/rules/hhx465453939/mcp-pubmed-server/caching-management/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/hhx465453939/mcp-pubmed-server/caching-management"><img src="https://agentmods.dev/badge/rules/hhx465453939/mcp-pubmed-server/caching-management.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.01364 |
| Opus 5 | $0.00000 | $0.00682 |
| Sonnet 5 | $0.00000 | $0.00273 |
| Haiku 4.5 | $0.00000 | $0.00136 |
Grade A, and why
caching-management scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 215 lines — stays where its author put it; the contents beside it link to each section on GitHub.
缓存管理规范
双层缓存架构
1. 内存缓存 (Map对象)
// 内存缓存配置
this.cache = new Map();
this.cacheTimeout = 5 * 60 * 1000; // 5分钟过期
this.maxCacheSize = 100; // 最大100个条目
2. 文件缓存 (JSON文件)
// 文件缓存配置
const CACHE_DIR = path.join(process.cwd(), 'cache');
const PAPER_CACHE_DIR = path.join(CACHE_DIR, 'papers');
const PAPER_CACHE_EXPIRY = 30 * 24 * 60 * 60 * 1000; // 30天过期
缓存操作模式
内存缓存操作
// 获取缓存
getFromCache(key) {
const cached = this.cache.get(key);
if (cached && Date.now() - cached.timestamp < this.cacheTimeout) {
this.cacheStats.hits++;
return cached.data;
}
this.cacheStats.misses++;
return null;
}
// 设置缓存
setCache(key, data) {
// LRU淘汰策略
if (this.cache.size >= this.maxCacheSize) {
const oldestKey = this.cache.keys().next().value;
this.cache.delete(oldestKey);
this.cacheStats.evictions++;
}
this.cache.set(key, {
data,
timestamp: Date.now()
});
this.cacheStats.sets++;
}
文件缓存操作
// 从文件缓存获取
getPaperFromFileCache(pmid) {
const cachePath = this.getPaperCachePath(pmid);
if (!fs.existsSync(cachePath)) {
this.cacheStats.fileMisses++;
return null;
}
const fileContent = fs.readFileSync(cachePath, 'utf8');
const cachedData = JSON.parse(fileContent);
// 检查过期时间
if (Date.now() - cachedData.timestamp > PAPER_CACHE_EXPIRY) {
fs.unlinkSync(cachePath);
return null;
}
this.cacheStats.fileHits++;
return cachedData.data;
}
// 保存到文件缓存
setPaperToFileCache(pmid, data) {
const cachePath = this.getPaperCachePath(pmid);
const cacheData = {
version: CACHE_VERSION,
pmid: pmid,
timestamp: Date.now(),
data: data
};
fs.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2));
this.cacheStats.fileSets++;
}
缓存统计和监控
统计数据结构
this.cacheStats = {
hits: 0, // 内存缓存命中
misses: 0, // 内存缓存未命中
sets: 0, // 内存缓存设置
evictions: 0, // 内存缓存淘汰
fileHits: 0, // 文件缓存命中
fileMisses: 0, // 文件缓存未命中
fileSets: 0 // 文件缓存设置
};
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 9d ago First seen · 215 lines · 1,364 tokens per session scan A 6a7a1eb9529f
caching-management is a cursor rule published in the GitHub repository hhx465453939/mcp-pubmed-server (6 stars, last pushed 6mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 1,364 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other cursor rules, from other repositories
redis
This guide provides definitive, actionable best practices for using Redis effectively, focusing on data modeling, performance, security, and cluster-aware client usage to build robust and scalable applications.
cache
A set of guidance for using a cache, a temporary data store that keeps frequently needed information available for faster access. It describes cache operations and a shared data center for access to stored data.
full-test-with-db-redis
Run full tests with Docker db and redis.
redis_rate_limiting
Complete guide for implementing Redis-based rate limiting with authentication troubleshooting and FastAPI integration.
nestjs-6-database-performance
USE WHEN working with databases, implementing repositories, optimizing queries, caching, or performance tuning.
canonical__eedis
Redis: data structures, caching patterns, pub/sub.