Skip to content

Commit 47ac220

Browse files
committed
fix: cache defaults not working
1 parent 0ea02f5 commit 47ac220

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@squarecloud/api": patch
3+
---
4+
5+
Fix cache defaults not working.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/services/cache/application.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface ApplicationCache {
1010
}
1111

1212
export class ApplicationCacheService extends BaseCacheService<ApplicationCache> {
13-
protected defaults: ApplicationCache = {
13+
protected cache: ApplicationCache = {
1414
status: undefined,
1515
backups: undefined,
1616
logs: undefined,

src/services/cache/base.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ export class BaseCacheService<
33
Keys extends keyof Struct = keyof Struct,
44
> {
55
protected cache: Struct;
6-
protected defaults: Struct;
76

87
set<T extends Keys>(key: T, value: Struct[T]) {
98
Reflect.set(this, key, value);
@@ -13,7 +12,7 @@ export class BaseCacheService<
1312
return this.cache[key];
1413
}
1514

16-
clear() {
17-
Reflect.set(this, "cache", this.defaults);
15+
remove<T extends Keys>(key: T) {
16+
Reflect.set(this.cache, key, undefined);
1817
}
1918
}

src/services/cache/global.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export interface GlobalCache {
66
}
77

88
export class GlobalCacheService extends BaseCacheService<GlobalCache> {
9-
protected defaults: GlobalCache = {
9+
protected cache: GlobalCache = {
1010
user: undefined,
1111
};
1212

0 commit comments

Comments
 (0)