/// <summary> /// 模糊查询Key并删除(请慎用) /// </summary> /// <param name="keysPattern"></param> public static void DelBySearchKey(string keysPattern) { if (string.IsNullOrWhiteSpace(keysPattern)) { return; } try { RedisKey rk = keysPattern.RedisProtobuf(); IList <string> keyslist = rk.Keys(); Del(keyslist.ToList()); } catch (Exception ex) { string errstr = "删除数据失败,Method=DelBySearchKey(string keysPattern),keysPattern=" + keysPattern; Logger.RedisLog.Error(errstr, ex); throw ex; } }
/// <summary> /// 查找Keys /// </summary> /// <param name="keysPattern">查询表达式</param> /// <returns>返回Key列表</returns> public static IList <string> SearchKeyList(string keysPattern) { RedisKey rk = keysPattern.RedisProtobuf(); return(rk.Keys()); }