caching-dotnet-redis-invalidation

Invalidate local memory caches across ASP.NET Core instances via Redis pub/sub.

12|2|Updated May 4, 2020
One-click install
npx skills add https://github.com/hoangnh2412/jarvis --skill caching-dotnet-redis-invalidation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: caching-dotnet-redis-invalidation
Source: https://github.com/hoangnh2412/jarvis/tree/main/.opencode/skills/caching-dotnet/providers/redis-invalidation
Command: npx skills add https://github.com/hoangnh2412/jarvis --skill caching-dotnet-redis-invalidation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When running multiple instances of an ASP.NET Core application, local memory caches on each node can hold stale data after write operations, leading to inconsistent user experiences and data errors across the cluster.

Core Features & Use Cases

  • Uses a dedicated Redis instance for cache invalidation pub/sub, with no requirement to share the Redis multiplexer with distributed cache groups.
  • Automatically notifies all peer application nodes to clear their local memory cache entries immediately after a write operation, eliminating stale data without manual sync logic.
  • Use Case: A scaled e-commerce backend running multiple ASP.NET Core instances can use this skill to ensure all nodes have the latest product inventory data in their local caches after an inventory update, preventing users from seeing out-of-stock items as available.

Quick Start

Use the caching-dotnet-redis-invalidation skill to configure cross-node memory cache synchronization for your multi-instance ASP.NET Core application using Redis pub/sub.

Frequently Asked Questions about caching-dotnet-redis-invalidation

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

FAQPage Schema
How do I invalidate local memory cache across multiple ASP.NET Core instances?

To invalidate local memory cache across multiple ASP.NET Core instances, you can use Redis pub/sub to automatically notify peer nodes to clear stale entries immediately after a write operation. This ensures cross-node cache consistency without manual sync logic.

Why does my multi-instance ASP.NET Core application serve stale memory cache data after updates?

Your multi-instance ASP.NET Core application serves stale memory cache data because each node maintains an independent local memory cache. Without a synchronization mechanism like Redis pub/sub, updated data is not reflected across the cluster.

Do I need to share my Redis distributed cache multiplexer for memory cache synchronization?

No, you do not need to share your Redis distributed cache multiplexer. This cache invalidation approach uses a dedicated Redis instance specifically for pub/sub notifications, keeping it separate from your distributed cache groups.

What is the best way to automatically clear local memory cache on peer nodes in a distributed backend?

The best way to automatically clear local memory cache on peer nodes in a distributed backend is implementing Redis pub/sub to broadcast invalidation messages. This provides low-overhead, automatic cache consistency across multi-instance applications.

Can I use Redis pub/sub for cross-node cache invalidation without manual sync logic?

Yes, you can use Redis pub/sub for cross-node cache invalidation without manual sync logic. The mechanism automatically notifies all peer application nodes to clear their local memory cache entries immediately after a write operation.