caching

Implement HybridCache and output caching with invalidation in .NET applications.

1|Updated Apr 28, 2026
One-click install
npx skills add https://github.com/Trossitec/dotnet-claude-kit --skill caching-trossitec
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: caching
Source: https://github.com/Trossitec/dotnet-claude-kit/tree/main/skills/caching
Command: npx skills add https://github.com/Trossitec/dotnet-claude-kit --skill caching-trossitec

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves slow .NET read performance and unnecessary database or API load by guiding correct caching strategies that stay consistent with application data.

Core Features & Use Cases

  • HybridCache-first design: Uses .NET 9+ HybridCache as the default unified L1/L2 caching abstraction with stampede protection.
  • Correct invalidation patterns: Keeps cached reads consistent by removing or evicting entries on mutations instead of caching write responses.
  • Response-level performance: Applies output caching for whole HTTP responses using middleware and cache tags for targeted eviction.
  • Safety guardrails: Encourages explicit TTLs, avoids caching mutable or user-specific global data, and prevents hand-rolled stampede protection.

Quick Start

Load this skill when you are implementing caching in a .NET 10 app and you need guidance on when to use HybridCache, output caching, and cache invalidation.

Frequently Asked Questions about caching

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement cache invalidation in a .NET API without caching write responses?

Cache invalidation in .NET requires removing or evicting cache entries on mutations instead of caching write responses from POST, PUT, or DELETE requests, ensuring cached reads stay consistent with application data.

What is the best way to prevent cache stampedes in .NET 9+ applications?

Preventing cache stampedes in .NET 9+ is best handled by using HybridCache GetOrCreateAsync patterns, which provide built-in stampede protection rather than relying on hand-rolled concurrency controls.

How do I apply output caching for HTTP responses in .NET?

Output caching for HTTP responses in .NET applies whole-response caching using middleware and safe cache tags, enabling targeted eviction while explicitly avoiding caching mutable or user-specific global data.

When should I use HybridCache over other caching strategies in .NET?

HybridCache should be used as the default unified L1/L2 caching abstraction in .NET 9+ when you need to reduce database and service load while maintaining data freshness through explicit TTLs.

Does HybridCache work with Redis for distributed L2 caching in .NET?

HybridCache supports distributed L2 caching scenarios using Redis to reduce database load across .NET applications, while providing local L1 cache and stampede protection out of the box.