@hazeljs/distributed-lock
Advanced tools
+3
-3
| { | ||
| "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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
162262
0.11%188
1.62%+ Added
- Removed
Updated