Returns false when callers should bypass cache and execute directly.
(key: CacheKey, ttlMs: number)
| 315 | |
| 316 | /** Returns false when callers should bypass cache and execute directly. */ |
| 317 | private canUseCache(key: CacheKey, ttlMs: number): boolean { |
| 318 | if (!this.isRedisClientReady()) { |
| 319 | return false; |
| 320 | } |
| 321 | |
| 322 | const validation = validateInputs([key, ZCacheKey], [ttlMs, ZTtlMs]); |
| 323 | if (!validation.ok) { |
| 324 | logger.warn({ error: validation.error, key }, "Invalid cache inputs, executing function directly"); |
| 325 | return false; |
| 326 | } |
| 327 | |
| 328 | return true; |
| 329 | } |
| 330 | |
| 331 | private isNullableCacheBox<T>(value: unknown): value is NullableCacheBox<T> { |
| 332 | return ( |
no test coverage detected