NICWebApi.Extensions.Caching 1.0.41

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

NICWebApi.Extensions.Caching

缓存扩展包。默认注册内存缓存;启用 Redis 或应用已注册 IDistributedCache 时,ICacheService 会优先使用分布式缓存。

使用

builder.Services.AddCaching();

var value = await cache.GetOrSetAsync("users:1", _ => LoadUserAsync(1));

启用 Redis:

builder.Services.AddCaching(options => options.UseRedis("localhost:6379", "my-app:"));

配置

{
  "Caching": {
    "KeyPrefix": "my-app",
    "DefaultExpiration": "00:20:00",
    "Redis": {
      "Enabled": false,
      "Configuration": "localhost:6379",
      "InstanceName": "my-app:"
    }
  }
}

Redis.Enabled 默认是 false。启用后会注册 Microsoft.Extensions.Caching.StackExchangeRedisIDistributedCache

更多配置边界见 ../docs/Configuration.md

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NICWebApi.Extensions.Caching:

Package Downloads
NICWebApi.Extensions.AspNetCore

NICWebApi ASP.NET Core 一键集成扩展包,组合 DynamicAPI、RESTfulResult、JWT、Mapper、DependencyInjection、Http、RemoteRequest、Caching、Idempotency、Schedule、Messaging 和 OperationLogging 的默认注册。

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.41 147 7/7/2026