DSoft.CacheManager
1.1.2412.11
.NET 8.0
This package targets .NET 8.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
dotnet add package DSoft.CacheManager --version 1.1.2412.11
NuGet\Install-Package DSoft.CacheManager -Version 1.1.2412.11
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="DSoft.CacheManager" Version="1.1.2412.11" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DSoft.CacheManager --version 1.1.2412.11
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DSoft.CacheManager, 1.1.2412.11"
#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.
// Install DSoft.CacheManager as a Cake Addin #addin nuget:?package=DSoft.CacheManager&version=1.1.2412.11 // Install DSoft.CacheManager as a Cake Tool #tool nuget:?package=DSoft.CacheManager&version=1.1.2412.11
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DSoft.CacheManager
Managed .NET cache management framework for .NET Standard 2.0 and .NET 6 or .NET 8
Features
- Works on all platforms that support .NET Standard 2.0, .NET 6 or .NET 8
- Extendable to add different backends for storing the cached data
- LiteDb provider is available with more to come
- Designed to work with Microsoft's standard Dependency Injection mechanism
- Factory class is provided if you don't use DI
- async/await compatible
Usage
To use CacheManager you need to add packages DSoft.CacheManager
and your preferred backend such as DSoft.CacheManager.LiteDB
Dependency Injection
Call RegisterCacheManager<T>
, where T
is the backend implementation, to register the cache manager
using DSoft.CacheManager;
using DSoft.CacheManager.LiteDB;
private void ConfigureServices(IConfiguration configuration, IServiceCollection services)
{
services.RegisterCacheManager<LiteDbBackend>();
}
Consume
You can inject ICacheManager
into your services or you can use CacheManagerFactory.Create
to create an instance manually.
var cacheManager = ServiceHost.GetRequiredService<ICacheManager>();
var dataKey = typeof(SomeData).Name;
await cacheManager.LoadAsync(); // optionally pre-warm the cache
var items = new List<SomeData>()
{
new SomeData() { Id = 1, Name = "One", IsEnabled = true },
new SomeData() { Id = 2, Name = "Two", IsEnabled = false },
new SomeData() { Id = 3, Name = "Three", IsEnabled = true },
new SomeData() { Id = 4, Name = "Four", IsEnabled = false },
};
var exists = cacheManager.IsKeyRegistered(dataKey);
if (exists)
{
var ogItems = cacheManager.GetItems<SomeData>(dataKey);
var count = ogItems.Count;
}
cacheManager.SetItems(dataKey, items);
var itemsOut = cacheManager.GetItems<SomeData>(dataKey);
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 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 is compatible. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
-
net8.0
-
net9.0
NuGet packages (1)
Showing the top 1 NuGet packages that depend on DSoft.CacheManager:
Package | Downloads |
---|---|
DSoft.CacheManager.LiteDB
LiteDB backend for DSoft.CacheManager |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.2412.11 | 109 | 12/1/2024 |
1.1.2406.221 | 159 | 6/22/2024 |
1.0.2107.222-prerelease | 403 | 7/22/2021 |
1.0.2107.221-prerelease | 226 | 7/22/2021 |
1.0.2107.203-prerelease | 202 | 7/20/2021 |
1.0.2107.201-prerelease | 241 | 7/20/2021 |