From 182af0cf9aeeca604ae1051888057f940c759d31 Mon Sep 17 00:00:00 2001 From: Ou Date: Wed, 23 Oct 2024 03:18:50 +0800 Subject: [PATCH] chore: disable cache when development --- server/hooks/useCache.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/hooks/useCache.ts b/server/hooks/useCache.ts index 7ad8996..89b6634 100644 --- a/server/hooks/useCache.ts +++ b/server/hooks/useCache.ts @@ -4,7 +4,9 @@ import { Cache } from "#/database/cache" export function useCache() { try { const db = useDatabase() - if (db && process.env.NODE_ENV === "production") return new Cache(db) + if (process.env.CF_PAGES_BRANCH && process.env.CF_PAGES_BRANCH !== "production") return + if (process.env.NODE_ENV && process.env.NODE_ENV !== "production") return + if (db) return new Cache(db) } catch (e) { logger.error("failed to init database ", e) }