diff --git a/src/lib/redis.server.ts b/src/lib/redis.server.ts index 3a642639be..de69d298e7 100644 --- a/src/lib/redis.server.ts +++ b/src/lib/redis.server.ts @@ -57,7 +57,7 @@ export async function cacheGet(options: { console.error("Redis get error: ", error) } - const set = (value: string | Record) => { + const set = (value: Record) => { if (value) { if (options.noExpire) { redis.set(redisKey, JSON.stringify(value)) @@ -77,7 +77,9 @@ export async function cacheGet(options: { if (options.durable) { const ttl = await redis.ttl(redisKey) if (ttl < (options.expireTime || REDIS_EXPIRE) - options.durable) { - set(cacheValue) + try { + set(JSON.parse(cacheValue)) + } catch (error) {} options.getValueFun().then((value) => { set(value) })