Chd.Library.Caching
8.0.1
dotnet add package Chd.Library.Caching --version 8.0.1
NuGet\Install-Package Chd.Library.Caching -Version 8.0.1
<PackageReference Include="Chd.Library.Caching" Version="8.0.1" />
paket add Chd.Library.Caching --version 8.0.1
#r "nuget: Chd.Library.Caching, 8.0.1"
// Install Chd.Library.Caching as a Cake Addin #addin nuget:?package=Chd.Library.Caching&version=8.0.1 // Install Chd.Library.Caching as a Cake Tool #tool nuget:?package=Chd.Library.Caching&version=8.0.1
Caching library for .Net Core
📝 Table of Contents
🧐 About
I'm computer engineer for 13 years. I wrote this package for caching asp.net core application. This caching machenism is use aspects for sipmlfy code.
🏁 Getting Started
Caching is an important feature that reduces database usage. This package is very simple to use with aspect oriented programming.
Prerequisites
You must use .net core 6.0 or higher
Installing
dotnet add package Chd.Library.Caching --version 1.4.2
🔧 Running the tests
[TestClass]
public class CachingTests
{
static CachingTests()
{
CachingDependenyInjectionExtensions.UseRedis(null);
}
[TestMethod]
public void Test()
{
int a = 4;
Sum(2, 0);
Sum(2, 0);
}
[Cache(60)]
public int Sum(int a, int b)
{
return a + b;
}
}
You must add below code in appsettings.json
"Redis":
{
"Url": "x.x.x.x:pppp"//redis server ip and port
}
Test Result
Add break point in to Sum method. You will see only one times broke down into method. Other call is brought from redis server.
🎈 Usage
Firtly you must call UseRedis method ("app.UseRedis();") in the program.cs file. You must use Cache attribute on method whice you want to cache return value of method. Cache attribute takes a parameter that cache time in seconds
⛏️ Built Using
- Redis - Redis server
✍️ Authors
- @yoldasmehmet - Idea & Initial work
See also the list of contributors who participated in this project.
🎉 Acknowledgements
Thank you for using my library.
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. |
-
net8.0
- Chd.Library.Common (>= 8.0.1)
- MethodBoundaryAspect.Fody (>= 2.0.149)
- Serilog.Settings.Configuration (>= 8.0.0)
- StackExchange.Redis (>= 2.7.17)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.