feat: first draft
This commit is contained in:
18
utils/redis.ts
Normal file
18
utils/redis.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Redis } from '@upstash/redis';
|
||||
|
||||
if (!process.env.KV_REST_API_URL) {
|
||||
throw new Error('KV_REST_API_URL is not defined');
|
||||
}
|
||||
|
||||
if (!process.env.KV_REST_API_TOKEN) {
|
||||
throw new Error('KV_REST_API_TOKEN is not defined');
|
||||
}
|
||||
|
||||
export const redis = new Redis({
|
||||
url: process.env.KV_REST_API_URL,
|
||||
token: process.env.KV_REST_API_TOKEN,
|
||||
retry: {
|
||||
retries: 3,
|
||||
backoff: (retryCount) => Math.min(retryCount * 100, 3000),
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user