CachingApp 1.0.0

dotnet add package CachingApp --version 1.0.0
NuGet\Install-Package CachingApp -Version 1.0.0
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="CachingApp" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CachingApp --version 1.0.0
#r "nuget: CachingApp, 1.0.0"
#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 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

Build Status

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

nuget CachingApp

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

Capture

Example

Capture

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 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. 
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.0 175 8/21/2022