mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-05-15 17:34:28 -04:00
move database from postgres/prisma to redis ⚡️
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
|
||||
// creating PrismaClient here prevents next.js from starting too many concurrent prisma instances and exhausting the
|
||||
// number of connection pools available (especially when hot reloading from `next dev`).
|
||||
// https://www.prisma.io/docs/guides/other/troubleshooting-orm/help-articles/nextjs-prisma-client-dev-practices
|
||||
|
||||
const prismaClientSingleton = () => {
|
||||
return new PrismaClient();
|
||||
};
|
||||
|
||||
declare const globalThis: {
|
||||
prismaGlobal: ReturnType<typeof prismaClientSingleton>;
|
||||
} & typeof global;
|
||||
|
||||
export const prisma = globalThis.prismaGlobal ?? prismaClientSingleton();
|
||||
|
||||
if (process.env.NODE_ENV !== "production") globalThis.prismaGlobal = prisma;
|
||||
@@ -0,0 +1,6 @@
|
||||
import { Redis } from "@upstash/redis";
|
||||
|
||||
// Initialize Redis
|
||||
const redis = Redis.fromEnv();
|
||||
|
||||
export default redis;
|
||||
Reference in New Issue
Block a user