军团:添加锁

This commit is contained in:
luying
2021-01-26 16:53:47 +08:00
parent fb56dd00ec
commit 02b21f27e0
7 changed files with 93 additions and 13 deletions

View File

@@ -34,3 +34,8 @@ export function releaseLock(lockKey: string) {
export function setLock(lockKey: string, lock: any){
userCacheMap.set(lockKey, {lock, time: nowSeconds()})
};
export function getLock(lockKey: string) {
var userCache = userCacheMap.get(lockKey);
return !!userCache && !!userCache.lock
}