diff --git a/apps/web/actions.ts b/apps/web/actions.ts index 1959860..8ef91d3 100644 --- a/apps/web/actions.ts +++ b/apps/web/actions.ts @@ -3,11 +3,14 @@ import { Redis } from '@upstash/redis' import { revalidatePath } from 'next/cache' import { cookies } from 'next/headers' +import { TTL_SECONDS } from '@/constants' export const saveGeneration = async (data: { sqlSchema: string; cmdCode: string }) => { const { cmdCode, sqlSchema } = data const redis = Redis.fromEnv() const res = await redis.set(cmdCode, sqlSchema) + await redis.expire(cmdCode, TTL_SECONDS) + return res } diff --git a/apps/web/constants.ts b/apps/web/constants.ts index 5dfe4e2..7ca27c4 100644 --- a/apps/web/constants.ts +++ b/apps/web/constants.ts @@ -2,3 +2,5 @@ export const APP_URL = process.env.NODE_ENV === 'development' ? 'http://localhost:3000' : 'https://vdbs.vercel.app/' export const TOTAL_GENERATIONS = 1 +// 1 hour +export const TTL_SECONDS = 60 * 60