/// <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); } } }
/// <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) { string[] serverList = servers.Split(','); mcs = new MemcachedClientSatat(serverList); 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) { 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> 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; }