flat-cache 6.1.6 → 6.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/README.md CHANGED
@@ -59,11 +59,26 @@ cache.setKey('key', 'value');
59
59
 
60
60
  This will save the data to disk every 5 minutes and will remove any data that has not been accessed in 1 hour or if the cache has more than 10,000 items. The `expirationInterval` will check every 5 minutes for expired items and evict them. This is replacement to the `save()` method with a `prune` option as it is no longer needed due to the fact that the in-memory cache handles pruning by `ttl` expiration or `lruSize` which will keep the most recent there.
61
61
 
62
- here is an example doing load from already existing persisted cache
62
+ here is an example doing load from already existing persisted cache using the `createFromFile` function:
63
63
 
64
64
  ```javascript
65
- import { load } from 'flat-cache';
66
- const cache = load('cache1', './cacheAltDirectory');
65
+ import { createFromFile } from 'flat-cache';
66
+ const cache = createFromFile('./cacheAltDirectory/cache1');
67
+ ```
68
+
69
+ You can also use the legacy load function to do this:
70
+
71
+ ```javascript
72
+ import { FlatCache } from 'flat-cache';
73
+ const cache = new FlatCache();
74
+ cache.load('cache1', './cacheAltDirectory');
75
+ ```
76
+ or
77
+
78
+ ```javascript
79
+ import { FlatCache } from 'flat-cache';
80
+ const cache = new FlatCache({ cacheDir: './cacheAltDirectory' });
81
+ cache.load('cache1');
67
82
  ```
68
83
 
69
84
  This will load the cache from the `./cacheAltDirectory` directory with the `cache1` id. If it doesnt exist it will not throw an error but will just return an empty cache.
@@ -190,4 +205,4 @@ This will use `JSON.parse` and `JSON.stringify` to parse and stringify the data.
190
205
  You can contribute by forking the repo and submitting a pull request. Please make sure to add tests and update the documentation. To learn more about how to contribute go to our main README [https://github.com/jaredwray/cacheable](https://github.com/jaredwray/cacheable). This will talk about how to `Open a Pull Request`, `Ask a Question`, or `Post an Issue`.
191
206
 
192
207
  # License and Copyright
193
- [MIT © Jared Wray](./LICENSE)
208
+ [MIT © Jared Wray](./LICENSE)
package/dist/index.cjs CHANGED
@@ -28,8 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
33
  FlatCache: () => FlatCache,
34
34
  FlatCacheEvents: () => FlatCacheEvents,
35
35
  clearAll: () => clearAll,
@@ -38,7 +38,7 @@ __export(src_exports, {
38
38
  createFromFile: () => createFromFile,
39
39
  default: () => FlatCacheDefault
40
40
  });
41
- module.exports = __toCommonJS(src_exports);
41
+ module.exports = __toCommonJS(index_exports);
42
42
  var import_node_path = __toESM(require("path"), 1);
43
43
  var import_node_fs = __toESM(require("fs"), 1);
44
44
  var import_cacheable = require("cacheable");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flat-cache",
3
- "version": "6.1.6",
3
+ "version": "6.1.7",
4
4
  "description": "A simple key/value storage using files to persist the data",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -52,18 +52,18 @@
52
52
  "file-system-cache"
53
53
  ],
54
54
  "devDependencies": {
55
- "@types/node": "^22.10.10",
56
- "@vitest/coverage-v8": "^3.0.4",
55
+ "@types/node": "^22.13.9",
56
+ "@vitest/coverage-v8": "^3.0.7",
57
57
  "rimraf": "^6.0.1",
58
- "tsup": "^8.3.6",
59
- "typescript": "^5.7.3",
60
- "vitest": "^3.0.4",
58
+ "tsup": "^8.4.0",
59
+ "typescript": "^5.8.2",
60
+ "vitest": "^3.0.7",
61
61
  "xo": "^0.60.0"
62
62
  },
63
63
  "dependencies": {
64
- "flatted": "^3.3.2",
65
- "hookified": "^1.7.0",
66
- "cacheable": "^1.8.8"
64
+ "flatted": "^3.3.3",
65
+ "hookified": "^1.7.1",
66
+ "cacheable": "^1.8.9"
67
67
  },
68
68
  "files": [
69
69
  "dist",