We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
该实现依赖于CSRedisCore包
CSRedisCore
/// <summary> /// Redis锁 /// </summary> /// <param name="lockKey">锁</param> /// <param name="delyInterval">锁失效时间 单位:秒</param> /// <returns></returns> private bool LockOrderNo(string lockKey, int delyInterval = 120) { if (RedisHelper.SetNx(lockKey, DateTime.Now.AddSeconds(delyInterval).ToFileTimeUtc())) { RedisHelper.Expire(lockKey, delyInterval); return true; } else { var lockValue = RedisHelper.Get<long>(lockKey); if (DateTime.Now.ToFileTimeUtc() > lockValue) { RedisHelper.GetSet<long>(lockKey, DateTime.Now.AddSeconds(delyInterval).ToFileTimeUtc()); RedisHelper.Expire(lockKey, delyInterval); return true; } } return false; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
该实现依赖于
CSRedisCore
包The text was updated successfully, but these errors were encountered: