( key: string, )
| 42 | |
| 43 | // Binary cache functions (more efficient than base64) |
| 44 | async 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 | |
| 57 | async function setToCacheBinary( |
| 58 | key: string, |
no test coverage detected