예제 #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>
 public MemCachedController()
 {
     _mc        = MemcachedClientSatat.getInstance();
     _cacheSize = 100;
     _keyList   = ArrayList.Synchronized(new ArrayList());
 }