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