ZeroCaching 1.0.2
dotnet add package ZeroCaching --version 1.0.2
NuGet\Install-Package ZeroCaching -Version 1.0.2
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="ZeroCaching" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZeroCaching" Version="1.0.2" />
<PackageReference Include="ZeroCaching" />
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 ZeroCaching --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ZeroCaching, 1.0.2"
#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 ZeroCaching@1.0.2
#: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=ZeroCaching&version=1.0.2
#tool nuget:?package=ZeroCaching&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ZeroCaching
ZeroCaching is a lightweight and configurable distributed caching library for .NET applications.
It provides a unified caching abstraction that allows applications to enable, disable, or switch cache providers through configuration without changing application code.
Project Structure
src
└── ZeroCaching
├── ZeroCaching.csproj
├── Abstractions
├── Configuration
├── Factories
├── Services
├── Validation
├── Internals
└── DependencyInjection
Why ZeroCaching?
- Simple integration with existing .NET applications
- Configuration-driven setup
- Supports distributed caching
- Built-in fallback when caching is disabled
- Startup configuration validation
- Dependency Injection friendly
Installation
dotnet add package ZeroCaching
Configuration
ZeroCaching is configured using the appsettings.json file.
This allows you to enable or disable caching and switch providers without changing code.
appsettings.json
{
"Cache": {
"Enabled": true,
"Provider": "Redis",
"ConnectionString": "your-redis-connection-string",
"DefaultExpirationMinutes": 30
}
}
Configuration Options
| Setting | Type | Description |
|---|---|---|
| Enabled | bool | Enables or disables caching globally |
| Provider | string | Cache provider to use (e.g., Redis) |
| ConnectionString | string | Connection string for the selected provider |
| DefaultExpirationMinutes | int | Default expiration time (in minutes) for cached entries |
Example Configuration Scenarios
Disable Caching
{
"Cache": {
"Enabled": false
}
}
Redis Configuration
{
"Cache": {
"Enabled": true,
"Provider": "Redis",
"ConnectionString": "localhost:6379",
"DefaultExpirationMinutes": 60
}
}
Service Registration
builder.Services.AddZeroCaching(builder.Configuration);
Usage
Store Data
await cacheService.SetAsync("product:1", product);
Retrieve Data
var product = await cacheService.GetAsync<Product>("product:1");
Check Existence
var exists = await cacheService.ExistsAsync("product:1");
Remove Data
await cacheService.RemoveAsync("product:1");
How It Works
- Configure caching through
appsettings.json - Register ZeroCaching in application startup
- Inject cache service where needed
- Use caching without worrying about provider-specific logic
Supported Providers
| Provider | Status |
|---|---|
| Redis | Supported |
Benefits
- Easy configuration
- Provider-agnostic usage
- Distributed caching support
- Environment-based configuration
- Clean .NET Dependency Injection integration
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.9)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Options (>= 10.0.9)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.9)
- StackExchange.Redis (>= 3.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.