caching

Implement HybridCache and output caching for .NET 10 applications.

640|145|Updated Feb 20, 2026
One-click install
npx skills add https://github.com/codewithmukesh/dotnet-claude-kit --skill caching-codewithmukesh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: caching
Source: https://github.com/codewithmukesh/dotnet-claude-kit/tree/main/skills/caching
Command: npx skills add https://github.com/codewithmukesh/dotnet-claude-kit --skill caching-codewithmukesh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Caching addresses slow reads, excessive database load, and high token/IO cost by storing frequently accessed data closer to the application and avoiding repeated expensive queries or recomputations.

Core Features & Use Cases

  • HybridCache default: L1 in-memory + L2 distributed caching with built-in stampede protection for safe, efficient reads.
  • Output caching: Cache full HTTP responses for public or static endpoints and evict by tag on mutations.
  • Cache invalidation & patterns: Clear entries on writes, use user-scoped keys for private data, and prefer explicit TTLs to avoid stale data.
  • Use Case: Speed up product listing endpoints with HybridCache GetOrCreateAsync and evict product tags on updates to maintain consistency.

Quick Start

Use the caching skill to add HybridCache with sensible TTLs and Redis L2, then wrap read handlers with GetOrCreateAsync and evict related keys or tags on writes.

Frequently Asked Questions about caching

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

FAQPage Schema
How do I reduce database load and prevent stale reads in a .NET application?

Reduce database load by implementing caching for application data using HybridCache. It provides L1 in-memory and L2 distributed storage with stampede protection and explicit TTLs to prevent stale reads.

What is the best way to cache full HTTP responses and evict them on data mutations?

Output caching caches full HTTP responses for public endpoints and evicts them by tag on mutations. Apply output cache policies with tagging to maintain data consistency during writes.

How do I set up distributed caching with Redis as an L2 layer in .NET 10?

Set up distributed caching by configuring HybridCache with an optional Redis L2 layer. This enables L1 in-memory and L2 distributed caching with built-in stampede protection for read-heavy endpoints.

Does HybridCache provide stampede protection for read-heavy endpoints?

HybridCache provides built-in stampede protection for read-heavy endpoints. Use the GetOrCreateAsync method to safely wrap read handlers and avoid repeated expensive database queries under high concurrency.

When should I use explicit TTLs and cache invalidation for user-scoped data?

Use explicit TTLs and cache invalidation when clearing entries on writes to avoid stale data. Apply user-scoped keys for private data and evict related keys or tags on updates to maintain consistency.

Can I apply output cache policies with tagging for product listing endpoints?

Apply output cache policies with tagging to speed up product listing endpoints. Use HybridCache GetOrCreateAsync for reads and evict product tags on updates to maintain consistency across cached responses.