CM.RedisCache
1.0.6
dotnet add package CM.RedisCache --version 1.0.6
NuGet\Install-Package CM.RedisCache -Version 1.0.6
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="CM.RedisCache" Version="1.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CM.RedisCache --version 1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CM.RedisCache, 1.0.6"
#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.
// Install CM.RedisCache as a Cake Addin #addin nuget:?package=CM.RedisCache&version=1.0.6 // Install CM.RedisCache as a Cake Tool #tool nuget:?package=CM.RedisCache&version=1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CM.RedisCache for .NET
Project Description
CM.RedisCache is a simple cache library that uses Redis as database, implemented as an extension method over IQueryable interface.
Download & Install
Nuget Package CM.RedisCache
Install-Package CM.RedisCache
Minimum Requirements: .NET Standard 2.0
Usage
C# Example for ASP Net Web API - Configuration
public void ConfigureServices(IServiceCollection services)
{
// Add RedisCache singleton service
services.AddRedisCacheService(Configuration.GetValue<string>("RedisConnection"));
...
}
...
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
...
// Initialize Redis Multiplexer
app.UseRedisCache();
}
C# Example for ASP Net Web API - Usage
[Route("travels")]
[HttpGet]
public async Task<IActionResult> GetTravels()
{
var nations = new String[]
{
"Italy", "France", "Japan"
};
// Query definition
var query = DbContex.Travel.Where(i => i.Enabled == true && nations.Contains(i.Nation));
// Unique query key generated on IQueryable object (used as redis key), only for debug
var key = query.GetCacheKey();
// Cache result for 24 hours automatically in redis
var result = await query.GetFromCacheAsync(24); // pass an int or specific TimeSpan
return Ok(result);
}
Product | Versions 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.1.1)
- Microsoft.EntityFrameworkCore (>= 8.0.3)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
- StackExchange.Redis (>= 2.7.33)
- System.Text.Encodings.Web (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.