Exemplo n.º 1
0
 /// <summary>
 /// 获取缓存池中值
 /// </summary>
 /// <param name="poolName">缓存池名</param>
 /// <param name="key">缓存键</param>
 /// <returns></returns>
 public static string GetMemCacheValues(string poolName, string key)
 {
     try
     {
         string     str      = "";
         SockIOPool instance = SockIOPool.GetInstance(poolName);
         instance.SetServers(CacheConfig.getMemcachedServerList());
         instance.SocketTimeout        = 3000;
         instance.SocketConnectTimeout = 3000;
         instance.Initialize();
         object obj = new MemcachedClient()
         {
             PoolName          = poolName,
             EnableCompression = false
         }.Get(key);
         if (obj != null)
         {
             str = obj.ToString();
         }
         return(str);
     }
     catch { return(string.Empty); }
 }