ZayniFramework.Caching
2.2.1
See the version list below for details.
dotnet add package ZayniFramework.Caching --version 2.2.1
NuGet\Install-Package ZayniFramework.Caching -Version 2.2.1
<PackageReference Include="ZayniFramework.Caching" Version="2.2.1" />
paket add ZayniFramework.Caching --version 2.2.1
#r "nuget: ZayniFramework.Caching, 2.2.1"
// Install ZayniFramework.Caching as a Cake Addin #addin nuget:?package=ZayniFramework.Caching&version=2.2.1 // Install ZayniFramework.Caching as a Cake Tool #tool nuget:?package=ZayniFramework.Caching&version=2.2.1
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" 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 | Versions 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. |
.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. |
-
.NETStandard 2.0
- MySql.Data (>= 8.0.12)
- Newtonsoft.Json (>= 11.0.2)
- StackExchange.Redis (>= 2.0.495)
- ZayniFramework.Common (>= 2.2.1)
- ZayniFramework.DataAccess (>= 2.2.1)
- ZayniFramework.Logging (>= 2.2.1)
- ZayniFramework.Middle.Service.Client (>= 2.2.1)
- ZayniFramework.Middle.Service.Entity (>= 2.2.1)
- ZayniFramework.Serialization (>= 2.2.1)
- ZayniFramework.Validation (>= 2.2.1)
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 | 151 | 3/19/2024 |
8.0.141 | 143 | 1/4/2024 |
8.0.140 | 155 | 12/17/2023 |
6.0.138 | 153 | 3/19/2024 |
6.0.137 | 212 | 9/20/2023 |
6.0.136 | 197 | 9/14/2023 |
6.0.135 | 208 | 9/10/2023 |
6.0.134 | 242 | 7/12/2023 |
6.0.133 | 243 | 7/10/2023 |
6.0.132 | 239 | 7/7/2023 |
6.0.131 | 258 | 6/19/2023 |
6.0.130 | 267 | 6/19/2023 |
6.0.129 | 10,672 | 7/2/2022 |
6.0.128 | 734 | 1/16/2022 |
6.0.127 | 751 | 1/15/2022 |
6.0.126 | 755 | 1/15/2022 |
6.0.125 | 450 | 1/8/2022 |
6.0.125-hotfix1 | 279 | 1/8/2022 |
6.0.124 | 433 | 1/7/2022 |
6.0.123 | 606 | 11/14/2021 |
5.0.129 | 908 | 7/2/2022 |
5.0.128 | 872 | 1/16/2022 |
5.0.125 | 478 | 1/8/2022 |
5.0.124 | 485 | 1/7/2022 |
5.0.123 | 665 | 11/14/2021 |
5.0.122 | 781 | 10/11/2021 |
5.0.121 | 798 | 5/1/2021 |
3.1.137 | 298 | 9/20/2023 |
3.1.136 | 222 | 9/14/2023 |
3.1.135 | 259 | 9/10/2023 |
3.1.134 | 260 | 7/12/2023 |
3.1.133 | 303 | 7/11/2023 |
3.1.132 | 298 | 7/8/2023 |
3.1.131 | 243 | 6/19/2023 |
3.1.130 | 594 | 2/1/2023 |
3.1.129 | 1,087 | 7/2/2022 |
3.1.128 | 1,167 | 1/16/2022 |
3.1.125 | 592 | 1/8/2022 |
3.1.124 | 572 | 1/7/2022 |
3.1.123 | 801 | 11/14/2021 |
3.1.122 | 792 | 10/11/2021 |
3.1.121 | 898 | 5/1/2021 |
2.31.120 | 752 | 3/14/2021 |
2.30.115 | 3,561 | 3/6/2021 |
2.30.114 | 707 | 3/6/2021 |
2.20.101 | 1,373 | 3/1/2021 |
2.19.3 | 750 | 2/11/2021 |
2.19.2 | 10,324 | 2/6/2021 |
2.19.1 | 923 | 1/6/2021 |
2.19.0 | 970 | 1/1/2021 |
2.18.3 | 1,073 | 12/27/2020 |
2.18.2 | 1,748 | 8/29/2020 |
2.18.1 | 1,030 | 8/26/2020 |
2.18.0 | 5,317 | 8/20/2020 |
2.17.135 | 1,085 | 8/19/2020 |
2.17.134 | 1,120 | 7/28/2020 |
2.17.133 | 1,159 | 7/27/2020 |
2.17.132 | 1,130 | 7/18/2020 |
2.17.131 | 1,307 | 7/11/2020 |
2.16.130 | 1,211 | 6/13/2020 |
2.15.128 | 1,214 | 6/3/2020 |
2.15.127 | 1,235 | 5/31/2020 |
2.15.126 | 2,129 | 4/30/2020 |
2.14.122 | 1,095 | 4/13/2020 |
2.13.100 | 1,287 | 3/12/2020 |
2.12.51 | 1,273 | 2/18/2020 |
2.11.50 | 2,973 | 2/10/2020 |
2.10.44 | 2,937 | 1/30/2020 |
2.9.43 | 3,182 | 1/11/2020 |
2.8.42 | 2,993 | 1/10/2020 |
2.8.41 | 3,081 | 1/5/2020 |
2.7.40 | 2,997 | 1/2/2020 |
2.7.39 | 2,971 | 1/2/2020 |
2.7.38 | 3,041 | 1/1/2020 |
2.6.37 | 2,866 | 12/23/2019 |
2.6.35 | 3,211 | 12/4/2019 |
2.6.1 | 2,873 | 12/2/2019 |
2.6.0 | 2,869 | 11/28/2019 |
2.5.2 | 3,166 | 11/26/2019 |
2.5.1 | 2,930 | 11/12/2019 |
2.5.0 | 2,921 | 11/9/2019 |
2.4.3 | 3,155 | 10/16/2019 |
2.4.2 | 2,952 | 10/16/2019 |
2.4.1 | 3,109 | 9/20/2019 |
2.3.113 | 742 | 3/6/2021 |
2.3.112 | 668 | 3/6/2021 |
2.3.28 | 2,946 | 9/19/2019 |
2.3.27 | 3,168 | 8/30/2019 |
2.3.26 | 2,955 | 8/20/2019 |
2.3.25 | 2,914 | 8/12/2019 |
2.3.22 | 2,904 | 7/31/2019 |
2.3.21 | 3,204 | 7/20/2019 |
2.3.20 | 2,936 | 6/22/2019 |
2.3.19 | 2,945 | 6/14/2019 |
2.3.18 | 2,958 | 6/13/2019 |
2.3.17 | 2,983 | 6/13/2019 |
2.3.15 | 3,041 | 6/8/2019 |
2.3.14 | 2,953 | 6/8/2019 |
2.3.13 | 3,058 | 5/30/2019 |
2.3.12 | 1,383 | 5/24/2019 |
2.3.11 | 1,373 | 5/24/2019 |
2.3.10 | 1,293 | 5/21/2019 |
2.3.9 | 1,291 | 5/9/2019 |
2.3.8 | 1,325 | 5/8/2019 |
2.3.7 | 1,343 | 4/30/2019 |
2.3.6 | 1,391 | 4/23/2019 |
2.3.5 | 1,348 | 4/19/2019 |
2.3.4 | 1,231 | 4/18/2019 |
2.3.3 | 1,326 | 4/17/2019 |
2.3.2 | 1,349 | 4/6/2019 |
2.3.1 | 1,370 | 12/15/2018 |
2.3.0 | 1,417 | 12/7/2018 |
2.2.6 | 1,486 | 11/25/2018 |
2.2.1 | 1,788 | 11/17/2018 |
2.2.0 | 1,409 | 11/16/2018 |
2.1.0 | 1,438 | 11/15/2018 |
2.0.1 | 1,399 | 11/6/2018 |
2.0.0 | 1,499 | 11/4/2018 |