public override void Remove(string prefix, string key, Guid timestamp) { string fullName = this.GetFullName(prefix, key); DistCache.Remove(fullName); cacheKeys.Remove(fullName); }
/// <summary> /// 根据表名称清除对应的缓存,在添加缓存的时候加上涉及到的表名称 /// </summary> /// <param name="tbName"></param> public void RemoveKeyDicByTbName(string tbName) { try { if (!string.IsNullOrWhiteSpace(tbName)) { return; } tbName = tbName.ToLower(); List <MemcacheKey> MemcacheKeyList = GetMemcacheKeyLis(); var keyList = MemcacheKeyList.Where(t => t.RelationTableName.ToLower().Contains(tbName)).Select(m => m.Key).ToList(); MemcacheKeyList.RemoveAll(t => t.RelationTableName.ToLower().Contains(tbName)); DistCache.Add(KeyDic, MemcacheKeyList); keyList = keyList.Distinct().ToList(); foreach (var item in keyList) { DistCache.Remove(item); } } catch { } }
public static object Remove(string strKey, int cacheType = 1) { if (cacheType == 0) { return(DistCache.Remove(strKey)); } else { return(RedisManager.Remove(strKey)); } }
/// <summary> /// 模糊匹配删除缓存 /// </summary> /// <param name="key"></param> public void RemoveLikeKey(string key) { if (string.IsNullOrWhiteSpace(key)) { return; } var MemcacheKeyList = GetMemcacheKeyLis(); var keyList = MemcacheKeyList.Where(m => m.Key.ToLower().IndexOf(key.ToLower()) >= 0).Select(mm => mm.Key).ToList(); MemcacheKeyList.RemoveAll(m => keyList.Contains(m.Key)); DistCache.Add(KeyDic, MemcacheKeyList); foreach (var item in keyList) { DistCache.Remove(item); } }
public override void Clear(string prefix) { if (string.IsNullOrWhiteSpace(prefix)) { return; } IList <string> keys = new List <string>(); foreach (KeyValuePair <string, string> kvp in cacheKeys) { if (kvp.Key.Contains(prefix)) { DistCache.Remove(kvp.Key); keys.Add(kvp.Key); } } foreach (string key in keys) { cacheKeys.Remove(key); } }
/// <summary> /// 批量指定KEY清除缓存 /// </summary> /// <param name="keys"></param> public void RemoveKeyDic(string keys) { try { if (string.IsNullOrWhiteSpace(keys)) { return; } List <MemcacheKey> MemcacheKeyList = GetMemcacheKeyLis(); var keyArray = keys.Split(',').ToList(); MemcacheKeyList.RemoveAll(m => !string.IsNullOrWhiteSpace(m.Key) && keyArray.Contains(m.Key)); DistCache.Add(KeyDic, MemcacheKeyList); foreach (var key in keyArray) { if (!string.IsNullOrWhiteSpace(keys)) { DistCache.Remove(key); } } } catch { } }
public static void RemoveKey(string strKey) { DistCache.Remove(strKey); }
public void Remove(string key) { var a = DistCache.Remove(key); RemoveKeyDic(key); }
public static object Remove(string key) { return(DistCache.Remove(key)); }
/// <summary> /// 移除指定键的缓存数据。 /// </summary> /// <param name="key">键。</param> public static void Remove(string key) { _cache.Remove(key); DistCache.Remove(key); }
public static bool RemoveKey(string strKey) { object obj = DistCache.Remove(strKey); return(Convert.ToBoolean(obj)); }