Skip to content

Minimalism single thread ordered lock for distributed clients.

Notifications You must be signed in to change notification settings

mufancom/ordered-lock

Repository files navigation

NPM Package Build Status

Ordered Lock

Minimalist single thread ordered lock for distributed clients.

Installation

All-in-One

yarn add ordered-lock
import {Client} from 'ordered-lock';

let client = new Client({
  connect: {
    host: 'ordered-lock',
    port: 3292,
  },
  lock: {
    ttl: 2,
    lockingTimeout: 10,
  },
});

client.lock('123', async extend => {
  // ...

  extend(2);
});

client.lock(['123', '456'], async extend => {
  // ...
});

You probably don't need to use the server library, check out the Docker image.

import {Server} from 'ordered-lock/server';

// ...

Docker

docker pull makeflow/ordered-lock

It listens on port 3292.

License

MIT License.

About

Minimalism single thread ordered lock for distributed clients.

Resources

Stars

Watchers

Forks

Packages

No packages published