@nxtedition/cache 2.1.6 → 2.1.7

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/lib/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export interface DatabaseOptions {
7
7
  }
8
8
  export interface LockOptions {
9
9
  minTimeout?: number;
10
+ maxTimeout?: number;
10
11
  }
11
12
  export interface Serializer<V> {
12
13
  serialize: (value: V) => Buffer | Uint8Array | string;
package/lib/index.js CHANGED
@@ -39,6 +39,7 @@ const dbs = new Set ()
39
39
 
40
40
 
41
41
 
42
+
42
43
 
43
44
 
44
45
 
@@ -177,6 +178,12 @@ export class Cache extends EventEmi
177
178
  this.#lockTimeout = this.#lockMinTimeout
178
179
  this.#lockMean = this.#lockTimeout / 1.2
179
180
  }
181
+ if (opts.lock.maxTimeout !== undefined) {
182
+ if (typeof opts.lock.maxTimeout !== 'number') {
183
+ throw new TypeError('lock.maxTimeout must be a number')
184
+ }
185
+ this.#lockMaxTimeout = Math.max(this.#lockMinTimeout, opts.lock.maxTimeout)
186
+ }
180
187
  }
181
188
 
182
189
  if (opts?.serializer !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/cache",
3
- "version": "2.1.6",
3
+ "version": "2.1.7",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -30,5 +30,5 @@
30
30
  "tsd": "^0.33.0",
31
31
  "typescript": "^5.9.3"
32
32
  },
33
- "gitHead": "a7202d8b4d3decaff213576df560e8cd5775db37"
33
+ "gitHead": "160284d139399d39195532624e26d564aa8c8003"
34
34
  }