From 1af23ac54478af318563b0cd3ec0b2917313d485 Mon Sep 17 00:00:00 2001 From: ztimson Date: Mon, 14 Oct 2024 20:04:29 -0400 Subject: [PATCH] Fixed cache localstorage --- package.json | 2 +- src/cache.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d783897..37bf06e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ztimson/utils", - "version": "0.20.0", + "version": "0.20.1", "description": "Utility library", "author": "Zak Timson", "license": "MIT", diff --git a/src/cache.ts b/src/cache.ts index 5f73dcc..c4ebcb7 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -95,7 +95,7 @@ export class Cache { delete(key: K) { delete this.store[key]; if(this.options.storageKey && this.options.storage) - this.options.storage.setItem(this.options.storageKey, JSON.stringify(this.cache)); + this.options.storage.setItem(this.options.storageKey, JSON.stringify(this.store)); } /** @@ -144,7 +144,7 @@ export class Cache { set(key: K, value: T, ttl = this.options.ttl): this { this.store[key] = value; if(this.options.storageKey && this.options.storage) - this.options.storage.setItem(this.options.storageKey, JSON.stringify(this.cache)); + this.options.storage.setItem(this.options.storageKey, JSON.stringify(this.store)); if(ttl) setTimeout(() => { this.complete = false; this.delete(key);