SunnyMehr.CacheManager 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package SunnyMehr.CacheManager --version 1.0.0                
NuGet\Install-Package SunnyMehr.CacheManager -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="SunnyMehr.CacheManager" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SunnyMehr.CacheManager --version 1.0.0                
#r "nuget: SunnyMehr.CacheManager, 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 SunnyMehr.CacheManager as a Cake Addin
#addin nuget:?package=SunnyMehr.CacheManager&version=1.0.0

// Install SunnyMehr.CacheManager as a Cake Tool
#tool nuget:?package=SunnyMehr.CacheManager&version=1.0.0                
  1. Add a class library to your solution

  2. Download and install SunnyMehr Cache Manager from link below:

  3. Add ICacheManager interface and CacheManger to class library in order to define customized Add or Get method based on specific Data Model. For example:

     public async Task AddTestAsync(string key, string testString)
     {
         try
         {
             if (_enableLocalCache) _memoryCacheManager.Add(key, testString);
             if (_enableRedisCache) await _redisManager.AddAsync(key, testString);
         }
         catch (Exception exception)
         {
             _ = Task.Run(() =>
                 _logger.LogError(EventTool.GetEvent(SystemEvent.GlobalCacheManager, "AddTestAsync"),
                     exception, exception.Message));
         }
     }`
    
     public async Task<string> GetITestAsync(string key)
     {
         try
         {
             return (_enableLocalCache ? _memoryCacheManager.Get<string>(key) : null) ??
                    (_enableRedisCache ? await _redisManager.GetAsync<string>(key) : string.Empty);
         }
         catch (Exception exception)
         {
             _ = Task.Run(() => _logger.LogError(EventTool.GetEvent(SystemEvent.GlobalRedis, "GetInstrumentAsync"),
                 exception, exception.Message));
             return string.Empty;
         }
     }`
    
  4. Add following codes in Program before builder.Build(): builder.Services.AddCacheManagerDependencyInjections(); builder.Services.AddSingleton<ICacheManager, CacheManager>();

  5. Add following section to appSettings file:

      "DistributedCacheSettings": {
          "EnableLocalCache": false,
          "EnableDistributedCache": true,
          "CacheExpireTotalMinutes": 10,
          "RedisConfiguration": {
            "AbortOnConnectFail": true,
            "MaxValueLength": 0,
            "PoolSize": 100,
            "KeyPrefix": "",
            "ConnectTimeout": 10000,
            "SyncTimeout": 20000,
            "Database": 0,
            "Hosts": [
              {
                "Host": "172.26.96.2",
                "Port": "6379"
              }
            ],
            "ServerEnumerationStrategy": {
              "Mode": 0, //ALl = 0, Single = 1
              "TargetRole": 0, // Any = 0, PreferSlave = 1
              "UnreachableServerAction": 0 //Throw =0, IgnoreIfOtherAvailable = 1
            },
            "ConfigurationOptions": {
              "Password": "",
              "AbortOnConnectFail": true,
              "AllowAdmin": true,
              "Ssl": false,
              "ConnectTimeout": 10000,
              "SyncTimeout": 20000,
              "AsyncTimeout": 20000,
              "ConnectRetry": 10,
              "DefaultDatabase": 0,
              "ServiceName": "", // In case you are using Sentinel
              "SocketManager": {
                "Name": "MySocketManager",
                "WorkerCount": 100,
                "SocketManagerOptions": 2 //None = 0, UseHighPrioritySocketThreads = 1, UseThreadPool = 2 
              }
            }
          }
        }
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 (1)

Showing the top 1 NuGet packages that depend on SunnyMehr.CacheManager:

Package Downloads
SunnyMehr.HealthMonitor

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.0 304 2/24/2024
2.2.4 197 1/9/2024
2.2.3 113 1/9/2024
2.2.2 442 8/17/2023
2.2.1 437 7/27/2023
2.2.0 265 7/7/2023
2.1.9 856 10/13/2022
2.1.8 681 9/20/2022
2.1.7 478 9/14/2022
2.1.6 460 9/14/2022
2.1.5 486 9/14/2022
2.1.4 492 9/14/2022
2.1.3 432 9/10/2022
2.1.2 428 9/10/2022
2.1.1 1,225 8/2/2022
2.1.0 575 7/26/2022
2.0.4 470 7/16/2022
2.0.3 456 7/16/2022
2.0.2 428 7/16/2022
2.0.1 432 7/16/2022
2.0.0 1,098 1/23/2022
1.0.1 600 1/23/2022
1.0.0 288 12/28/2021