murlock 3.4.0-beta.2 → 3.4.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -142,6 +142,17 @@ import { MurLockModule } from 'murlock';
|
|
|
142
142
|
})
|
|
143
143
|
export class AppModule {}
|
|
144
144
|
```
|
|
145
|
+
```typescript
|
|
146
|
+
import { MurLock } from 'murlock';
|
|
147
|
+
|
|
148
|
+
@Injectable()
|
|
149
|
+
export class AppService {
|
|
150
|
+
@MurLock(5000, 'someCustomKey', 'userId')
|
|
151
|
+
async someFunction(userId): Promise<void> {
|
|
152
|
+
// Some critical section that only one request should be able to execute at a time
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
145
156
|
|
|
146
157
|
### Ignoring Unlock Failures
|
|
147
158
|
|
|
@@ -160,18 +171,6 @@ MurLockModule.forRoot({
|
|
|
160
171
|
}),
|
|
161
172
|
```
|
|
162
173
|
|
|
163
|
-
```typescript
|
|
164
|
-
import { MurLock } from 'murlock';
|
|
165
|
-
|
|
166
|
-
@Injectable()
|
|
167
|
-
export class AppService {
|
|
168
|
-
@MurLock(5000, 'someCustomKey', 'userId')
|
|
169
|
-
async someFunction(userId): Promise<void> {
|
|
170
|
-
// Some critical section that only one request should be able to execute at a time
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
```
|
|
174
|
-
|
|
175
174
|
If we assume userId as 65782628 Lockey here will be someCustomKey:65782628
|
|
176
175
|
|
|
177
176
|
## Using `MurLockService` Directly
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "murlock",
|
|
3
|
-
"version": "3.4.0-beta.
|
|
3
|
+
"version": "3.4.0-beta.3",
|
|
4
4
|
"description": "A distributed locking solution for NestJS, providing a decorator for critical sections with Redis-based synchronization.",
|
|
5
5
|
"author": "https://github.com/felanios",
|
|
6
6
|
"homepage": "https://github.com/felanios/murlock#readme",
|