Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
08fa5b6783 |
@ -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",
|
||||||
|
12
src/cache.ts
12
src/cache.ts
@ -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) {
|
||||||
|
Reference in New Issue
Block a user