Add lru ttl cache implementation (#5997)

* lru ttl cache implementation

* single export lru

* fix lint

* fix hanging tests

* clear intervals in RPCcore

* clear linting issues

* checking export issue on deno ci

* lint

* deno update and rebase

* fixes to stats

* fixes to lint
This commit is contained in:
filvecchiato
2024-10-16 08:39:46 -04:00
committed by GitHub
parent 127122990e
commit a3e1499f20
7 changed files with 135 additions and 41 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ interface CacheValue<T> {
x: number;
}
const CHACHE_EXPIRY = 7 * (24 * 60) * (60 * 1000);
const CACHE_EXPIRY = 7 * (24 * 60) * (60 * 1000);
let deriveCache: DeriveCache;
@@ -43,7 +43,7 @@ function clearCache (cache: DeriveCache): void {
const all: string[] = [];
cache.forEach((key: string, { x }: CacheValue<any>): void => {
((now - x) > CHACHE_EXPIRY) && all.push(key);
((now - x) > CACHE_EXPIRY) && all.push(key);
});
// don't do delete inside loop, just in-case