Net.Cache
1.3.9
See the version list below for details.
dotnet add package Net.Cache --version 1.3.9
NuGet\Install-Package Net.Cache -Version 1.3.9
<PackageReference Include="Net.Cache" Version="1.3.9" />
<PackageVersion Include="Net.Cache" Version="1.3.9" />
<PackageReference Include="Net.Cache" />
paket add Net.Cache --version 1.3.9
#r "nuget: Net.Cache, 1.3.9"
#:package Net.Cache@1.3.9
#addin nuget:?package=Net.Cache&version=1.3.9
#tool nuget:?package=Net.Cache&version=1.3.9
Net.Cache
Overview
Net.Cache is a comprehensive caching library for .NET, designed to offer versatile tools for cache management.
The library focuses on facilitating key-value based caching operations and provides a default implementation with InMemoryStorageProvider.
It allows for easy integration and extension, enabling developers to use different caching strategies while maintaining a consistent interface.
Features
Generic Caching Mechanism: Supports any data type for keys and values, requiring keys to be equatable and non-nullable.Default In-Memory Caching: IncludesInMemoryStorageProviderfor out-of-the-box in-memory caching.Customizable Storage Providers: Easily extend or implement custom storage providers to suit various caching needs.Retrieval and Management: UtilizeGet,Add,Delete, andUpdatemethods for managing cache contents.Dynamic Cache Management: Efficiently handle caching with the ability to dynamically add or update values when not present usingGetOrAdd.
Getting Started
Installation
Install Net.Cache via the NuGet package manager or clone the repository into your project.
Usage
Implementing Custom Storage Providers
Create custom storage providers by implementing the IStorageProvider<TKey, TValue> interface.
Alternatively, use the provided InMemoryStorageProvider<TKey, TValue>.
var inMemoryStorage = new InMemoryStorageProvider<int, string>();
Using CacheProvider
Manage your caching logic with CacheProvider<TKey, TValue>, which can handle multiple storage providers including custom ones.
var cache = new CacheProvider<int, string>(inMemoryStorage);
Storing, Retrieving, and Managing Values
// Storing a value
cache.Add(1, "Hello World");
// Retrieving a value
string value = cache.Get(1); // Outputs: Hello World
// Updating a value
cache.Update(1, "Updated Value");
// Deleting a value
cache.Delete(1);
Adding Values Dynamically
Leverage the GetOrAdd method to add values to the cache dynamically if they don't already exist, with or without additional parameters.
// Adding a value dynamically without parameters
string value = cache.GetOrAdd(2, () => "New Value");
// Adding a value dynamically with parameters
string complexValue = cache.GetOrAdd(3, x => $"Value with {x.Length} parameters", "param1", "param2");
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Net.Cache:
| Package | Downloads |
|---|---|
|
Net.Cache.DynamoDb
Net.Cache.DynamoDb is a specialized extension of the Net.Cache library, providing an abstract base class for DynamoDB storage providers. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.2 | 473 | 9/25/2025 |
| 2.0.1 | 308 | 9/24/2025 |
| 2.0.0 | 284 | 8/8/2025 |
| 1.3.10 | 944 | 7/22/2025 |
| 1.3.9 | 541 | 7/21/2025 |
| 1.3.7 | 253 | 7/16/2025 |
| 1.3.6 | 229 | 7/16/2025 |
| 1.3.5 | 2,338 | 8/20/2024 |
| 1.3.4 | 442 | 7/10/2024 |
| 1.3.2 | 1,251 | 5/17/2024 |
| 1.3.1 | 526 | 3/20/2024 |
| 1.3.0 | 1,916 | 3/19/2024 |
| 1.1.0 | 1,994 | 1/15/2024 |
| 1.0.0 | 364 | 12/4/2023 |