caching-strategies

Implement caching strategies across ASP.NET Core services to reduce API latency.

4|1|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill caching-strategies-faysilalshareef
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: caching-strategies
Source: https://github.com/FaysilAlshareef/dotnet-ai-kit/tree/main/skills/api/caching-strategies
Command: npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill caching-strategies-faysilalshareef

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Caching is essential to reduce latency and scale .NET APIs. This skill consolidates patterns for output caching, response caching, distributed caches, and HybridCache to balance speed, consistency, and resource usage.

Core Features & Use Cases

  • Output Caching: Server-side caches entire HTTP responses for fast repeated GETs.
  • Response Caching: Client and intermediary caches controlled via Cache-Control headers.
  • Distributed Cache: Centralized caches across app instances using IDistributedCache (e.g., Redis, SQL Server).
  • HybridCache (.NET 9+): Two-tier caching with local and distributed layers and stampede protection.
  • ETag / Conditional Requests: Reduce payloads with meaningful 304 responses.
  • Cache Invalidation: Tag-based, event-based, TTL-based, and manual eviction strategies to keep data fresh.
  • Use cases include read-heavy APIs, catalogs, and high-traffic services needing low-latency responses.

Quick Start

Enable the caching patterns in a sample ASP.NET Core API and verify performance improvements.

Frequently Asked Questions about caching-strategies

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

FAQPage Schema
What is the best way to implement distributed caching in ASP.NET Core?

Distributed caching in ASP.NET Core uses IDistributedCache with centralized providers like Redis or SQL Server to maintain cache consistency across multiple app instances, reducing API latency for high-traffic workloads.

How does HybridCache work in .NET 9 to prevent cache stampedes?

HybridCache in .NET 9 implements a two-tier caching architecture with local and distributed layers. It provides built-in stampede protection to balance speed and data consistency while optimizing resource usage during concurrent API requests.

When should I use output caching versus response caching in an ASP.NET Core API?

Use output caching for server-side caching of entire HTTP responses to speed up repeated GETs. Use response caching to control client and intermediary caches via Cache-Control headers, managing payloads with ETag and conditional 304 responses.

How do I handle cache invalidation across multi-instance ASP.NET Core deployments?

Cache invalidation across multi-instance deployments utilizes tag-based, event-based, TTL-based, and manual eviction strategies to ensure distributed cache freshness and maintain low-latency API responses.

Does ASP.NET Core support ETag conditional requests for reducing API payload sizes?

ASP.NET Core supports ETag and conditional requests to meaningfully reduce API payload sizes. By returning 304 Not Modified responses when cached data remains valid, servers minimize bandwidth and improve response times.