diff options
author | Samuel <34555296+Flam3rboy@users.noreply.github.com> | 2023-03-18 05:11:14 +0100 |
---|---|---|
committer | Samuel <34555296+Flam3rboy@users.noreply.github.com> | 2023-03-18 05:11:14 +0100 |
commit | f1f7e5ad7d7f197cd741f248011cc45636a0f434 (patch) | |
tree | 2559889572534b906b0bebfab140af41f4690f8e | |
parent | build: remove sqlite3 in favor of better-sqlite3 (diff) | |
download | server-f1f7e5ad7d7f197cd741f248011cc45636a0f434.tar.xz |
fix: local cache
-rw-r--r-- | src/util/cache/LocalCache.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/util/cache/LocalCache.ts b/src/util/cache/LocalCache.ts index 547899ac..9c4f23b3 100644 --- a/src/util/cache/LocalCache.ts +++ b/src/util/cache/LocalCache.ts @@ -38,8 +38,11 @@ export class LocalCache extends Map<string, BaseEntityWithId> implements Cache { } set(key: string, value: BaseEntityWithId): this { + if (this.has(key)) { + this.update(key, value); + return this; + } this.last_access.set(key, Date.now()); - if (this.has(key)) this.update(key, value); return super.set(key, value as never); } |