@cacheable/node-cache 1.6.1 → 1.7.1

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/dist/index.cjs CHANGED
@@ -31,11 +31,10 @@ var import_hookified2 = require("hookified");
31
31
 
32
32
  // src/store.ts
33
33
  var import_cacheable = require("cacheable");
34
- var import_keyv = require("keyv");
35
34
  var import_hookified = require("hookified");
36
35
  var NodeCacheStore = class extends import_hookified.Hookified {
37
36
  _maxKeys = 0;
38
- _cache = new import_cacheable.Cacheable({ primary: new import_keyv.Keyv({ store: new import_cacheable.CacheableMemory() }) });
37
+ _cache = new import_cacheable.Cacheable();
39
38
  constructor(options) {
40
39
  super();
41
40
  if (options) {
@@ -150,9 +149,13 @@ var NodeCacheStore = class extends import_hookified.Hookified {
150
149
  * @returns {void}
151
150
  */
152
151
  async mset(list) {
153
- const items = new Array();
152
+ const items = [];
154
153
  for (const item of list) {
155
- items.push({ key: item.key.toString(), value: item.value, ttl: item.ttl });
154
+ items.push({
155
+ key: item.key.toString(),
156
+ value: item.value,
157
+ ttl: item.ttl
158
+ });
156
159
  }
157
160
  await this._cache.setMany(items);
158
161
  }
@@ -239,7 +242,6 @@ var NodeCacheErrors = /* @__PURE__ */ ((NodeCacheErrors2) => {
239
242
  })(NodeCacheErrors || {});
240
243
  var NodeCache = class extends import_hookified2.Hookified {
241
244
  options = {
242
- // eslint-disable-next-line @typescript-eslint/naming-convention
243
245
  stdTTL: 0,
244
246
  checkperiod: 600,
245
247
  useClones: true,
@@ -289,7 +291,11 @@ var NodeCache = class extends import_hookified2.Hookified {
289
291
  throw this.createError("Cache max keys amount exceeded" /* ECACHEFULL */, this.formatKey(key));
290
292
  }
291
293
  }
292
- this.store.set(keyValue, { key: keyValue, value, ttl: expirationTimestamp });
294
+ this.store.set(keyValue, {
295
+ key: keyValue,
296
+ value,
297
+ ttl: expirationTimestamp
298
+ });
293
299
  this.emit("set", keyValue, value, ttlValue);
294
300
  this._stats.incrementKSize(keyValue);
295
301
  this._stats.incrementVSize(value);
package/dist/index.js CHANGED
@@ -1,14 +1,13 @@
1
1
  // src/index.ts
2
- import { CacheableMemory as CacheableMemory2, CacheableStats, shorthandToTime } from "cacheable";
2
+ import { CacheableMemory, CacheableStats, shorthandToTime } from "cacheable";
3
3
  import { Hookified as Hookified2 } from "hookified";
4
4
 
5
5
  // src/store.ts
6
- import { Cacheable, CacheableMemory } from "cacheable";
7
- import { Keyv } from "keyv";
6
+ import { Cacheable } from "cacheable";
8
7
  import { Hookified } from "hookified";
9
8
  var NodeCacheStore = class extends Hookified {
10
9
  _maxKeys = 0;
11
- _cache = new Cacheable({ primary: new Keyv({ store: new CacheableMemory() }) });
10
+ _cache = new Cacheable();
12
11
  constructor(options) {
13
12
  super();
14
13
  if (options) {
@@ -123,9 +122,13 @@ var NodeCacheStore = class extends Hookified {
123
122
  * @returns {void}
124
123
  */
125
124
  async mset(list) {
126
- const items = new Array();
125
+ const items = [];
127
126
  for (const item of list) {
128
- items.push({ key: item.key.toString(), value: item.value, ttl: item.ttl });
127
+ items.push({
128
+ key: item.key.toString(),
129
+ value: item.value,
130
+ ttl: item.ttl
131
+ });
129
132
  }
130
133
  await this._cache.setMany(items);
131
134
  }
@@ -212,7 +215,6 @@ var NodeCacheErrors = /* @__PURE__ */ ((NodeCacheErrors2) => {
212
215
  })(NodeCacheErrors || {});
213
216
  var NodeCache = class extends Hookified2 {
214
217
  options = {
215
- // eslint-disable-next-line @typescript-eslint/naming-convention
216
218
  stdTTL: 0,
217
219
  checkperiod: 600,
218
220
  useClones: true,
@@ -221,7 +223,7 @@ var NodeCache = class extends Hookified2 {
221
223
  };
222
224
  store = /* @__PURE__ */ new Map();
223
225
  _stats = new CacheableStats({ enabled: true });
224
- _cacheable = new CacheableMemory2();
226
+ _cacheable = new CacheableMemory();
225
227
  intervalId = 0;
226
228
  constructor(options) {
227
229
  super();
@@ -262,7 +264,11 @@ var NodeCache = class extends Hookified2 {
262
264
  throw this.createError("Cache max keys amount exceeded" /* ECACHEFULL */, this.formatKey(key));
263
265
  }
264
266
  }
265
- this.store.set(keyValue, { key: keyValue, value, ttl: expirationTimestamp });
267
+ this.store.set(keyValue, {
268
+ key: keyValue,
269
+ value,
270
+ ttl: expirationTimestamp
271
+ });
266
272
  this.emit("set", keyValue, value, ttlValue);
267
273
  this._stats.incrementKSize(keyValue);
268
274
  this._stats.incrementVSize(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cacheable/node-cache",
3
- "version": "1.6.1",
3
+ "version": "1.7.1",
4
4
  "description": "Simple and Maintained fast NodeJS internal caching",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -12,6 +12,9 @@
12
12
  "import": "./dist/index.js"
13
13
  }
14
14
  },
15
+ "engines": {
16
+ "node": ">=18"
17
+ },
15
18
  "repository": {
16
19
  "type": "git",
17
20
  "url": "git+https://github.com/jaredwray/cacheable.git",
@@ -31,19 +34,19 @@
31
34
  "cacheable-node"
32
35
  ],
33
36
  "devDependencies": {
34
- "@types/eslint": "^9.6.1",
35
- "@types/node": "^24.1.0",
37
+ "@biomejs/biome": "^2.2.4",
38
+ "@faker-js/faker": "^10.0.0",
39
+ "@types/node": "^24.5.0",
36
40
  "@vitest/coverage-v8": "^3.2.4",
37
41
  "rimraf": "^6.0.1",
38
42
  "tsup": "^8.5.0",
39
- "typescript": "^5.8.3",
40
- "vitest": "^3.2.4",
41
- "xo": "^1.2.1"
43
+ "typescript": "^5.9.2",
44
+ "vitest": "^3.2.4"
42
45
  },
43
46
  "dependencies": {
44
- "hookified": "^1.10.0",
45
- "keyv": "^5.4.0",
46
- "cacheable": "^1.10.3"
47
+ "hookified": "^1.12.0",
48
+ "keyv": "^5.5.1",
49
+ "cacheable": "^2.0.1"
47
50
  },
48
51
  "files": [
49
52
  "dist",
@@ -52,8 +55,9 @@
52
55
  "scripts": {
53
56
  "build": "rimraf ./dist && tsup src/index.ts --format cjs,esm --dts --clean",
54
57
  "prepublish": "pnpm build",
55
- "test": "xo --fix && vitest run --coverage",
56
- "test:ci": "xo && vitest run --coverage",
58
+ "lint": "biome check --write --error-on-warnings",
59
+ "test": "pnpm lint && vitest run --coverage",
60
+ "test:ci": "biome check --error-on-warnings && vitest run --coverage",
57
61
  "clean": "rimraf ./dist ./coverage ./node_modules"
58
62
  }
59
63
  }