HCenter.CacheHelper
2.0.6
dotnet add package HCenter.CacheHelper --version 2.0.6
NuGet\Install-Package HCenter.CacheHelper -Version 2.0.6
<PackageReference Include="HCenter.CacheHelper" Version="2.0.6" />
paket add HCenter.CacheHelper --version 2.0.6
#r "nuget: HCenter.CacheHelper, 2.0.6"
// Install HCenter.CacheHelper as a Cake Addin #addin nuget:?package=HCenter.CacheHelper&version=2.0.6 // Install HCenter.CacheHelper as a Cake Tool #tool nuget:?package=HCenter.CacheHelper&version=2.0.6
static void Main(string[] args) { try { //int minWorker, minIOC; //// Get the current settings. //ThreadPool.GetMinThreads(out minWorker, out minIOC); //// Change the minimum number of worker threads to four, but //// keep the old setting for minimum asynchronous I/O //// completion threads. //ThreadPool.SetMinThreads(4, minIOC);
ICacheProvider cache =
new MemoryCacheImp("vive") { KeySuffix = "xjh" };
//new CSRedisCacheImp("vive", 1) { KeySuffix = "xjh" };
//StackExchange(cache);
Test_SetValue(cache);
Test_GetValue_Tasks(cache);
//CallWithTimeout(FiveSecondMethod, 4000);
System.Console.ReadKey();
}
catch (Exception ex)
{
Console.WriteLine(ex);
System.Console.ReadKey();
}
}
static void Test_SetValue(ICacheProvider cache)
{
cache.RemoveAll();
#region Hash
cache.HashSet("user", "u1", "123");
cache.HashSet("user", "u2", "1234");
cache.HashSet("user", "u3", "1235");
var news = cache.HashGet<string>("user", "u2");
#endregion Hash
List<Person> people = new List<Person>()
{
new Person(1, "Joe", new List<Contact>()
{
new Contact("1", "0123456789"),
new Contact("2", "0234567890")
}),
new Person(2, "Joe2", new List<Contact>()
{
new Contact("12", "1234567289"),
new Contact("22", "2345672890")
})
};
//for(var i = 2; i < 3003; i++)
//{
// people.Add(new Person(i, "Joe2" + i, new List<Contact>()
// {
// new Contact("12"+i, "1234567289"+i),
// new Contact("22"+i, "2345672890"+i)
// }));
//}
cache.Set("People", people);
var getpeople = cache.Get<List<Person>>("People");
var ret = cache.HashSet("user", "Peoples", people);
var pps = cache.HashGet<List<Person>>("user", "Peoples");
ret = cache.HashSet("user", "People", people[1]);
var pp2s = cache.HashGet<List<Person>>("user", "Peoples");
var pp = cache.HashGet<Person>("user", "People");
Dictionary<string, Person> dicPerson = new Dictionary<string, Person>();
people.ForEach(p => dicPerson[p.Id.ToString()] = p);
var dics = new Dictionary<string, Dictionary<string, Person>>();
dics.Add("dicpeople", dicPerson);
// cache.HashSetExecute("dicpeople", dicPerson);
cache.HashSetExecute(dics);
var dicpeoples = cache.HashGetAll<Person>("dicpeople");
var keys = cache.HashGetAll<object>("user");
}
static void Test_GetValue_Tasks(ICacheProvider cache)
{
#region Test_GetValue_Tasks
const int noOfClients = 10000;
var tasks = new Task[noOfClients];
var c = 0;
var ie = 0;
var locked = 0;
var watch1 = new Stopwatch();
//开始计时
watch1.Start();
cache.Set("atomic-counter", 0);
for (var i = 0; i < noOfClients; i++)
{
Thread.Sleep(10);
tasks[i] = Task.Factory.StartNew((object clientNo) =>
{
try
{
var token = Environment.MachineName;
//if (cache.LockTake("lock_test", token, TimeSpan.MaxValue))
using (cache.AcquireLock("lock_test", TimeSpan.FromSeconds(20),true))
{
try
{
//TODO:开始做你需要的事情
//Thread.Sleep(5000);
var watch = new Stopwatch();
//开始计时
watch.Start();
if (!cache.Exists("atomic-counter")) cache.Set("atomic-counter", 0);
var contacts = cache.Get<List<Person>>("People");
var contactslist = cache.HashGet<List<Person>>("user", "Peoples");
//var contactslist = cache.HashGetAll<List<Person>>("user");
Thread.Sleep(10);
var counter = cache.Get<int>("atomic-counter");
cache.Set("atomic-counter", (counter + 1));
var atomiccounter = cache.Get<int>("atomic-counter");
watch.Stop();
Console.WriteLine(cache.GetType().Name + " client {0} released lock,contactslist.Count={1},watch.ElapsedMilliseconds={2},atomic-counter={3}", (int)clientNo, contactslist.Count, watch.ElapsedMilliseconds, atomiccounter);
}
finally
{
//cache.LockRelease("lock_test", token);
}
}
//else
//{
// locked++;
// var atomiccounter = cache.Get<int>("atomic-counter");
// Console.WriteLine(cache.GetType().Name + " client {0} ,locked={1},atomic-counter={2},is locked:", locked, (int)clientNo, atomiccounter);
//}
}
catch (Exception e)
{
ie++;
var atomiccounter = cache.Get<int>("atomic-counter");
Console.WriteLine(cache.GetType().Name + " client {0} ,ie={1},atomic-counter={2},Exception:" + e.Message, ie, (int)clientNo, atomiccounter);
}
c++;
if (noOfClients <= c)
{
watch1.Stop();
var atomiccounter = cache.Get<int>("atomic-counter");
Console.WriteLine(cache.GetType().Name + " client c={0},ie={1},ElapsedMilliseconds={2} ,atomic-counter={3}", c, ie, watch1.ElapsedMilliseconds, atomiccounter);
}
}, i + 1);
}
#endregion
}
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 | net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. 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. |
-
.NETFramework 4.0
- CSRedisCore (>= 3.6.6)
- Newtonsoft.Json (>= 12.0.3)
-
.NETFramework 4.5
- CSRedisCore (>= 3.6.6)
- Newtonsoft.Json (>= 12.0.3)
-
.NETFramework 4.6.1
- CSRedisCore (>= 3.6.6)
- Newtonsoft.Json (>= 12.0.3)
-
.NETFramework 4.7.2
- CSRedisCore (>= 3.6.6)
- Newtonsoft.Json (>= 12.0.3)
-
.NETStandard 2.0
- CSRedisCore (>= 3.6.6)
- Microsoft.Extensions.Configuration (>= 3.1.3)
- Microsoft.Extensions.Configuration.Binder (>= 3.1.3)
- Microsoft.Extensions.Configuration.Json (>= 3.1.3)
- Newtonsoft.Json (>= 12.0.3)
- System.Runtime.Caching (>= 5.0.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on HCenter.CacheHelper:
Package | Downloads |
---|---|
JSAHelpEN
Oooops!Simple, simple-to-call approach, integration of multiple platforms, multiple environments!简单的、傻瓜式的调用方式,集成多平台、多环境!: This is an ASP.NET help class written in C#,which organized a lot of open source code,a lot of good authors and source code are referenced. The original purpose is to collect the various problems that have been encountered in development, and organize them into knowledge base, which can facilitate the development and learning of the future. The main functions of this help library are: File processing, log system, form transition, JSON, XML, parse, circuit breakers, retry mechanism, ZIP compression/decompression, Winform beautification, multi-thread calls, add and delete registry, mainstream database to add and delete, thread the fuse/kill, batch command/command-line execution, HTTP, string formatting, sentenced to services and service request Break, MD5, AES, DES, RSA, BASE64 and other encryption algorithms and other practical functions. The class library supports multiple versions (.net Framework 4.5~4.8/.NET5.0~6.0/.NET Core 3.1/.NET Standard2.0~2.1). To prevent code abuse, the library has its own signature verification mechanism, and the code needs to run on the signed machine.Future will continue to fill in various useful help library. The signing machine download please email:1924038917jsa@gmail.com or attention:https://github.com/GHjiaoshouang. If there is infringement please contact me. Thanks. `简单的、傻瓜式的调用方式,集成多平台、多环境! `这是基于C#语言开发的ASP.NET帮助库,里面整理了很多开源的代码,借鉴了很多优秀作者的代码。最初目的是用于搜集自己在开发当中遇到的各种问题,整理成知识库,便于以后的开发和学习。主要的功能有:文件处理、日志系统、表格转换、JSON解析、XML解析、断路机制、重试机制、ZIP压缩/解压缩、Winform美化、多线程调用、注册表增删改查、主流数据库增删改查、线程熔断/强杀、批命令/命令行执行、HTTP服务及服务请求、字符串格式化、判断、MD5/AES/DES/RSA/BASE64等多种加密算法等多种实用功能。类库支持多个版本(.NET Framework 4.5~4.8/.NET5.0~6.0/.NET Core 3.1/.NET Standard2.0~2.1)。 `如果使用过程中遇到问题,可以在【https://github.com/GHjiaoshouang/JSAHelpTest.git】查看具体的调用和使用方式。 `为了防止代码滥用,类库设有专属的签名验证机制,代码运行需要在已被签名的机器上。后期会不断向里面填充各类实用帮助类库。签名器关注GitHub:[https://github.com/GHjiaoshouang]。如有侵权请联系我。 `谢谢。 |
|
Tianchengmedicalproductscore
仅供内部使用,内涵特殊加密方式 For internal use only, with special encryption built in |
|
JSAHelpMiNi
Oooops!Simple, simple-to-call approach, integration of multiple platforms, multiple environments!简单的、傻瓜式的调用方式,集成多平台、多环境!: This is an ASP.NET help class written in C#,which organized a lot of open source code,a lot of good authors and source code are referenced. The original purpose is to collect the various problems that have been encountered in development, and organize them into knowledge base, which can facilitate the development and learning of the future. The main functions of this help library are: File processing, log system, form transition, JSON, XML, parse, circuit breakers, retry mechanism, ZIP compression/decompression, Winform beautification, multi-thread calls, add and delete registry, mainstream database to add and delete, thread the fuse/kill, batch command/command-line execution, HTTP, string formatting, sentenced to services and service request Break, MD5, AES, DES, RSA, BASE64 and other encryption algorithms and other practical functions. The class library supports multiple versions (.net Framework 4.5~4.8/.NET5.0~6.0/.NET Core 3.1/.NET Standard2.0~2.1). To prevent code abuse, the library has its own signature verification mechanism, and the code needs to run on the signed machine.Future will continue to fill in various useful help library. The signing machine download please email:1924038917jsa@gmail.com or attention:https://github.com/GHjiaoshouang. If there is infringement please contact me. Thanks. `简单的、傻瓜式的调用方式,集成多平台、多环境! `这是基于C#语言开发的ASP.NET帮助库,里面整理了很多开源的代码,借鉴了很多优秀作者的代码。最初目的是用于搜集自己在开发当中遇到的各种问题,整理成知识库,便于以后的开发和学习。主要的功能有:文件处理、日志系统、表格转换、JSON解析、XML解析、断路机制、重试机制、ZIP压缩/解压缩、Winform美化、多线程调用、注册表增删改查、主流数据库增删改查、线程熔断/强杀、批命令/命令行执行、HTTP服务及服务请求、字符串格式化、判断、MD5/AES/DES/RSA/BASE64等多种加密算法等多种实用功能。类库支持多个版本(.NET Framework 4.5~4.8/.NET5.0~6.0/.NET Core 3.1/.NET Standard2.0~2.1)。 `如果使用过程中遇到问题,可以在【https://github.com/GHjiaoshouang/JSAHelpTest.git】查看具体的调用和使用方式。 `为了防止代码滥用,类库设有专属的签名验证机制,代码运行需要在已被签名的机器上。后期会不断向里面填充各类实用帮助类库。签名器关注GitHub:[https://github.com/GHjiaoshouang]。如有侵权请联系我。 `谢谢。 |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.6 | 32,895 | 3/11/2021 |