ZayniFramework.Caching 2.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ZayniFramework.Caching --version 2.3.0
                    
NuGet\Install-Package ZayniFramework.Caching -Version 2.3.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="ZayniFramework.Caching" Version="2.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZayniFramework.Caching" Version="2.3.0" />
                    
Directory.Packages.props
<PackageReference Include="ZayniFramework.Caching" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ZayniFramework.Caching --version 2.3.0
                    
#r "nuget: ZayniFramework.Caching, 2.3.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.
#:package ZayniFramework.Caching@2.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ZayniFramework.Caching&version=2.3.0
                    
Install as a Cake Addin
#tool nuget:?package=ZayniFramework.Caching&version=2.3.0
                    
Install as a Cake Tool

CacheManager example.

Add namespace using.

using ZayniFramework.Caching;
using ZayniFramework.Common;

Add CachingSettings config section in your app.config or web.config file.


<CachingSettings managerMode="Redis">
    <CachePool resetEnable="true" cleanerIntervalSecond="3" maxCapacity="10000" refreshIntervalMinute="1" />
    <CacheData timeoutInterval="0" />
    <RedisCache>
        <add name="XXXRedisService" isDefault="true" dbActionLog="true" host="XXX.XXX.XXX.XXX" port="6379" account="" password="" dbNumber="10" connectTimeout="1000" responseTimeout="3500" />
        
    </RedisCache>
    <RemoteCache defaultCacheClientName="RemoteCacheTest1"></RemoteCache>
    
</CachingSettings>

Put data into CacheManager. Use CacheManager.Put() static method.

public void PutDataTest()
{
    string key = "somekey";

    var model = new
    {
        Name   = "Amber",
        Age    = 23,
        Sex    = "F",
        Emails = new List<string>()
        {
            "amber@gmail.com",
            "amber@hotmail.com"
        },
        Profile = new
        {
            Token   = Guid.NewGuid().ToString(),
            DoB     = new DateTime( 1998, 2, 14 ),
            Comment = "Hello, this is Amber."
        }
    };

    var cacheProp = new CacheProperty()
    {
        CacheId         = key,
        Data            = model,
        RefreshCallback = () => new
        {
            Name   = "Belle Claire",
            Age    = 23,
            Sex    = "F",
            Emails = new List<string>()
            {
                "belle.claire@gmail.com",
                "belle.claire@hotmail.com"
            },
            Profile = new
            {
                Token   = Guid.NewGuid().ToString(),
                DoB     = new DateTime( 1998, 2, 14 ),
                Comment = "Hi"
            }
        }
    };

    bool success = CacheManager.Put( cacheProp );
    Assert.IsTrue( success );
}

Put data into CacheManager in a HashProperty data structure.<br/> Get HashProperty data from CacheManager.

var hashs = new HashProperty[] 
{
    new HashProperty( "a1", "Hello Fiona!" ),
    new HashProperty( "a2", true ),
    new HashProperty( "a3", new DateTime( 2018, 2, 7 ) ),
    new HashProperty( "a4", 45.26 ),
    new HashProperty( "a5", 500 ),
    new HashProperty( "a6", 3333.77M ),
};

bool success = CacheManager.PutHashProperty( "aaa", hashs );

var a1 = CacheManager.GetHashProperty( "aaa", "a1" );
Assert.AreEqual( "Hello Fiona", a1.Data + "" );

var a2 = CacheManager.GetHashProperty( "aaa", "a2" );
Assert.AreEqual( true, Convert.ToBoolean( a2.Data + "" ) );

var a3 = CacheManager.GetHashProperty( "aaa", "a3" );
Assert.AreEqual( new DateTime( 2018, 2, 7 ), Convert.ToDateTime( a3.Data ) );

// Get all hash properties with the main cacheId.
var gp = CacheManager.GetHashProperties( "aaa" );

Put and Get data with CacheManager.

var model = new UserTestModel()
{
    Name = "Amber",
    Age  = 23,
    Sex  = "F"
};

bool success = CacheManager.Put( new CacheProperty() { CacheId = "test02", Data = model } );
var r = CacheManager.Get<UserTestModel>( "test02" );

Clear all the data in CacheManager. User CacheManager.Clear() static method.

CacheManager.Clear();

More detail sample code. You can go to Test/UnitTests/Zayni.Caching.Test directory.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on ZayniFramework.Caching:

Package Downloads
ZayniFramework.DataAccess.LightORM

This is a lightweight CRUD ORM template for .NET data access application. You can use the DataContext to execute Insert, Update, Delete and Select action to database. Currently only support the MSSQL and MySQL database. GitLab Repository: https://gitlab.com/ponylin1985/zayniframework

ZayniFramework.Caching.RemoteCache

This is a ZayniFramework build-in Remote Share Data Service. You can use the ZayniFramework.Caching module to store data into this service. Also it support telnent service commands. GitLab Repository: https://gitlab.com/ponylin1985/ZayniFramework

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.0.142 262 3/19/2024
8.0.141 251 1/4/2024
8.0.140 258 12/17/2023
6.0.138 261 3/19/2024
6.0.137 281 9/20/2023
6.0.136 274 9/14/2023
6.0.135 295 9/10/2023
6.0.134 334 7/12/2023
6.0.133 342 7/10/2023
6.0.132 344 7/7/2023
6.0.131 354 6/19/2023
6.0.130 346 6/19/2023
6.0.129 10,810 7/2/2022
6.0.128 873 1/16/2022
6.0.127 899 1/15/2022
6.0.126 885 1/15/2022
6.0.125 596 1/8/2022
6.0.125-hotfix1 406 1/8/2022
6.0.124 572 1/7/2022
6.0.123 750 11/14/2021
5.0.129 1,021 7/2/2022
5.0.128 1,017 1/16/2022
5.0.125 617 1/8/2022
5.0.124 634 1/7/2022
5.0.123 829 11/14/2021
5.0.122 916 10/11/2021
5.0.121 950 5/1/2021
3.1.137 392 9/20/2023
3.1.136 308 9/14/2023
3.1.135 331 9/10/2023
3.1.134 372 7/12/2023
3.1.133 396 7/11/2023
3.1.132 417 7/8/2023
3.1.131 337 6/19/2023
3.1.130 718 2/1/2023
3.1.129 1,214 7/2/2022
3.1.128 1,335 1/16/2022
3.1.125 745 1/8/2022
3.1.124 718 1/7/2022
3.1.123 945 11/14/2021
3.1.122 948 10/11/2021
3.1.121 1,055 5/1/2021
2.31.120 902 3/14/2021
2.30.115 3,725 3/6/2021
2.30.114 846 3/6/2021
2.20.101 1,507 3/1/2021
2.19.3 901 2/11/2021
2.19.2 10,469 2/6/2021
2.19.1 1,067 1/6/2021
2.19.0 1,129 1/1/2021
2.18.3 1,229 12/27/2020
2.18.2 1,908 8/29/2020
2.18.1 1,173 8/26/2020
2.18.0 5,483 8/20/2020
2.17.135 1,244 8/19/2020
2.17.134 1,276 7/28/2020
2.17.133 1,303 7/27/2020
2.17.132 1,327 7/18/2020
2.17.131 1,485 7/11/2020
2.16.130 1,402 6/13/2020
2.15.128 1,361 6/3/2020
2.15.127 1,388 5/31/2020
2.15.126 2,286 4/30/2020
2.14.122 1,252 4/13/2020
2.13.100 1,469 3/12/2020
2.12.51 1,424 2/18/2020
2.11.50 3,133 2/10/2020
2.10.44 3,099 1/30/2020
2.9.43 3,352 1/11/2020
2.8.42 3,158 1/10/2020
2.8.41 3,269 1/5/2020
2.7.40 3,182 1/2/2020
2.7.39 3,140 1/2/2020
2.7.38 3,216 1/1/2020
2.6.37 3,007 12/23/2019
2.6.35 3,385 12/4/2019
2.6.1 3,042 12/2/2019
2.6.0 3,018 11/28/2019
2.5.2 3,306 11/26/2019
2.5.1 3,093 11/12/2019
2.5.0 3,089 11/9/2019
2.4.3 3,339 10/16/2019
2.4.2 3,185 10/16/2019
2.4.1 3,296 9/20/2019
2.3.113 888 3/6/2021
2.3.112 828 3/6/2021
2.3.28 3,097 9/19/2019
2.3.27 3,364 8/30/2019
2.3.26 3,142 8/20/2019
2.3.25 3,079 8/12/2019
2.3.22 3,064 7/31/2019
2.3.21 3,376 7/20/2019
2.3.20 3,108 6/22/2019
2.3.19 3,122 6/14/2019
2.3.18 3,147 6/13/2019
2.3.17 3,156 6/13/2019
2.3.15 3,196 6/8/2019
2.3.14 3,113 6/8/2019
2.3.13 3,203 5/30/2019
2.3.12 1,578 5/24/2019
2.3.11 1,566 5/24/2019
2.3.10 1,470 5/21/2019
2.3.9 1,457 5/9/2019
2.3.8 1,498 5/8/2019
2.3.7 1,520 4/30/2019
2.3.6 1,612 4/23/2019
2.3.5 1,524 4/19/2019
2.3.4 1,418 4/18/2019
2.3.3 1,502 4/17/2019
2.3.2 1,526 4/6/2019
2.3.1 1,527 12/15/2018
2.3.0 1,571 12/7/2018
2.2.6 1,673 11/25/2018
2.2.1 1,997 11/17/2018
2.2.0 1,605 11/16/2018
2.1.0 1,626 11/15/2018
2.0.1 1,601 11/6/2018
2.0.0 1,710 11/4/2018