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 | 153 | 3/19/2024 |
8.0.141 | 145 | 1/4/2024 |
8.0.140 | 157 | 12/17/2023 |
6.0.138 | 155 | 3/19/2024 |
6.0.137 | 214 | 9/20/2023 |
6.0.136 | 201 | 9/14/2023 |
6.0.135 | 210 | 9/10/2023 |
6.0.134 | 244 | 7/12/2023 |
6.0.133 | 245 | 7/10/2023 |
6.0.132 | 241 | 7/7/2023 |
6.0.131 | 260 | 6/19/2023 |
6.0.130 | 269 | 6/19/2023 |
6.0.129 | 10,676 | 7/2/2022 |
6.0.128 | 736 | 1/16/2022 |
6.0.127 | 753 | 1/15/2022 |
6.0.126 | 757 | 1/15/2022 |
6.0.125 | 452 | 1/8/2022 |
6.0.125-hotfix1 | 281 | 1/8/2022 |
6.0.124 | 435 | 1/7/2022 |
6.0.123 | 608 | 11/14/2021 |
5.0.129 | 910 | 7/2/2022 |
5.0.128 | 874 | 1/16/2022 |
5.0.125 | 480 | 1/8/2022 |
5.0.124 | 487 | 1/7/2022 |
5.0.123 | 667 | 11/14/2021 |
5.0.122 | 783 | 10/11/2021 |
5.0.121 | 800 | 5/1/2021 |
3.1.137 | 300 | 9/20/2023 |
3.1.136 | 226 | 9/14/2023 |
3.1.135 | 264 | 9/10/2023 |
3.1.134 | 262 | 7/12/2023 |
3.1.133 | 305 | 7/11/2023 |
3.1.132 | 300 | 7/8/2023 |
3.1.131 | 245 | 6/19/2023 |
3.1.130 | 598 | 2/1/2023 |
3.1.129 | 1,089 | 7/2/2022 |
3.1.128 | 1,169 | 1/16/2022 |
3.1.125 | 594 | 1/8/2022 |
3.1.124 | 574 | 1/7/2022 |
3.1.123 | 803 | 11/14/2021 |
3.1.122 | 794 | 10/11/2021 |
3.1.121 | 900 | 5/1/2021 |
2.31.120 | 754 | 3/14/2021 |
2.30.115 | 3,563 | 3/6/2021 |
2.30.114 | 709 | 3/6/2021 |
2.20.101 | 1,375 | 3/1/2021 |
2.19.3 | 752 | 2/11/2021 |
2.19.2 | 10,326 | 2/6/2021 |
2.19.1 | 925 | 1/6/2021 |
2.19.0 | 972 | 1/1/2021 |
2.18.3 | 1,075 | 12/27/2020 |
2.18.2 | 1,750 | 8/29/2020 |
2.18.1 | 1,032 | 8/26/2020 |
2.18.0 | 5,319 | 8/20/2020 |
2.17.135 | 1,087 | 8/19/2020 |
2.17.134 | 1,122 | 7/28/2020 |
2.17.133 | 1,161 | 7/27/2020 |
2.17.132 | 1,132 | 7/18/2020 |
2.17.131 | 1,309 | 7/11/2020 |
2.16.130 | 1,213 | 6/13/2020 |
2.15.128 | 1,216 | 6/3/2020 |
2.15.127 | 1,237 | 5/31/2020 |
2.15.126 | 2,131 | 4/30/2020 |
2.14.122 | 1,097 | 4/13/2020 |
2.13.100 | 1,289 | 3/12/2020 |
2.12.51 | 1,275 | 2/18/2020 |
2.11.50 | 2,975 | 2/10/2020 |
2.10.44 | 2,939 | 1/30/2020 |
2.9.43 | 3,184 | 1/11/2020 |
2.8.42 | 2,995 | 1/10/2020 |
2.8.41 | 3,083 | 1/5/2020 |
2.7.40 | 2,999 | 1/2/2020 |
2.7.39 | 2,973 | 1/2/2020 |
2.7.38 | 3,043 | 1/1/2020 |
2.6.37 | 2,868 | 12/23/2019 |
2.6.35 | 3,213 | 12/4/2019 |
2.6.1 | 2,875 | 12/2/2019 |
2.6.0 | 2,871 | 11/28/2019 |
2.5.2 | 3,168 | 11/26/2019 |
2.5.1 | 2,932 | 11/12/2019 |
2.5.0 | 2,923 | 11/9/2019 |
2.4.3 | 3,157 | 10/16/2019 |
2.4.2 | 2,954 | 10/16/2019 |
2.4.1 | 3,111 | 9/20/2019 |
2.3.113 | 744 | 3/6/2021 |
2.3.112 | 670 | 3/6/2021 |
2.3.28 | 2,948 | 9/19/2019 |
2.3.27 | 3,170 | 8/30/2019 |
2.3.26 | 2,957 | 8/20/2019 |
2.3.25 | 2,916 | 8/12/2019 |
2.3.22 | 2,906 | 7/31/2019 |
2.3.21 | 3,206 | 7/20/2019 |
2.3.20 | 2,938 | 6/22/2019 |
2.3.19 | 2,947 | 6/14/2019 |
2.3.18 | 2,960 | 6/13/2019 |
2.3.17 | 2,987 | 6/13/2019 |
2.3.15 | 3,043 | 6/8/2019 |
2.3.14 | 2,955 | 6/8/2019 |
2.3.13 | 3,060 | 5/30/2019 |
2.3.12 | 1,385 | 5/24/2019 |
2.3.11 | 1,375 | 5/24/2019 |
2.3.10 | 1,295 | 5/21/2019 |
2.3.9 | 1,293 | 5/9/2019 |
2.3.8 | 1,327 | 5/8/2019 |
2.3.7 | 1,345 | 4/30/2019 |
2.3.6 | 1,393 | 4/23/2019 |
2.3.5 | 1,350 | 4/19/2019 |
2.3.4 | 1,235 | 4/18/2019 |
2.3.3 | 1,328 | 4/17/2019 |
2.3.2 | 1,351 | 4/6/2019 |
2.3.1 | 1,372 | 12/15/2018 |
2.3.0 | 1,419 | 12/7/2018 |
2.2.6 | 1,488 | 11/25/2018 |
2.2.1 | 1,790 | 11/17/2018 |
2.2.0 | 1,411 | 11/16/2018 |
2.1.0 | 1,440 | 11/15/2018 |
2.0.1 | 1,401 | 11/6/2018 |
2.0.0 | 1,501 | 11/4/2018 |