Fixed cache save to db
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/utils",
|
"name": "@ztimson/utils",
|
||||||
"version": "0.26.0",
|
"version": "0.26.1",
|
||||||
"description": "Utility library",
|
"description": "Utility library",
|
||||||
"author": "Zak Timson",
|
"author": "Zak Timson",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -75,10 +75,10 @@ export class Cache<K extends string | number | symbol, T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private save(key?: K) {
|
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) {
|
||||||
if(persists.storage?.constructor.name == 'Database') {
|
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) {
|
if(key) {
|
||||||
table.set(key, this.get(key));
|
table.set(key, this.get(key));
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user