Infrastructure.Caching 1.0.1

dotnet add package Infrastructure.Caching --version 1.0.1
                    
NuGet\Install-Package Infrastructure.Caching -Version 1.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="Infrastructure.Caching" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Infrastructure.Caching" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Infrastructure.Caching" />
                    
Project file
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 Infrastructure.Caching --version 1.0.1
                    
#r "nuget: Infrastructure.Caching, 1.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 Infrastructure.Caching@1.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=Infrastructure.Caching&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Infrastructure.Caching&version=1.0.1
                    
Install as a Cake Tool

About

The package is designed for caching data in .NET applications.

How to Use

ICacheService<string, string> сacheService = new MemoryCacheService<string, string>(new MemoryCache(new MemoryCacheOptions()));
var absoluteExpiration = new DateTimeOffset(DateTime.UtcNow.AddMinutes(10));
var key = "key1";
var value = "value1";
var message = string.Empty;

сacheService.Set(key, value, absoluteExpiration);        //Added a value to the cache for the key.

if (сacheService.TryGetValue(key, out var cachedValue))  //Getting the value from the cache by key.
{
    message = $"The cached value is '{cachedValue}'";
}
else
{
    message = "The key value is missing from the cache.";
}

Console.WriteLine(message);

сacheService.Remove(key);                               //Deleting a value from the cache by key.

Main Types

The main types provided by this library are:

Infrastructure.Caching.Services.ICacheService<in TKey, TValue>
Infrastructure.Caching.Services.MemoryCacheService<TKey, TValue>

Feedback & Contributing

Infrastructure.Caching is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Product Compatible and additional computed target framework versions.
.NET 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 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.

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
1.0.1 17 7/19/2025
1.0.0 139 6/2/2025