Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement โ†’
Sign In

@hazeljs/distributed-lock

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hazeljs/distributed-lock - npm Package Compare versions

Comparing version
0.7.9
to
0.8.0
+3
-3
package.json
{
"name": "@hazeljs/distributed-lock",
"version": "0.7.9",
"version": "0.8.0",
"description": "Distributed locking and synchronization primitives for HazelJS - Mutex, Semaphores, Read/Write locks",

@@ -20,3 +20,3 @@ "main": "dist/index.js",

"dependencies": {
"@hazeljs/core": "^0.7.9",
"@hazeljs/core": "^0.8.0",
"reflect-metadata": "^0.2.2"

@@ -50,3 +50,3 @@ },

"license": "Apache-2.0",
"gitHead": "28c21c509aeca3bf2d0878fbee737d906b654c67"
"gitHead": "e0ed98ca074dd4f7472816d3c32ef576900dcca6"
}
+24
-21

@@ -50,6 +50,6 @@ # @hazeljs/distributed-lock

class UserProfileService {
@DistributedLock({
key: 'update-profile-{userId}',
ttl: 10000,
wait: true
@DistributedLock({
key: 'update-profile-{userId}',
ttl: 10000,
wait: true,
})

@@ -116,5 +116,8 @@ async updateProfile(userId: string, data: any) {

lockManager.setupRedis({
url: 'redis://localhost:6379',
}, 'redis-prod');
lockManager.setupRedis(
{
url: 'redis://localhost:6379',
},
'redis-prod'
);

@@ -128,8 +131,8 @@ lockManager.setDefaultBackend('redis-prod');

| | In-Memory | Redis | Custom |
|---|:---:|:---:|:---:|
| **Distributed** | โŒ (Single node) | โœ… (All nodes) | โœ… (Interface-based) |
| **Setup** | None | Required | Custom impl |
| **Best For** | Development / Testing | Production / High Load | Specialized systems |
| **Performance** | Nano-seconds | Milli-seconds | Backend-dependent |
| | In-Memory | Redis | Custom |
| --------------- | :-------------------: | :--------------------: | :------------------: |
| **Distributed** | โŒ (Single node) | โœ… (All nodes) | โœ… (Interface-based) |
| **Setup** | None | Required | Custom impl |
| **Best For** | Development / Testing | Production / High Load | Specialized systems |
| **Performance** | Nano-seconds | Milli-seconds | Backend-dependent |

@@ -140,10 +143,10 @@ ---

| Option | Type | Description |
| --- | --- | --- |
| `key` | `string` | The unique lock identifier. Supports `{param}` placeholders from method args. |
| `ttl` | `number` | Time-To-Live in milliseconds. Default: `5000`. |
| `wait` | `boolean` | If true, will wait for the lock if held. Default: `false`. |
| `retryCount`| `number` | Number of retries if `wait` is true. Default: `3`. |
| `retryDelay`| `number` | Time between retries in milliseconds. Default: `100`. |
| `backend` | `string` | Override the default backend (e.g., `'memory'`, `'redis'`). |
| Option | Type | Description |
| ------------ | --------- | ----------------------------------------------------------------------------- |
| `key` | `string` | The unique lock identifier. Supports `{param}` placeholders from method args. |
| `ttl` | `number` | Time-To-Live in milliseconds. Default: `5000`. |
| `wait` | `boolean` | If true, will wait for the lock if held. Default: `false`. |
| `retryCount` | `number` | Number of retries if `wait` is true. Default: `3`. |
| `retryDelay` | `number` | Time between retries in milliseconds. Default: `100`. |
| `backend` | `string` | Override the default backend (e.g., `'memory'`, `'redis'`). |

@@ -150,0 +153,0 @@ ---

Sorry, the diff of this file is not supported yet