Fixed cache save to db
Some checks failed
Build / Build NPM Project (push) Successful in 43s
Build / Publish Documentation (push) Failing after 5s
Build / Tag Version (push) Successful in 8s

This commit is contained in:
2025-07-07 12:41:44 -04:00
parent d748d740ea
commit 387e6b2512
2 changed files with 3 additions and 3 deletions

View File

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

View File

@ -75,10 +75,10 @@ export class Cache<K extends string | number | symbol, T> {
}
private save(key?: K) {
const persists: any = this.options.persistentStorage;
const persists: {storage: any, key: string} = <any>this.options.persistentStorage;
if(!!persists?.storage) {
if(persists.storage?.constructor.name == 'Database') {
(<Database>persists.storage).createTable({name: persists.storage.key, key: <string>this.key}).then(table => {
(<Database>persists.storage).createTable({name: persists.key, key: <string>this.key}).then(table => {
if(key) {
table.set(key, this.get(key));
} else {