Compare commits

...

1 Commits

Author SHA1 Message Date
08fa5b6783 Clear cache DB correctly
Some checks failed
Build / Build NPM Project (push) Successful in 42s
Build / Publish Documentation (push) Failing after 5s
Build / Tag Version (push) Successful in 8s
2025-07-04 01:23:57 -04:00
2 changed files with 7 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@ztimson/utils", "name": "@ztimson/utils",
"version": "0.25.24", "version": "0.25.25",
"description": "Utility library", "description": "Utility library",
"author": "Zak Timson", "author": "Zak Timson",
"license": "MIT", "license": "MIT",

View File

@ -71,12 +71,12 @@ export class Cache<K extends string | number | symbol, T> {
if(this.options.storage) { if(this.options.storage) {
if(this.options.storage instanceof Table) { if(this.options.storage instanceof Table) {
if(key == null) { if(key == null) {
const rows = this.entries(); let rows: any = this.entries();
rows.forEach(([k, v]) => this.options.storage?.put(k, v)); rows.forEach(([k, v]: [string, any]) => this.options.storage?.put(k, v));
this.options.storage.getAllKeys().then(keys => { rows = rows.map(([k]: [string]) => k);
rows.map(([k]) => k).filter(k => !keys.includes(k)) this.options.storage.getAllKeys().then(keys =>
.forEach(k => this.options.storage?.delete(k)); keys.filter(k => !rows.includes(k))
}) .forEach(k => this.options.storage?.delete(k)));
} else if(this.store[key] === undefined) this.options.storage.delete(key); } else if(this.store[key] === undefined) this.options.storage.delete(key);
else this.options.storage.put(key, this.store[key]); else this.options.storage.put(key, this.store[key]);
} else if(this.options.storageKey) { } else if(this.options.storageKey) {