😎修改验证码缓存过期时间使用验证码配置的
This commit is contained in:
parent
91b9e35146
commit
ae6e183054
@ -42,8 +42,8 @@ public class CaptchaDistributedCache : IDistributedCache
|
||||
|
||||
public void Set(string key, byte[] value, DistributedCacheEntryOptions options)
|
||||
{
|
||||
var timeSpan = options.AbsoluteExpirationRelativeToNow != null ? options.AbsoluteExpirationRelativeToNow.Value : TimeSpan.FromMinutes(1);
|
||||
_cacheProvider.Cache.Set(GetKey(key), value, timeSpan);
|
||||
TimeSpan timeDifference = options.AbsoluteExpiration.Value.Subtract(DateTimeOffset.Now);
|
||||
_cacheProvider.Cache.Set(GetKey(key), value, (int)timeDifference.TotalSeconds);
|
||||
}
|
||||
|
||||
public Task SetAsync(string key, byte[] value, DistributedCacheEntryOptions options, CancellationToken token = default)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user