MemcachedConfigInfo.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using Enyim.Caching;
  2. using Enyim.Caching.Configuration;
  3. using Enyim.Caching.Memcached;
  4. using Enyim.Caching.Memcached.Protocol.Binary;
  5. namespace Lottomat.Cache.Memcached
  6. {
  7. /// <summary>
  8. /// 配置文件
  9. /// </summary>
  10. public class MemcachedConfigInfo
  11. {
  12. private static MemcachedClient memClient = null;
  13. static MemcachedConfigInfo()
  14. {
  15. }
  16. //public MemcachedClient GetMemcachedInstance()
  17. //{
  18. // // Memcached服务器列表
  19. // // 如果有多台服务器,则以逗号分隔,例如:"192.168.80.10:11211","192.168.80.11:11211"
  20. // string[] serverList = { "192.168.80.10:11211" };
  21. // // 初始化SocketIO池
  22. // string poolName = "MyPool";
  23. // IServerPool sockIOPool = SockIOPool.GetInstance(poolName);
  24. // // 添加服务器列表
  25. // sockIOPool.SetServers(serverList);
  26. // // 设置连接池初始数目
  27. // sockIOPool.InitConnections = 3;
  28. // // 设置连接池最小连接数目
  29. // sockIOPool.MinConnections = 3;
  30. // // 设置连接池最大连接数目
  31. // sockIOPool.MaxConnections = 5;
  32. // // 设置连接的套接字超时时间(单位:毫秒)
  33. // sockIOPool.SocketConnectTimeout = 1000;
  34. // // 设置套接字超时时间(单位:毫秒)
  35. // sockIOPool.SocketTimeout = 3000;
  36. // // 设置维护线程运行的睡眠时间:如果设置为0,那么维护线程将不会启动
  37. // sockIOPool.MaintenanceSleep = 30;
  38. // // 设置SockIO池的故障标志
  39. // sockIOPool.Failover = true;
  40. // // 是否用nagle算法启动
  41. // sockIOPool.Nagle = false;
  42. // // 正式初始化容器
  43. // sockIOPool.Initialize();
  44. // // 获取Memcached客户端实例
  45. // memClient = new MemcachedClient();
  46. // // 指定客户端访问的SockIO池
  47. // memClient.PoolName = poolName;
  48. // // 是否启用压缩数据:如果启用了压缩,数据压缩长于门槛的数据将被储存在压缩的形式
  49. // memClient.EnableCompression = false;
  50. //}
  51. }
  52. }