mirror of
https://github.com/spacebarchat/server.git
synced 2024-09-20 09:41:35 +02:00
fix: local cache
This commit is contained in:
parent
c6708f7443
commit
f1f7e5ad7d
5
src/util/cache/LocalCache.ts
vendored
5
src/util/cache/LocalCache.ts
vendored
@ -38,8 +38,11 @@ export class LocalCache extends Map<string, BaseEntityWithId> implements Cache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set(key: string, value: BaseEntityWithId): this {
|
set(key: string, value: BaseEntityWithId): this {
|
||||||
|
if (this.has(key)) {
|
||||||
|
this.update(key, value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
this.last_access.set(key, Date.now());
|
this.last_access.set(key, Date.now());
|
||||||
if (this.has(key)) this.update(key, value);
|
|
||||||
return super.set(key, value as never);
|
return super.set(key, value as never);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user