MCPcopy Index your code
hub / github.com/formbricks/formbricks / canUseCache

Method canUseCache

packages/cache/src/service.ts:317–329  ·  view source on GitHub ↗

Returns false when callers should bypass cache and execute directly.

(key: CacheKey, ttlMs: number)

Source from the content-addressed store, hash-verified

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 (

Callers 2

withCacheMethod · 0.95
withCacheNullableMethod · 0.95

Calls 2

isRedisClientReadyMethod · 0.95
validateInputsFunction · 0.90

Tested by

no test coverage detected