flat-cache
Advanced tools
Comparing version
{ | ||
"name": "flat-cache", | ||
"version": "6.1.6", | ||
"version": "6.1.7", | ||
"description": "A simple key/value storage using files to persist the data", | ||
@@ -55,14 +55,14 @@ "type": "module", | ||
"devDependencies": { | ||
"@types/node": "^22.10.10", | ||
"@vitest/coverage-v8": "^3.0.4", | ||
"@types/node": "^22.13.9", | ||
"@vitest/coverage-v8": "^3.0.7", | ||
"rimraf": "^6.0.1", | ||
"tsup": "^8.3.6", | ||
"typescript": "^5.7.3", | ||
"vitest": "^3.0.4", | ||
"tsup": "^8.4.0", | ||
"typescript": "^5.8.2", | ||
"vitest": "^3.0.7", | ||
"xo": "^0.60.0" | ||
}, | ||
"dependencies": { | ||
"flatted": "^3.3.2", | ||
"hookified": "^1.7.0", | ||
"cacheable": "^1.8.8" | ||
"flatted": "^3.3.3", | ||
"hookified": "^1.7.1", | ||
"cacheable": "^1.8.9" | ||
}, | ||
@@ -69,0 +69,0 @@ "files": [ |
@@ -62,9 +62,24 @@ [<img align="center" src="https://cacheable.org/symbol.svg" alt="Cacheable" />](https://github.com/jaredwray/cacheable) | ||
here is an example doing load from already existing persisted cache | ||
here is an example doing load from already existing persisted cache using the `createFromFile` function: | ||
```javascript | ||
import { load } from 'flat-cache'; | ||
const cache = load('cache1', './cacheAltDirectory'); | ||
import { createFromFile } from 'flat-cache'; | ||
const cache = createFromFile('./cacheAltDirectory/cache1'); | ||
``` | ||
You can also use the legacy load function to do this: | ||
```javascript | ||
import { FlatCache } from 'flat-cache'; | ||
const cache = new FlatCache(); | ||
cache.load('cache1', './cacheAltDirectory'); | ||
``` | ||
or | ||
```javascript | ||
import { FlatCache } from 'flat-cache'; | ||
const cache = new FlatCache({ cacheDir: './cacheAltDirectory' }); | ||
cache.load('cache1'); | ||
``` | ||
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. | ||
@@ -194,2 +209,2 @@ | ||
# License and Copyright | ||
[MIT © Jared Wray](./LICENSE) | ||
[MIT © Jared Wray](./LICENSE) |
Sorry, the diff of this file is not supported yet
52500
0.77%209
8.29%Updated
Updated
Updated