in-memory-caching

Community

Speed up .NET apps with in-memory caching

AuthorXentinus
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This skill addresses the repetitive, expensive data access patterns by providing a production-ready in-memory caching layer for .NET applications, reducing database load and latency while enabling responsive user experiences.

Core Features & Use Cases

  • Thread-safe storage: Uses ConcurrentDictionary to store and retrieve cached entities with minimal contention.
  • Database-driven invalidation: Leverages a TableRecordChanges mechanism and background refresh to ensure cache coherence across changes.
  • Background management: Includes a CacheManagementService that initializes caches on startup and processes invalidations periodically.
  • Database support and hybrid options: Supports PostgreSQL and MSSQL with optional Redis-based two-level caching for even faster access or pure in-memory caching when Redis is unavailable or undesired.
  • Usage scenarios: Ideal for read-heavy workloads, paging, and hot data like reference lookups, where stale data is acceptable within configured TTLs.

Quick Start

  • Wire up CacheManagementService in your ASP.NET Core app, register your cache function classes, and configure your database adapters.
  • Ensure you have the necessary NuGet packages (Microsoft.Extensions.Caching.StackExchangeRedis for Redis, Microsoft.EntityFrameworkCore for querying) and a DbContext for your entities.
  • Run the application and observe initialization logs; your primary caches will be populated and refreshed automatically.

Dependency Matrix

Required Modules

None required

Components

scriptsreferences

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: in-memory-caching
Download link: https://github.com/Xentinus/ai-toolbox/archive/main.zip#in-memory-caching

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.