Compare commits

..

2 Commits

Author SHA1 Message Date
d140b2edd1 Revert: Restoring cache from DB gets complete status
All checks were successful
Build / Build NPM Project (push) Successful in 41s
Build / Tag Version (push) Successful in 8s
Build / Publish Documentation (push) Successful in 32s
2025-06-29 22:41:39 -04:00
56f6681492 Restoring cache from DB gets complete status
All checks were successful
Build / Build NPM Project (push) Successful in 47s
Build / Tag Version (push) Successful in 15s
Build / Publish Documentation (push) Successful in 52s
2025-06-29 22:29:16 -04:00
2 changed files with 2 additions and 7 deletions

View File

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

View File

@ -34,12 +34,7 @@ export class Cache<K extends string | number | symbol, T> {
if(options.storageKey && !options.storage && typeof(Storage) !== 'undefined') options.storage = localStorage;
if(options.storage) {
if(options.storage instanceof Table) {
(async () => (await options.storage?.getAll()).forEach((v: any) => {
if(v) {
try { this.add(v) }
catch { }
}
}))()
(async () => this.addAll(await options.storage?.getAll(), false))()
} else if(options.storageKey) {
const stored = options.storage?.getItem(options.storageKey);
if(stored != null) try { Object.assign(this.store, JSON.parse(stored)); } catch { }