CachingApp 1.0.0
dotnet add package CachingApp --version 1.0.0
NuGet\Install-Package CachingApp -Version 1.0.0
<PackageReference Include="CachingApp" Version="1.0.0" />
paket add CachingApp --version 1.0.0
#r "nuget: CachingApp, 1.0.0"
// Install CachingApp as a Cake Addin #addin nuget:?package=CachingApp&version=1.0.0 // Install CachingApp as a Cake Tool #tool nuget:?package=CachingApp&version=1.0.0
CachingApp
The idea of this package is to facilitate the use of memory cache, it is just an abstraction that helps the developer to add or remove data in memory, just by making use of an interface.
Dependencies
- .NET6 or >
- Microsoft.Extensions.Caching.Memory
- Microsoft.Extensions.Configuration.Abstractions
- Microsoft.Extensions.DependencyInjection.Abstractions
Installation
Install-Package CachingApp -Version 1.0.0
How to use
Create a .json file in the root of your project with the name ${appsettings.json} and create a configuration:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"Caching" : {
"Customer" : "01:00:00"
}
}
where the "Caching" node must contain the name and the time that the data will be in memory. To use the feature, just add it to the program.cs file
Example
inject ICacheStore in the controller's constructor, on line 23 instantiate the CacheKeyStore class passing the object you intend to put in memory, informing the cache key and the name previously registered in the appsettings.json file. On line 24 try to get the data in memory passing the key, on line 32 if there is no data in memory, it must be added. This way the data is already available in memory from the next request.
License
MIT
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
-
net6.0
- Microsoft.Extensions.Caching.Memory (>= 6.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 6.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.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.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 187 | 8/21/2022 |