diff --git a/src/utils/getHashCache.ts b/src/utils/getHashCache.ts index f843836..14d30c6 100644 --- a/src/utils/getHashCache.ts +++ b/src/utils/getHashCache.ts @@ -4,8 +4,11 @@ import { HashedValue } from "../types/hash.model"; import { Logger } from "../utils/logger"; import { getHash } from "../utils/getHash"; -export async function getHashCache(value: T, times = 5000): Promise { - if (times === 5000) { +const defaultedHashTimes = 5000; +const cachedHashTimes = defaultedHashTimes - 1; + +export async function getHashCache(value: T, times = defaultedHashTimes): Promise { + if (times === defaultedHashTimes) { const hashKey = getHash(value, 1); const result: HashedValue = await getFromRedis(hashKey); return result as T & HashedValue; @@ -25,7 +28,7 @@ async function getFromRedis(key: HashedValue): Promise