caching

Implement HybridCache with invalidation and output caching for .NET 10 applications.

1|Updated Mar 27, 2026
One-click install
npx skills add https://github.com/Maj3D10/Training-Platform --skill caching-maj3d10
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: caching
Source: https://github.com/Maj3D10/Training-Platform/tree/main/.agent/skills/caching
Command: npx skills add https://github.com/Maj3D10/Training-Platform --skill caching-maj3d10

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you reduce latency and database load by caching read operations while preventing stale data, stampedes, and inefficient caching behavior.

Core Features & Use Cases

  • HybridCache-based read caching: Uses .NET’s HybridCache to combine local and distributed caching with built-in stampede protection.
  • Cache invalidation on mutations: Removes or evicts cached entries when data changes to keep results consistent.
  • Output caching for whole HTTP responses: Caches full endpoint responses when the entire payload can be safely reused (often for public/static-like data).

Use case: When building a products API, cache GET /products/{id} lookups with HybridCache for fast reads, evict the specific key after PUT /products/{id} updates, and optionally cache GET / or list endpoints at the response level using output caching.

Quick Start

Load this caching skill and implement HybridCache GetOrCreateAsync for your read endpoints, then add targeted invalidation or tag eviction on your write endpoints.

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 after data mutations?

HybridCache in .NET provides built-in stampede protection by coalescing concurrent cache misses for the same key. This mechanism prevents multiple identical database queries from executing simultaneously when a cache entry expires.

What is the best way to cache HTTP responses in a .NET application?

Output caching caches full HTTP endpoint responses when the entire payload can be safely reused. It is best applied to public or static-like data endpoints where the complete response can be served without user-specific modifications.

Does HybridCache support distributed caching scenarios in .NET?

HybridCache supports distributed caching by combining local and distributed cache layers in .NET applications. This hybrid approach reduces latency while maintaining data consistency across multiple server instances.

How do I set explicit TTLs and eviction policies to avoid stale cached data?

Setting explicit TTLs and safe eviction policies involves defining precise expiration times for cached entries and configuring removal triggers. This ensures cached data is automatically purged before becoming stale or serving user-specific data incorrectly.

When should I not use output caching for API endpoints?

You should not use output caching for endpoints returning user-specific or frequently mutating data. If the payload cannot be safely reused across all requests, applying response-level caching risks serving incorrect personalized data.