Skip to content
Distributed locking on Node.js
TypeScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
.npmignore
.travis.yml
LICENSE
README.md
jest.config.json
package.json
tsconfig.build.json
tsconfig.json
tslint.json

README.md

js-locker

Build Status Coverage Status

Distributed locking with pluggable storage for storing locks state.

Basic usage

// Create new Locker
const locker = new Locker({ ttl: 100 })
try {
  // Create and apply lock
  const lock = await locker.lock('key')
  // Do smth  
  await lock.unlock() // Release lock
} catch (err) {
  if (err instanceof TTLError) {
    // Use err.TTL() if need
  } else {
    // Handle err
  }
}

Example usage

You can’t perform that action at this time.