One less call when dealing with lru cache

This commit is contained in:
Ajay 2024-09-14 17:52:50 -04:00
parent 6e5f4f7610
commit 17059fdbe6

View file

@ -104,9 +104,10 @@ if (config.redis?.enabled) {
const createKeyName = (key: RedisCommandArgument) => (key + (config.redis.useCompression ? ".c" : "")) as RedisCommandArgument;
exportClient.getWithCache = (key) => {
if (cache && cacheClient && cache.has(key)) {
const cachedItem = cache && cacheClient && cache.get(key);
if (cachedItem != null) {
memoryCacheHits++;
return Promise.resolve(cache.get(key));
return Promise.resolve(cachedItem);
} else if (shouldClientCacheKey(key)) {
memoryCacheMisses++;
}