|
|
@ -17,15 +17,18 @@ namespace Common.Tools
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Redis 地址 默认使用 sysOptionConfig.Webconfig.Redis 配置信息的
|
|
|
|
/// Redis 地址 默认使用 sysOptionConfig.Webconfig.Redis 配置信息的
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static string RedisContext { set {
|
|
|
|
public static string RedisContext
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
|
|
{
|
|
|
|
_RedisContext = value;
|
|
|
|
_RedisContext = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
get { return _RedisContext; }
|
|
|
|
get { return _RedisContext; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// rendisDB
|
|
|
|
/// rendisDB
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static RedisClient DbRedis = new RedisClient(RedisContext);
|
|
|
|
public static RedisClient DbRedis = new RedisClient(RedisContext);
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 删除单个键值对
|
|
|
|
/// 删除单个键值对
|
|
|
@ -45,15 +48,19 @@ namespace Common.Tools
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var keylist = DbRedis.Keys(keymodel);
|
|
|
|
var keylist = DbRedis.Keys(keymodel);
|
|
|
|
return DbRedis.Del(keylist);
|
|
|
|
if (keylist != null && keylist.Any())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return DbRedis.Del(keylist);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 清理统计redis键值 谨慎清理建议指定特定时间执行一次
|
|
|
|
/// 清理统计redis键值 谨慎清理建议指定特定时间执行一次
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
public static long RedisClenaRuncount() {
|
|
|
|
public static long RedisClenaRuncount()
|
|
|
|
return RedisClena("runcount_*");
|
|
|
|
{
|
|
|
|
|
|
|
|
return RedisClena("runcount_*");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
///增加 通过redis统计计数
|
|
|
|
///增加 通过redis统计计数
|
|
|
@ -93,10 +100,11 @@ namespace Common.Tools
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return listarry.ToList().ConvertAll(s => long.Parse(s)).Count(s => s >= _time);
|
|
|
|
return listarry.ToList().ConvertAll(s => long.Parse(s)).Count(s => s >= _time);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
{
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch { return 0; }
|
|
|
|
catch { return 0; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|