优化
This commit is contained in:
@@ -17,13 +17,21 @@ namespace WMS.Web.Domain.Services.Public
|
||||
public bool CanAccessMethod(string cacheKey)
|
||||
{
|
||||
// 使用 Redis 来存储并发控制标记
|
||||
return _redisClientService.SetStringKey(cacheKey, "true", TimeSpan.FromMinutes(1));
|
||||
return _redisClientService.SetStringKey<bool>(cacheKey, true, TimeSpan.FromMinutes(1));
|
||||
}
|
||||
|
||||
|
||||
public bool GetRedisKeyValue(string cacheKey)
|
||||
{
|
||||
// 使用 Redis 来存储并发控制标记
|
||||
var isSuccess= _redisClientService.GetStringKey<bool>(cacheKey);
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
public void UpdateAccessStatus(string cacheKey, bool canAccess)
|
||||
{
|
||||
// 更新 Redis 缓存项的值
|
||||
_redisClientService.SetStringKey(cacheKey, canAccess.ToString(), TimeSpan.FromMinutes(1));
|
||||
_redisClientService.SetStringKey<bool>(cacheKey, canAccess, TimeSpan.FromMinutes(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user