Chd.Library.Caching
8.0.7
See the version list below for details.
dotnet add package Chd.Library.Caching --version 8.0.7
NuGet\Install-Package Chd.Library.Caching -Version 8.0.7
<PackageReference Include="Chd.Library.Caching" Version="8.0.7" />
paket add Chd.Library.Caching --version 8.0.7
#r "nuget: Chd.Library.Caching, 8.0.7"
// Install Chd.Library.Caching as a Cake Addin #addin nuget:?package=Chd.Library.Caching&version=8.0.7 // Install Chd.Library.Caching as a Cake Tool #tool nuget:?package=Chd.Library.Caching&version=8.0.7
Caching library for .Net Core
Chd (cleverly handle difficulty) library helps you cleverly handle difficulty, writing code fastly and do your application stable.
📝 Table of Contents
🧐 About
I'm computer engineer for 14 years. I wrote this package for caching asp.net core application. This caching machenism is use aspects for simplify 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 8.0 or higher
🔧 Running the tests
The "cache" attribute that we wrote on a simple addition method stores the value of the method in memory for sixty seconds. This method runs after sixty seconds if the parameters in this method have not changed while it is called.
[TestClass]
public class CachingTests
{
static CachingTests()
{
// ==> app.UseRedis(); //In project usings
CachingDependenyInjectionExtensions.UseRedis(null);
}
[TestMethod]
public void Test()
{
Sum(2, 0);
Thread.Sleep(3000);
Sum(2, 0); //Method will not working. Data will get redis cache.
Thread.Sleep(3000);
Sum(2, 0); //Method will not working. Data will get redis cache.
}
[Cache(60)]
public int Sum(int a, int b)
{
return a + b;
}
}
Apsettings Configurations
You must add code below 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
- Mehmet Yoldaş - Linkedin
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. net9.0 was computed. 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. |
-
net8.0
- Chd.Library.Common (>= 8.0.3)
- 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.