cache-strategy

cache-strategy is a skill for Claude Code from ils15/pantheon-legacy. It costs 25 tokens per session (1,843 once invoked), scanned A, original, MIT.

A guide to choosing and building caching systems, which store commonly requested data for faster reuse. It covers Redis, content delivery networks, expiration times, invalidation, and session storage.

In plain words
What is it for?
Use it when designing read-through or write-through caches, setting expiration rules, planning CDN caching, handling cache invalidation, or storing sessions.
Why use it?
It helps avoid serving every request from a slower database or rebuilding the same data repeatedly. It also addresses the difficult question of when stored data should be refreshed or removed.

Skill for Claude Code

Written for Claude Code: context: fork in frontmatter.

Good fit Use it when designing read-through or write-through caches, setting expiration rules, planning CDN caching, handling cache invalidation, or storing sessions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ils15/pantheon-legacy/cache-strategy
Install

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.

Any agent
npx skills add ils15/pantheon-legacy --skill cache-strategy
Clone the repo
git clone --depth 1 https://github.com/ils15/pantheon-legacy

Made for: Claude Code.

Wrote 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.

agentmods badge for cache-strategy

README.md
[![agentmods](https://agentmods.dev/badge/skills/ils15/pantheon-legacy/cache-strategy.svg)](https://agentmods.dev/skills/ils15/pantheon-legacy/cache-strategy)
Your own site
<a href="https://agentmods.dev/skills/ils15/pantheon-legacy/cache-strategy"><img src="https://agentmods.dev/badge/skills/ils15/pantheon-legacy/cache-strategy.svg" alt="Measured on agentmods" height="20"></a>
Per session 25 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,843 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00025 $0.01843
Opus 5 $0.00013 $0.00922
Sonnet 5 $0.00005 $0.00369
Haiku 4.5 $0.00003 $0.00184

Measured 8d ago against content hash b8afc15814ee, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

cache-strategy 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 8d 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.

.clinerules/skills/cache-strategy/SKILL.md · 274 lines

How it starts

The opening of the file, as written. The whole thing — 274 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Cache Strategy — Architecture Patterns

Use this skill for cache architecture decisions. Covers Redis patterns, CDN strategies, TTL management, cache invalidation, and session stores. Used by Demeter during schema design and Hermes during implementation.


Cache Patterns

1. Read-Through Cache

The cache sits between the application and the database. On a cache miss, the cache loads the data from the database.

import redis
import json
from typing import Optional

class ReadThroughCache:
    def __init__(self, redis_client: redis.Redis, ttl: int = 300):
        self.redis = redis_client
        self.ttl = ttl
    
    async def get(self, key: str, loader) -> Optional[dict]:
        """Get from cache. If miss, load from source and cache."""
        cached = await self.redis.get(key)
        if cached:
            return json.loads(cached)
        
        # Cache miss — load from source
        data = await loader()
        if data:
            await self.redis.setex(key, self.ttl, json.dumps(data))
        return data

When to use: Read-heavy workloads (products, reviews, user profiles)

2. Write-Through Cache

Data is written to both the cache and the database simultaneously.

class WriteThroughCache:
    async def set(self, key: str, data: dict, saver):
        """Write to cache and database simultaneously."""
        # Write to database first
        await saver(data)
        # Then update cache
        await self.redis.setex(key, self.ttl, json.dumps(data))
    
    async def delete(self, key: str, deleter):
        """Delete from both cache and database."""
        await deleter()
        await self.redis.delete(key)

When to use: Data that must be consistent (user accounts, orders)

3. Write-Behind (Write-Back) Cache

Data is written to the cache first, then asynchronously flushed to the database.

import asyncio
from collections import OrderedDict

class WriteBehindCache:
    def __init__(self, flush_interval: int = 5):
        self.write_queue = OrderedDict()
        self.flush_interval = flush_interval
    
    async def set(self, key: str, data: dict):
        """Write to cache only. Flush to DB asynchronously."""
        self.write_queue[key] = data
        if len(self.write_queue) >= 100:
            await self._flush()
    
    async def _flush(self):
        """Flush all pending writes to database."""
        batch = dict(self.write_queue)
        self.write_queue.clear()
        # Batch write to database
        await self._batch_save(batch)

Read the full file on GitHub · 274 lines

Changes

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.

  1. 8d ago First seen · 274 lines · 25 tokens per session scan A b8afc15814ee

Subscribe to this mod's changes

cache-strategy is a skill published in the GitHub repository ils15/pantheon-legacy (10 stars, last pushed 5d ago), licensed MIT. It adds 25 tokens to every session and 1,843 once invoked, about $0.0001 per session on Opus 5. 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.