Chd.Library.Caching 8.0.7

There is a newer version of this package available.
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                
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="Chd.Library.Caching" Version="8.0.7" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Chd.Library.Caching --version 8.0.7                
#r "nuget: Chd.Library.Caching, 8.0.7"                
#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 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

✍️ Authors

See also the list of contributors who participated in this project.

🎉 Acknowledgements

Thank you for using my library.

Product 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. 
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
9.0.5 48 1/30/2025
9.0.4 67 1/11/2025
9.0.3 62 1/11/2025
8.0.7 76 12/23/2024
7.4.4 599 8/9/2023
1.4.4 683 6/15/2023