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" />
<PackageReference Include="Aspireng.Caching" />
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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
#tool nuget:?package=Aspireng.Caching&version=1.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 | Versions 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.
-
net9.0
- Aspireng.Configuration (>= 1.1.3)
- Microsoft.Extensions.Caching.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Caching.Memory (>= 9.0.8)
- Microsoft.Extensions.Configuration (>= 9.0.8)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.8)
- Microsoft.Extensions.Configuration.CommandLine (>= 9.0.8)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 9.0.8)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.8)
- Microsoft.Extensions.Configuration.Json (>= 9.0.8)
- Microsoft.Extensions.DependencyInjection (>= 9.0.8)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Hosting (>= 9.0.8)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Logging (>= 9.0.8)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Options (>= 9.0.8)
- Microsoft.Extensions.Options.DataAnnotations (>= 9.0.8)
- Microsoft.SourceLink.GitHub (>= 8.0.0)
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.