Skip to content

Commit

Permalink
Added unregister
Browse files Browse the repository at this point in the history
  • Loading branch information
ackava committed Sep 28, 2024
1 parent 0f9faac commit 24fb743
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/common/cache/TimedCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ export default class TimedCache<TKey = any, T = any> implements Disposable {

constructor(private ttl = 15000) {
const cid = setInterval((x) => x.clearExpired(), this.ttl, this);
w.register(this, cid);
w.register(this, cid, cid);
this.cid = cid;
}

[Symbol.dispose]() {
clearInterval(this.cid);
w.unregister(this.cid);
}

delete(key: any) {
Expand Down

0 comments on commit 24fb743

Please sign in to comment.