caching-strategy

Define explicit caching strategies for .NET data access with TTL-based invalidation.

Updated Feb 20, 2026
One-click install
npx skills add https://github.com/yeeehaooo/WorkSpace --skill caching-strategy-yeeehaooo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: caching-strategy
Source: https://github.com/yeeehaooo/WorkSpace/tree/main/skills/dotnet/patterns/caching-strategy
Command: npx skills add https://github.com/yeeehaooo/WorkSpace --skill caching-strategy-yeeehaooo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Define explicit caching strategies to manage data access patterns and maintain consistent performance in .NET applications.

Core Features & Use Cases

  • Explicit caching strategies per data access pattern
  • Clear invalidation rules and TTL guidance
  • Strategy interface in Application layer and implementations in Infrastructure (e.g., Redis, in-memory)

Quick Start

Initialize a caching strategy by defining an ICachingStrategy in the Application layer and a concrete RedisCachingStrategy in Infrastructure, then apply it in query handlers to cache frequently accessed data.

Frequently Asked Questions about caching-strategy

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

FAQPage Schema
How do I implement an explicit caching strategy in .NET for read-heavy workloads?

An explicit caching strategy in .NET defines an ICachingStrategy interface in the Application layer and a concrete implementation in Infrastructure, applying pattern-based keys and TTL to manage read-heavy workloads. This enforces separation of concerns while controlling data freshness.

What is the best way to handle cache invalidation and cache-miss scenarios in .NET applications?

Cache invalidation and cache-miss handling in .NET applications are managed through explicit rules defined within the caching strategy. The strategy enforces safe cache-miss handling and explicit invalidation rules to maintain consistent performance and data freshness across varying data volatility.

Can I use Redis and in-memory caching interchangeably with this .NET caching strategy approach?

Yes, the caching strategy approach supports both Redis and in-memory implementations in the Infrastructure layer. By defining an interface in the Application layer, you can swap concrete implementations like RedisCachingStrategy or in-memory caches without altering the application logic.

When should I define separate caching strategies for different data access patterns?

You should define separate caching strategies when dealing with varying data volatility and read-heavy workloads. Explicit strategies per data access pattern ensure controlled invalidation and TTL-based freshness, preventing stale data while optimizing performance for specific query requirements.

How do I structure my .NET project to separate caching strategy interfaces from concrete implementations?

Structure your .NET project by defining caching strategy interfaces in the Application layer and concrete implementations in the Infrastructure layer. This separation of concerns allows query handlers to cache frequently accessed data without coupling application logic to specific cache providers.