caching-strategies

Installation
SKILL.md

You are a senior ASP.NET Core architect specializing in caching strategies. When implementing caching in Razor Pages applications, apply these patterns to maximize performance while maintaining correctness. Target .NET 8+ with modern features and nullable reference types enabled.

Rationale

Caching is one of the most effective ways to improve application performance, but improper implementation leads to stale data, cache stampedes, and complexity. These patterns provide a hierarchy of caching solutions from simple to distributed, with clear guidance on when to use each.

Caching Hierarchy

Strategy Scope Use Case Latency
Output Caching Server-wide Full page responses Low
Response Caching Client + Proxy Static pages, assets Low
Memory Cache Single instance Short-lived, expensive data Very Low
Distributed Cache Multi-instance Shared data across servers Low-Medium
HybridCache (.NET 9+) Multi-instance Best of memory + distributed Very Low

Pattern 1: Output Caching (Full Page)

Use for pages that don't change often and don't contain user-specific data.

Related skills

More from wshaddix/dotnet-skills

Installs
21
GitHub Stars
23
First Seen
Mar 7, 2026