/// <summary>
///项目预警缓存
/// </summary>
/// <param name="brandid">项目ID</param>
/// <param name="strConfig">配置字段</param>
/// <returns></returns>
public static string[] GetWoedBy(string brandid, string strConfig)
{
MemcachedClient mc = new MemcachedClient();
mc.EnableCompression = true;
string cachekey = "GetWoedBy" + brandid + strConfig;
if (mc.Get(cachekey) != null)
{
return (string[])mc.Get(cachekey);
}
else
{
string keyword = System.Configuration.ConfigurationManager.AppSettings[strConfig].ToString();
string[] brandkeyword = keyword.Split(';');
string[] key = null;
string[] word = null;
for (int i = 0; i < brandkeyword.Length; i++)
{
if (brandkeyword[i] != "")
{
key = brandkeyword[i].Split(':');
if (key[0] == brandid)
{ word = key[1].Split('/'); }
}
}
mc.Set(cachekey, word, DateTime.Now.AddHours(1));
return word;
}
}
Memcached缓存
最新推荐文章于 2021-03-18 07:24:53 发布