示例#1
0
        /// <summary>
        /// 从缓存中取得同步的错误码,取不到再去本地,再取不到去默认,主要用于解析器
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public static int getErrorTypefromMemcached(int code)
        {
            //同步更新缓存
            object type = MemcachedClientSatat.getInstance().Get(CacheKeyUtil.buildErrorCode(code.ToString()));

            if (type == null)
            {
                ErrorItem et = getErrotItemByCode(code);
                if (et == null)
                {
                    return(ErrorType.ERROR_TYPE_FAULT);
                }
                else
                {
                    return(et.errorType);
                }
            }
            else
            {
                try
                {
                    string str = (string)type;
                    return(int.Parse(str.Substring(str.IndexOf("type_") + 5)));// "type_"
                }
                catch (System.Exception e) {
                    return(ErrorType.ERROR_TYPE_FAULT);
                }
            }
        }
示例#2
0
        /// <summary>
        /// 取得默认缓存客户端实例
        /// </summary>
        /// <returns></returns>
        public static MemcachedClientSatat getInstance()
        {
            MemcachedClientSatat mcs = instances.ContainsKey("default") ? instances["default"] : null;

            if (mcs == null)
            {
                mcs = new MemcachedClientSatat("default");
                instances["default"] = mcs;
            }
            return(mcs);
        }
示例#3
0
        /// <summary>
        /// 取得制定配置缓存客户端实例
        /// </summary>
        /// <returns></returns>
        public static MemcachedClientSatat getInstance(string servers)
        {
            MemcachedClientSatat mcs = instances.ContainsKey(servers)? instances[servers]  :null;

            if (mcs == null)
            {
                string[] serverList = servers.Split(',');
                mcs = new MemcachedClientSatat(serverList);
                instances[servers] = mcs;
            }
            return(mcs);
        }
示例#4
0
        /// <summary>
        /// 取得制定配置缓存客户端实例
        /// </summary>
        /// <returns></returns>
        public static MemcachedClientSatat getInstance(string servers)
        {
            MemcachedClientSatat mcs = instances.ContainsKey(servers)? instances[servers]  :null;

            if (mcs == null)
            {
                Console.WriteLine("servers" + servers);
                string[] serverList = servers.Split(',');
                mcs = new MemcachedClientSatat(serverList, "selfpool" + servers);
                Console.WriteLine("mcs" + mcs);
                instances[servers] = mcs;
            }
            return(mcs);
        }
示例#5
0
 /// <summary>
 ///
 /// </summary>
 public MemCachedController()
 {
     _mc        = MemcachedClientSatat.getInstance();
     _cacheSize = 100;
     _keyList   = ArrayList.Synchronized(new ArrayList());
 }
示例#6
0
 /// <summary> 
 /// 
 /// </summary> 
 public MemCachedController()
 {
     _mc =  MemcachedClientSatat.getInstance();
     _cacheSize = 100;
     _keyList = ArrayList.Synchronized(new ArrayList());
 }
 /// <summary>
 /// 取得默认缓存客户端实例
 /// </summary>
 /// <returns></returns>
 public static MemcachedClientSatat getInstance()
 {
     MemcachedClientSatat mcs = instances.ContainsKey("default") ? instances["default"] : null;
     if (mcs == null)
     {
         mcs = new MemcachedClientSatat("default");
         instances["default"] = mcs;
     }
     return mcs;
 }
 /// <summary>
 /// 取得制定配置缓存客户端实例
 /// </summary>
 /// <returns></returns>
 public static MemcachedClientSatat getInstance(string servers)
 {
     MemcachedClientSatat mcs = instances.ContainsKey(servers)? instances[servers]  :null;
     if (mcs == null)
     {
         Console.WriteLine("servers" + servers);
         string[] serverList = servers.Split(',');
         mcs = new MemcachedClientSatat(serverList, "selfpool" + servers);
         Console.WriteLine("mcs" + mcs);
         instances[servers] = mcs;
     }
     return mcs;
 }
 /// <summary>
 /// 取得制定配置缓存客户端实例
 /// </summary>
 /// <returns></returns>
 public static MemcachedClientSatat getInstance(string servers)
 {
     MemcachedClientSatat mcs = instances.ContainsKey(servers)? instances[servers]  :null;
     if (mcs == null)
     {
         string[] serverList = servers.Split(',');
         mcs = new MemcachedClientSatat(serverList);
         instances[servers] = mcs;
     }
     return mcs;
 }