优化锁的索引绝对值获取
This commit is contained in:
parent
ce937b118c
commit
bf676d6815
|
@ -60,7 +60,8 @@ namespace ShardingCore.Core.ModelCacheLockerProviders
|
|||
}
|
||||
|
||||
var hashCode = (modelCacheKey.ToString() ?? "").GetHashCode();
|
||||
var index = Math.Abs(hashCode % _locks.Count);
|
||||
var lockIndex = hashCode % _locks.Count;
|
||||
var index = lockIndex >= 0 ? lockIndex : Math.Abs(lockIndex);
|
||||
return _locks[index];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue