Naravel.Cache.Redis
0.2.0
dotnet add package Naravel.Cache.Redis --version 0.2.0
NuGet\Install-Package Naravel.Cache.Redis -Version 0.2.0
<PackageReference Include="Naravel.Cache.Redis" Version="0.2.0" />
<PackageVersion Include="Naravel.Cache.Redis" Version="0.2.0" />
<PackageReference Include="Naravel.Cache.Redis" />
paket add Naravel.Cache.Redis --version 0.2.0
#r "nuget: Naravel.Cache.Redis, 0.2.0"
#:package Naravel.Cache.Redis@0.2.0
#addin nuget:?package=Naravel.Cache.Redis&version=0.2.0
#tool nuget:?package=Naravel.Cache.Redis&version=0.2.0
Naravel.Cache.Redis
Redis cache and distributed-lock providers for Naravel.Cache.
| Fact | Detail |
|---|---|
| Install | dotnet add package Naravel.Cache.Redis |
| Targets | .NET 10 |
| Needs | Naravel.Cache and Naravel.Redis, which NuGet installs with it |
| Client | StackExchange.Redis, through the connections that Naravel.Redis owns |
What you get
- One cache for every instance. Name
"Driver": "redis"in a store, and all instances read and write the same keys. - Distributed locks. Acquisition is an atomic
SET NX, and release compares the token before it deletes. - Flush stays inside the store.
FlushAsyncremoves only the keys under the store'sPrefix. - Counters in one step.
IncrementAsyncwith a TTL sets the first expiry in the same Lua operation. - One connection per server. The store and its lock borrow the connection that
Naravel.Redisowns, and equal connection strings share one.
Quick start
builder.Services.AddNaravelCache(builder.Configuration).AddNaravelRedisCache(builder.Configuration);
{ "Cache": { "Default": "redis", "Stores": { "redis": { "Driver": "redis", "ConnectionString": "localhost:6379" } } } }
Inject ICacheStore as usual; it now reads and writes Redis. When other Naravel modules use the same Redis server, name a shared connection with Connection instead of ConnectionString (see Naravel.Redis).
Related packages
| Package | Adds |
|---|---|
Naravel.Cache |
Named stores, tags, scopes and locks that this provider backs |
Naravel.Redis |
Named, shared Redis connections that the store borrows |
Learn more
- Cache: English guide
- Redis: English guide
- Changelog · Source and issues · MIT license
Part of Naravel: Laravel's names, .NET's type system. All Naravel packages share one version.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.14)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- Naravel.Cache (>= 0.2.0)
- Naravel.Redis (>= 0.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Release notes: https://github.com/km-arc/Naravel/releases/tag/v0.2.0 - full history: https://github.com/km-arc/Naravel/blob/main/CHANGELOG.md