CasCap.Common.Caching 4.8.1

Prefix Reserved
dotnet add package CasCap.Common.Caching --version 4.8.1
                    
NuGet\Install-Package CasCap.Common.Caching -Version 4.8.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CasCap.Common.Caching" Version="4.8.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CasCap.Common.Caching" Version="4.8.1" />
                    
Directory.Packages.props
<PackageReference Include="CasCap.Common.Caching" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CasCap.Common.Caching --version 4.8.1
                    
#r "nuget: CasCap.Common.Caching, 4.8.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CasCap.Common.Caching@4.8.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CasCap.Common.Caching&version=4.8.1
                    
Install as a Cake Addin
#tool nuget:?package=CasCap.Common.Caching&version=4.8.1
                    
Install as a Cake Tool

CasCap.Common.Caching

Multi-tier distributed caching library implementing the cache-aside pattern with support for Memory, Disk, and Redis cache layers.

Purpose

Provides a complete caching infrastructure with local (in-process) and remote (Redis) cache tiers, synchronised expiration via Redis Pub/Sub, and configurable serialization (JSON or MessagePack). Includes background services for cache expiry management and an async duplicate-lock mechanism to prevent thundering-herd scenarios.

Target frameworks: netstandard2.0, net8.0, net9.0, net10.0

Services

Service Description
DistributedCacheService Multi-tier cache orchestrator — reads from local first, falls back to Redis, and populates both tiers on miss
RedisCacheService IRemoteCache implementation wrapping StackExchange.Redis with optional Lua script support
MemoryCacheService ILocalCache implementation backed by IMemoryCache
DiskCacheService ILocalCache implementation persisting cache entries to disk
CacheExpiryBgService Background service coordinating expiry synchronisation between local and remote caches
LocalCacheExpiryService Handles local cache entry expiration
RemoteCacheExpiryService Handles remote cache entry expiration

Extensions

Extension Description
ServiceCollectionExtensions.AddCasCapCaching() Registers all caching services into the DI container
CachingExtensions Helper methods for cache key formatting and serialization
AsyncDuplicateLock Prevents duplicate concurrent cache population for the same key

Configuration

Type Description
CachingConfig Main configuration record — PubSubPrefix, MemoryCacheSizeLimit, UseBuiltInLuaScripts, DiskCacheFolder, ExpirationSyncMode
CacheParameters Per-layer cache configuration (TTL, size limits)

Enums

Enum Values
CacheType None, Memory, Disk, Redis
SerializationType None, Json, MessagePack
ExpirationSyncType None, ExpireViaPubSub, ExtendRemoteExpiry

Dependencies

NuGet Packages

Package
StackExchange.Redis
Microsoft.Extensions.Configuration.Json
Microsoft.Extensions.Caching.Memory

Project References

Project Purpose
CasCap.Common.Abstractions ILocalCache, IAppConfig contracts
CasCap.Common.Extensions General-purpose helper utilities
CasCap.Common.Serialization.Json JSON serialization for cache values
CasCap.Common.Serialization.MessagePack MessagePack serialization for cache values
CasCap.Common.Logging ApplicationLogging static logger factory
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.8.1 119 4/2/2026
4.8.0 150 4/1/2026
4.7.1 222 3/13/2026
4.7.0 98 3/11/2026
4.6.0 290 2/12/2026
4.5.5 114 2/2/2026
4.5.4 176 1/25/2026
4.5.3 487 12/11/2025
4.5.1 389 11/12/2025
4.5.0 360 11/11/2025
4.4.0 240 11/1/2025
4.3.12 287 10/19/2025
4.3.11 357 10/10/2025
4.3.10 315 10/6/2025
4.3.9 341 9/30/2025
4.3.8 255 9/14/2025
4.3.7 292 8/13/2025
4.3.6 436 8/7/2025
4.3.5 391 7/9/2025
4.3.4 456 6/13/2025
Loading failed