CDN, Redis, in-memory cache, cache invalidation, and distributed caching patterns
npx skills add https://github.com/cosmicstack-labs/mercury-agent-skills --skill caching-strategies
Cache effectively to improve performance and reduce load.
| Layer | Latency | Storage | Examples |
|-------|---------|---------|----------|
| Browser | Local | Small | localStorage, HTTP cache |
| CDN | Regional | Large | CloudFront, CloudFlare, Fastly |
| Application | In-process | Small | L1 cache (heap) |
| Distributed | Network | Large | Redis, Memcached |
| Database | Same host | Very large | Buffer pool, query cache |
1. Check cache → miss
2. Query database
3. Store in cache
4. Return
Best for: Read-heavy, general purpose.
1. Write to cache
2. Cache writes to DB (sync)
3. Return
Best for: Consistency critical, write-heavy.
1. Write to cache
2. Return immediately
3. Cache writes to DB (async)
Best for: High throughput writes, eventual consistency OK.
Two hard things: naming, cache invalidation, off-by-one errors.
| Strategy | How | Risk |
|----------|-----|------|
| TTL | Expire after X seconds | Stale data during TTL |
| Event-based | Invalidate on data change | Missed events |
| Version keys | user_42_v3 | Unused old keys accumulate |
| Write-through | Update cache on write | Write amplification |
EXPIRE on every SETSCAN not KEYS in productionEfficient database search tool for bioRxiv preprint server. Use this skill when searching for life sciences preprints by keywords, authors, date ranges, or categories, retrieving paper metadata, downloading PDFs, or conducting literature reviews.
Access BRENDA enzyme database via SOAP API. Retrieve kinetic parameters (Km, kcat), reaction equations, organism data, and substrate-specific enzyme information for biochemical research and metabolic pathway analysis.
Access ClinPGx pharmacogenomics data (successor to PharmGKB). Query gene-drug interactions, CPIC guidelines, allele functions, for precision medicine and genotype-guided dosing decisions.
Query NCBI ClinVar for variant clinical significance. Search by gene/position, interpret pathogenicity classifications, access via E-utilities API or FTP, annotate VCFs, for genomic medicine.
Access COSMIC cancer mutation database. Query somatic mutations, Cancer Gene Census, mutational signatures, gene fusions, for cancer research and precision oncology. Requires authentication.
Query Ensembl genome database REST API for 250+ species. Gene lookups, sequence retrieval, variant analysis, comparative genomics, orthologs, VEP predictions, for genomic research.
Query openFDA API for drugs, devices, adverse events, recalls, regulatory submissions (510k, PMA), substance identification (UNII), for FDA regulatory data analysis and safety research.
Query NCBI Gene via E-utilities/Datasets API. Search by symbol/ID, retrieve gene info (RefSeqs, GO, locations, phenotypes), batch lookups, for gene annotation and functional analysis.
Take cosmicstack-labs/caching-strategies from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.