Aspireng.Caching 1.1.3

dotnet add package Aspireng.Caching --version 1.1.3
                    
NuGet\Install-Package Aspireng.Caching -Version 1.1.3
                    
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="Aspireng.Caching" Version="1.1.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aspireng.Caching" Version="1.1.3" />
                    
Directory.Packages.props
<PackageReference Include="Aspireng.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 Aspireng.Caching --version 1.1.3
                    
#r "nuget: Aspireng.Caching, 1.1.3"
                    
#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 Aspireng.Caching@1.1.3
                    
#: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=Aspireng.Caching&version=1.1.3
                    
Install as a Cake Addin
#tool nuget:?package=Aspireng.Caching&version=1.1.3
                    
Install as a Cake Tool

Aspireng.Caching

Features

  • Type-safe, generic cache API
  • Pluggable cache implementations
  • Easy integration with dependency injection
  • Configurable memory limits and expiration

Typical Use Cases

  • Caching data in Blazor server-side or ASP.NET Core applications
  • Reducing expensive computations or I/O by storing results in memory
  • Isolating cache logic behind a simple interface for testability and flexibility

Usage

Register in DI (Host)

// Program.cs
using Aspireng.Caching;

builder.Services.AddIsolatedInMemoryCache(opts =>
{
    // optional tuning; defaults are set by InMemoryCache
    // opts.SizeLimit = 2L * 1024 * 1024 * 1024;
});

From configuration:

{
  "Caching": {
    "InMemory": {
      "SizeLimit": 4294967296,
      "ExpirationScanFrequency": "00:05:00",
      "CompactionPercentage": 0.2
    }
  }
}
builder.Services.Configure<MemoryCacheOptions>(
    builder.Configuration.GetSection("Caching:InMemory"));
builder.Services.AddIsolatedInMemoryCache();

Consume in your code

using Aspireng.Caching;

public class DateFormatPicker(IDistributedLock _lock, IIsolatedCache cache)
{
    public string GetFormatted(string key)
    {
        if (cache.TryGetValue<string>(key, out var value))
            return value!;
        // compute and cache
        var v = "computed";
        cache.Set(key, v, TimeSpan.FromMinutes(10));
        return v;
    }
}
Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Aspireng.Caching:

Package Downloads
Aspireng.Application

Application for repositories and specs.

Aspireng.Data

A comprehensive .NET 9 data access and service layer framework. Features include unified data store abstractions (SQL/File-based), CRUD service patterns with caching, attribute-driven data encryption, dynamic SQL operations, and extensive data manipulation utilities. Supports multiple database providers (SQL Server, SQLite, ODBC) with built-in security, logging, and performance optimizations.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.3 71 8/22/2025
1.1.2 68 8/22/2025
1.1.1 71 8/22/2025
1.0.9 74 8/22/2025
1.0.7 89 8/22/2025
1.0.6 130 8/21/2025