Spincity.RedisCache
9.0.2
dotnet add package Spincity.RedisCache --version 9.0.2
NuGet\Install-Package Spincity.RedisCache -Version 9.0.2
<PackageReference Include="Spincity.RedisCache" Version="9.0.2" />
<PackageVersion Include="Spincity.RedisCache" Version="9.0.2" />
<PackageReference Include="Spincity.RedisCache" />
paket add Spincity.RedisCache --version 9.0.2
#r "nuget: Spincity.RedisCache, 9.0.2"
#:package Spincity.RedisCache@9.0.2
#addin nuget:?package=Spincity.RedisCache&version=9.0.2
#tool nuget:?package=Spincity.RedisCache&version=9.0.2
Spincity Redis Cache
Spincity.RedisCache contains an implementation for caching, retrieving and removing keys from a Redis database.
Register the Redis Cache in the Startup.cs file of your project as shown below:
public void ConfigureServices(IServiceCollection services)
{
services.AddRedisCache(options =>
{
options.RegisterInstance(new MultiplexerCacheOptions()
{
ConfigurationOptions = new ConfigurationOptions()
{
EndPoints =
{
Configuration.GetConnectionString("RedisMultiplexerCacheConnection") ?? string.Empty
},
AllowAdmin = true
},
DatabaseIndex = 0
});
options.DistributedCacheOptions = new RedisCacheOptions()
{
Configuration = Configuration.GetConnectionString("RedisDistributedCacheConnection"),
InstanceName = platform,
};
});
...
}
options.RegisterInstance
is used to register the Redis Multiplexer Cache. The ConfigurationOptions is used to set the Redis connection string and the DatabaseIndex is used to set the database index.
options.DistributedCacheOptions
is used to register the Redis Distributed Cache. The Configuration is used to set the Redis connection string and the InstanceName is used to set the instance name.
How to use (with examples)
private readonly ICacheDistributedService _cacheDistributedService;
private readonly ICacheMultiplexerService _cacheMultiplexerService;
public YourService(ICacheDistributedService cacheDistributedService, ICacheMultiplexerService cacheMultiplexerService)
{
_cacheDistributedService = cacheDistributedService;
_cacheMultiplexerService = cacheMultiplexerService;
}
public async Task<string> GetCacheValueMultiplexer(string key)
{
await _cacheMultiplexerService.GetHashAsync<BetCacheData>("key", databaseIndex: 0);
}
public async Task SetCacheValueMultiplexer(string key, string value)
{
await _cacheMultiplexerService.SetHashAsync("key", new SomeObject() { Value1 = "value1" },TimeSpan.FromDays(7), databaseIndex: 0);
await _cacheMultiplexerService.SetStringAsync("key", "somestring", TimeSpan.FromDays(7), databaseIndex: 0);
}
public async Task GetSetValueDistributedCache(string key)
{
await _cacheService.GetDataAsync<GetGamesResult>("key", () => SomeMethod(), new string[] { }, TimeSpan.FromHours(2));
}
...
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. |
-
net9.0
- Microsoft.Extensions.Caching.Abstractions (>= 9.0.5)
- Microsoft.Extensions.Caching.StackExchangeRedis (>= 9.0.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.5)
- Microsoft.Extensions.DependencyInjection (>= 9.0.5)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.5)
- Newtonsoft.Json (>= 13.0.3)
- Polly (>= 8.5.2)
- StackExchange.Redis (>= 2.8.37)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Spincity.RedisCache:
Package | Downloads |
---|---|
Spincity.Tools
Helper to be used with Spincity.RedisCache package |
|
Spincity.RedisCache.Helpers
Helper to be used with Spincity.RedisCache package |
|
Spincity.IdempotentRequestHandler
Idempotent Request Handler customized for Spincity Solutions |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated | |
---|---|---|---|
9.0.2 | 877 | 7/30/2025 | |
9.0.1 | 170 | 7/30/2025 | |
2.1.3 | 3,169 | 5/21/2025 | |
2.1.2 | 6,631 | 1/14/2025 | |
2.1.1 | 290 | 1/14/2025 | |
2.1.0 | 4,182 | 1/13/2025 | |
2.0.1 | 215 | 1/10/2025 | |
2.0.0 | 186 | 1/7/2025 | |
1.0.8 | 153 | 1/6/2025 | |
1.0.6 | 687 | 12/19/2024 | |
1.0.5 | 1,525 | 11/4/2024 | |
1.0.4 | 154 | 11/4/2024 | |
1.0.3 | 2,416 | 7/26/2024 | |
1.0.2 | 152 | 7/25/2024 | |
1.0.1 | 152 | 7/25/2024 | |
1.0.0 | 874 | 7/16/2024 |
Add new method HasKeyAsync to check if a key exists in the cache