agentleFS
zdanovichnickzdanovichnick/dotnet-pilot/skills/caching/SKILL.md

caching

Skill5 starsChanged 5 days agoMITView on GitHub

HybridCache (.NET 9+), output caching, cache-aside pattern, and IMemoryCache — registration, usage, invalidation, and key strategy.

14 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use background-jobs, ci-cd and 3 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • YepAPISkill

    background-jobs

    Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.

    Also in 4 projects that use this

  • JohnJBorenSkill

    ci-cd

    CI/CD pipeline design, GitHub Actions, testing automation, and deployment strategies

    Also in 5 projects that use this

  • HamzaSheikh768Skill

    dependency-injection

    Leverages FastAPI's powerful Depends system for reusable authentication, database sessions, rate limiting, and business logic injection.

    Also in 3 projects that use this

  • ffsshhttiikkSkill

    openapi

    OpenAPI/Swagger specification and documentation

    Also in 3 projects that use this

  • SentrySkill

    feature-flags

    Gate a Sentry feature behind a FlagPole feature flag. Use when adding a feature flag, registering a flag in temporary.py, checking a flag from Python or the frontend, enabling a flag in tests, or asking where FlagPole rollout config lives. Trigger on "add a feature flag", "gate this behind a flag", "register a flag", "features.has", "api_expose", "OrganizationFeature", "ProjectFeature", "FlagPole".

    Also in 3 projects that use this

The file

Files
SKILL.md

Caching Patterns

Reference for caching in .NET APIs. Covers HybridCache (L1+L2), output caching, cache-aside, and IMemoryCache.

Caching Options at a Glance

OptionBest ForNotes
HybridCacheApplication-level data (entities, computed results).NET 9+; L1 in-process + L2 distributed; stampede protection
Output caching (IOutputCacheStore)HTTP response caching (full responses)Middleware-level; [OutputCache] attribute or .CacheOutput()
IMemoryCacheSingle-node, simple key-value, no distributed requirementNo stampede protection; use GetOrCreateAsync
IDistributedCacheDistributed session, custom serializationLow-level; HybridCache wraps it

References

Load only the file the task needs:

FileCovers
references/hybridcache.mdPackage, registration, usage, invalidation, typed cache keys
references/output-cache.mdOutput-cache registration, [OutputCache] / .CacheOutput() usage, invalidation
references/cache-aside-and-keys.mdCache-aside pattern, IMemoryCache for single-node apps, multi-tenant key strategy

Do / Don't

DoDon't
Use HybridCache as the default for application dataUse IMemoryCache in a multi-node deployment for shared data
Always set an expirationCache indefinitely (memory leak, stale data)
Use typed key factory to avoid magic stringsScatter $"product:{id}" literals across the codebase
Cache sealed, immutable DTOs (see the reuse gotcha in references/hybridcache.md)Cache tracked EF entities or mutable objects (mutations won't propagate)
Scope keys by tenant ID in multi-tenant appsShare cache entries across tenants
Log cache misses at Debug levelLog every cache hit (too noisy)
Invalidate on write (cache-aside write-through)Let stale data live beyond TTL without a manual eviction path
Use tags for group invalidationEnumerate and delete keys by prefix (fragile, slow)

See Also

  • skills/resilience/SKILL.md — pair HybridCache with circuit breakers when the backing store is unreliable
  • knowledge/decisions/adr-004-hybridcache.md — project-level ADR for HybridCache adoption

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.