import { Redis } from '@upstash/redis'; // No-op client for local dev when Upstash isn't configured. // All cache reads return null (fall through to DB), writes are skipped. const noopRedis = { get: async () => null, set: async () => null, del: async () => null, incr: async () => 1, expire: async () => null, } as unknown as Redis; export const redis: Redis = process.env.UPSTASH_REDIS_REST_URL && process.env.UPSTASH_REDIS_REST_TOKEN ? new Redis({ url: process.env.UPSTASH_REDIS_REST_URL, token: process.env.UPSTASH_REDIS_REST_TOKEN, }) : noopRedis;