mirror of
https://github.com/ahmadk953/tasko.git
synced 2025-05-04 04:33:10 +00:00
Added Prisma Acelerate for Caching
This commit is contained in:
parent
48646e22a7
commit
487605df3e
7 changed files with 21 additions and 3 deletions
|
@ -1,9 +1,11 @@
|
|||
import { PrismaClient } from '@prisma/client';
|
||||
import { withAccelerate } from '@prisma/extension-accelerate';
|
||||
|
||||
declare global {
|
||||
var prisma: PrismaClient | undefined;
|
||||
}
|
||||
|
||||
export const db = globalThis.prisma ?? new PrismaClient();
|
||||
export const db = new PrismaClient().$extends(withAccelerate());
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') globalThis.prisma = db;
|
||||
// if (process.env.NODE_ENV !== 'production') globalThis.prisma = db;
|
||||
// globalThis.prisma ??
|
||||
|
|
|
@ -21,6 +21,7 @@ export const checkSubscription = async () => {
|
|||
stripeCustomerId: true,
|
||||
stripePriceId: true,
|
||||
},
|
||||
cacheStrategy: { ttl: 30, swr: 60 },
|
||||
});
|
||||
|
||||
if (!orgSubscription) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue