Use expire overload
This commit is contained in:
parent
b03439496a
commit
b1adf62c33
@ -72,8 +72,7 @@ namespace NadekoBot.Core.Services.Impl
|
|||||||
var time = TimeSpan.FromHours(period);
|
var time = TimeSpan.FromHours(period);
|
||||||
if ((bool?)_db.StringGet($"{_redisKey}_timelyclaim_{id}") == null)
|
if ((bool?)_db.StringGet($"{_redisKey}_timelyclaim_{id}") == null)
|
||||||
{
|
{
|
||||||
_db.StringSet($"{_redisKey}_timelyclaim_{id}", true);
|
_db.StringSet($"{_redisKey}_timelyclaim_{id}", true, time);
|
||||||
_db.KeyExpire($"{_redisKey}_timelyclaim_{id}", time);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return _db.KeyTimeToLive($"{_redisKey}_timelyclaim_{id}");
|
return _db.KeyTimeToLive($"{_redisKey}_timelyclaim_{id}");
|
||||||
@ -95,8 +94,7 @@ namespace NadekoBot.Core.Services.Impl
|
|||||||
if (time == null)
|
if (time == null)
|
||||||
{
|
{
|
||||||
time = TimeSpan.FromMinutes(30);
|
time = TimeSpan.FromMinutes(30);
|
||||||
_db.StringSet($"{_redisKey}_affinity_{userId}", true);
|
_db.StringSet($"{_redisKey}_affinity_{userId}", true, time);
|
||||||
_db.KeyExpire($"{_redisKey}_affinity_{userId}", time);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -108,8 +106,7 @@ namespace NadekoBot.Core.Services.Impl
|
|||||||
if (time == null)
|
if (time == null)
|
||||||
{
|
{
|
||||||
time = TimeSpan.FromHours(6);
|
time = TimeSpan.FromHours(6);
|
||||||
_db.StringSet($"{_redisKey}_divorce_{userId}", true);
|
_db.StringSet($"{_redisKey}_divorce_{userId}", true, time);
|
||||||
_db.KeyExpire($"{_redisKey}_divorce_{userId}", time);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user