easylock
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

easy use redis red-lock

it's for personal use now. use it for you own risk.

 
import withLock from 'easylock'
 
async function exec() {
  
  await withLock('user_id',async ()=>{
    // default red-lock  timeout is 5000 ms
    // do sth with lock to user_id
  })
 
  // or
 
  await withLock({key:'user_id', timeOutInMs:500},async ()=>{
    // do sth with lock to user_id with timeout 500ms
  })
}

plan

[] support withLocks(['lock1','lock2'], ...) [] timeout handle [] tests

Readme

Keywords

none

Package Sidebar

Install

npm i easylock

Weekly Downloads

0

Version

0.1.3

License

MIT

Unpacked Size

4.3 kB

Total Files

5

Last publish

Collaborators

  • stormslowly