add cache to prisma

This commit is contained in:
2023-12-14 17:42:13 +01:00
parent 268157b249
commit 62f4215c0c
11 changed files with 36 additions and 8 deletions

View File

@@ -3,6 +3,9 @@ import type { CategoryType } from '@prisma/client'
export default defineEventHandler(async (event) => {
const { type } = getQuery<{ type: CategoryType }>(event)
return await usePrisma().category.findMany({
cacheStrategy: {
ttl: 60 * 3,
},
where: {
type,
},