MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / getFromCacheBinary

Function getFromCacheBinary

apps/api/src/controllers/misc.controller.ts:44–55  ·  view source on GitHub ↗
(
  key: string,
)

Source from the content-addressed store, hash-verified

42
43// Binary cache functions (more efficient than base64)
44async function getFromCacheBinary(
45 key: string,
46): Promise<{ buffer: Buffer; contentType: string } | null> {
47 const redis = getRedisCache();
48 const [bufferBase64, contentType] = await Promise.all([
49 redis.get(key),
50 redis.get(`${key}:ctype`),
51 ]);
52
53 if (!bufferBase64 || !contentType) return null;
54 return { buffer: Buffer.from(bufferBase64, 'base64'), contentType };
55}
56
57async function setToCacheBinary(
58 key: string,

Callers 2

getFaviconFunction · 0.85
getOgImageFunction · 0.85

Calls 3

getRedisCacheFunction · 0.90
getMethod · 0.45
fromMethod · 0.45

Tested by

no test coverage detected