NFinal.Memcached.ClientLibrary
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package NFinal.Memcached.ClientLibrary --version 1.0.0
NuGet\Install-Package NFinal.Memcached.ClientLibrary -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="NFinal.Memcached.ClientLibrary" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NFinal.Memcached.ClientLibrary --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NFinal.Memcached.ClientLibrary, 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 NFinal.Memcached.ClientLibrary as a Cake Addin #addin nuget:?package=NFinal.Memcached.ClientLibrary&version=1.0.0 // Install NFinal.Memcached.ClientLibrary as a Cake Tool #tool nuget:?package=NFinal.Memcached.ClientLibrary&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Memcached.ClientLibrary
添加Bson和Json序列化,加快效率.
- 该项目和由java移值而来.其中内部协议只有二进制协议.
原java项目Memcached-Java-Client - 现添加bson,json两种协议,默认协议改为了bson. 因为bson序列化效率是原有的8倍以上,可移植性也更强.
使用方法:
``` csharp
class AMemcached
{
public static MemcachedClient cache;
static AMemcached()
{
string[] servers = { "172.18.5.66:11211" };
//初始化池
SockIOPool pool = SockIOPool.GetInstance();
//设置服务器列表
pool.SetServers(servers);
//各服务器之间负载均衡的设置比例
pool.SetWeights(new int[] { 1 });
//初始化时创建连接数
pool.InitConnections = 3;
//最小连接数
pool.MinConnections = 3;
//最大连接数
pool.MaxConnections = 5;
//连接的最大空闲时间,下面设置为6个小时(单位ms),超过这个设置时间,连接会被释放掉
pool.MaxIdle = 1000 * 60 * 60 * 6;
//socket连接的超时时间,下面设置表示不超时(单位ms),即一直保持链接状态
pool.SocketConnectTimeout = 0;
//通讯的超市时间,下面设置为3秒(单位ms),.Net版本没有实现
pool.SocketTimeout = 1000 * 3;
//维护线程的间隔激活时间,下面设置为30秒(单位s),设置为0时表示不启用维护线程
pool.MaintenanceSleep = 30;
//设置SocktIO池的故障标志
pool.Failover = true;
//是否对TCP/IP通讯使用nalgle算法,.net版本没有实现
pool.Nagle = false;
//socket单次任务的最大时间(单位ms),超过这个时间socket会被强行中端掉,当前任务失败。
pool.MaxBusy = 1000 * 10;
pool.Initialize();
cache = new MemcachedClient();
//是否启用压缩数据:如果启用了压缩,数据压缩长于门槛的数据将被储存在压缩的形式
cache.EnableCompression = false;
//压缩设置,超过指定大小的都压缩
//cache.CompressionThreshold = 1024 * 1024;
}
}
class Program
{
static void Main(string[] args)
{
//存入key为a,value为123的一个缓存
AMemcached.cache.Add("a", "123");
//读出key为a的缓存值
var s = AMemcached.cache.Get("a");
//输出
Console.WriteLine(s);
Console.ReadKey();
}
}
```
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. 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. |
.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.
-
.NETStandard 2.0
- Newtonsoft.Json.Bson (>= 1.0.2)
- SharpZipLib.NETStandard (>= 1.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.