IL.InMemoryCacheProvider
2.0.0.2
dotnet add package IL.InMemoryCacheProvider --version 2.0.0.2
NuGet\Install-Package IL.InMemoryCacheProvider -Version 2.0.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="IL.InMemoryCacheProvider" Version="2.0.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IL.InMemoryCacheProvider" Version="2.0.0.2" />
<PackageReference Include="IL.InMemoryCacheProvider" />
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 IL.InMemoryCacheProvider --version 2.0.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: IL.InMemoryCacheProvider, 2.0.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 IL.InMemoryCacheProvider@2.0.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=IL.InMemoryCacheProvider&version=2.0.0.2
#tool nuget:?package=IL.InMemoryCacheProvider&version=2.0.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
InMemory Cache Provider
- Basic implementation of generic in-memory cache provider, based on Microsoft.Extensions.Caching.Memory.
- Comes with set of useful thread safe extensions to get objects from cache or add them with factory.
- Introduces several not supported by default methods, like
IEnumerable<string> GetAllKeys()orvoid DeleteAll(). - Supports tags on cache entries and eviction by tag.
Usage sample:
Register in DI with any container of your preference. Microsoft.Extensions.DependencyInjection will be used in this sample.
services.AddSingleton<ICacheProvider, InMemoryCacheProvider>();
class Test(ICacheProvider cacheProvider)
{
void Foo(CancellationToken cancellationToken = default)
{
var cacheKey = "test";
var cacheTags = ["test1", "test2"];
var valueFromCache = cacheProvider.GetOrAdd(cacheKey,
CacheValueFactory,
tags: cacheTags,
cacheCreationCondition: s => !string.IsNullOrEmpty(s),
expirationOptions: new ExpirationOptions
{
AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(1),
AbsoluteExpiration = DateTimeOffset.Now.AddMinutes(10),
SlidingExpiration = TimeSpan.FromSeconds(30)
},
cancellationToken: cancellationToken);
}
private string CacheValueFactory() => return "test value";
}
Nuget
| 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 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 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
- IL.Misc (>= 1.5.0.2)
- Microsoft.Extensions.Caching.Memory (>= 10.0.3)
-
net8.0
- IL.Misc (>= 1.5.0.2)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
-
net9.0
- IL.Misc (>= 1.5.0.2)
- Microsoft.Extensions.Caching.Memory (>= 9.0.13)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on IL.InMemoryCacheProvider:
| Package | Downloads |
|---|---|
|
IL.RankedCache
Decorator for caching mechanism of your preference allowing to keep track of how many times each entry was accessed, including some manual and automated cleanup possibilities. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0.2 | 128 | 2/23/2026 |
| 2.0.0.1 | 220 | 1/5/2026 |
| 1.4.0 | 1,609 | 4/8/2025 |
| 1.3.0 | 2,275 | 4/5/2024 |
| 1.2.3 | 245 | 3/30/2024 |
| 1.2.2 | 208 | 3/30/2024 |
| 1.2.1 | 214 | 3/29/2024 |
| 1.2.0 | 240 | 3/28/2024 |
| 1.1.2 | 659 | 3/1/2024 |
| 1.1.1 | 372 | 1/16/2024 |
| 1.1.0 | 365 | 11/7/2023 |
| 1.0.4 | 203 | 11/6/2023 |
| 1.0.1 | 307 | 9/16/2023 |
| 1.0.0 | 252 | 9/15/2023 |