MinIO-IDistributedCache
0.0.1
dotnet add package MinIO-IDistributedCache --version 0.0.1
NuGet\Install-Package MinIO-IDistributedCache -Version 0.0.1
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="MinIO-IDistributedCache" Version="0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MinIO-IDistributedCache" Version="0.0.1" />
<PackageReference Include="MinIO-IDistributedCache" />
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 MinIO-IDistributedCache --version 0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MinIO-IDistributedCache, 0.0.1"
#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 MinIO-IDistributedCache@0.0.1
#: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=MinIO-IDistributedCache&version=0.0.1
#tool nuget:?package=MinIO-IDistributedCache&version=0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MinIO Distributed Cache for ASP.NET Core
A high-performance distributed cache implementation for ASP.NET Core using MinIO object storage.
Overview
This library provides an IDistributedCache
implementation that uses MinIO, an S3-compatible object storage, as its backend. It's designed to be a scalable and reliable caching solution for distributed applications.
Features
- S3-Compatible Storage: Works with MinIO and any S3-compatible storage services
- Fallback Cache: Optional in-memory fallback cache for improved resilience
- Expiration Support: Handles both absolute and sliding expiration policies
- Thread-Safe: Safe for concurrent access from multiple threads or processes
- Simple Configuration: Easy to set up with dependency injection
Installation
dotnet add package MinioDistributedCache
Quick Start
1. Register the service in your Program.cs
or Startup.cs
:
builder.Services.AddMinioDistributedCache(options =>
{
options.Endpoint = "minio:9000";
options.AccessKey = "minioadmin";
options.SecretKey = "minioadmin";
options.BucketName = "aspnetcore-cache";
options.UseSSL = false;
options.UseFallbackCache = true; // Use in-memory fallback if MinIO is unavailable
});
2. Use the distributed cache in your application:
public class WeatherForecastController : ControllerBase
{
private readonly IDistributedCache _cache;
private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(
IDistributedCache cache,
ILogger<WeatherForecastController> logger)
{
_cache = cache;
_logger = logger;
}
[HttpGet]
public async Task<IActionResult> Get()
{
// Try to get from cache
var cachedData = await _cache.GetStringAsync("WeatherForecast");
if (cachedData != null)
{
_logger.LogInformation("Returning cached weather data");
return Ok(JsonSerializer.Deserialize<WeatherForecast[]>(cachedData));
}
// Cache miss - generate new data
var forecast = GenerateForecasts();
// Cache the result
await _cache.SetStringAsync(
"WeatherForecast",
JsonSerializer.Serialize(forecast),
new DistributedCacheEntryOptions
{
AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(10)
});
return Ok(forecast);
}
}
Configuration Options
Option | Description | Default |
---|---|---|
Endpoint |
MinIO server endpoint | "" |
AccessKey |
MinIO access key | "" |
SecretKey |
MinIO secret key | "" |
BucketName |
Bucket name for cache storage | "aspnetcore-distributed-cache" |
UseSSL |
Whether to use SSL for MinIO connection | false |
Region |
MinIO region (optional) | null |
UseFallbackCache |
Whether to use in-memory fallback cache | true |
Performance Considerations
- The MinIO distributed cache is optimized for medium to large cache values
- The fallback cache is used only when MinIO operations fail, providing resilience to temporary storage issues
- Consider using a CDN for public assets instead of the distributed cache
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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. net9.0 was computed. 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.
-
net8.0
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.DependencyInjection (>= 8.0.1)
- Microsoft.Extensions.Logging (>= 8.0.1)
- Minio (>= 6.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
0.0.1 | 187 | 8/28/2025 |