🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🔧 fix: redis read json object
YuTengjing1718fa378a66
diff --git a/src/app/(backend)/f/[id]/route.ts b/src/app/(backend)/f/[id]/route.tsindex d317a316ee3..33010148af4 100644--- a/src/app/(backend)/f/[id]/route.ts+++ b/src/app/(backend)/f/[id]/route.ts@@ -41,12 +41,13 @@ export const GET = async (_req: Request, segmentData: { params: Params }) => {const redisConfig = getRedisConfig();const redisClient = isRedisEnabled(redisConfig) ? await initializeRedis(redisConfig) : null;+ const cacheKey = buildCacheKey(id);if (redisClient) {- const cached = await redisClient.get(buildCacheKey(id));- if (cached) {- const { redirectUrl } = JSON.parse(cached) as CachedFileData;+ // Upstash Redis auto-deserializes JSON, so cached is already an object+ const cached = (await redisClient.get(cacheKey)) as CachedFileData | null;+ if (cached?.redirectUrl) {log('Cache hit for file: %s', id);- return Response.redirect(redirectUrl, 302);+ return Response.redirect(cached.redirectUrl, 302);}log('Cache miss for file: %s', id);}@@ -73,8 +74,7 @@ export const GET = async (_req: Request, segmentData: { params: Params }) => {// Cache the presigned URL in Redisif (redisClient) {- const cacheData: CachedFileData = { redirectUrl };- await redisClient.set(buildCacheKey(id), JSON.stringify(cacheData), {+ await redisClient.set(cacheKey, JSON.stringify({ redirectUrl }), {ex: PRESIGNED_URL_CACHE_TTL,});log('Cached presigned URL for file: %s (TTL: %ds)', id, PRESIGNED_URL_CACHE_TTL);