Added Redis for Caching and Started Database Query Caching Migration to Redis

This commit is contained in:
Ahmad 2025-01-18 19:14:19 -05:00
parent f99360d9b9
commit 0f899cb34f
No known key found for this signature in database
GPG key ID: 8FD8A93530D182BF
12 changed files with 260 additions and 632 deletions

View file

@ -1,7 +1,7 @@
'use server';
import { auth } from '@clerk/nextjs/server';
import { revalidatePath } from 'next/cache';
import { revalidatePath, revalidateTag } from 'next/cache';
import { db } from '@/lib/db';
import { createSafeAction } from '@/lib/create-safe-action';
@ -36,6 +36,9 @@ const handler = async (data: InputType): Promise<ReturnType> => {
);
updatedCards = await db.$transaction(transaction);
items.map((card) => {
revalidateTag(`card-${card.id}`);
});
} catch (error) {
return {
error: 'Failed to reorder list',

View file

@ -1,7 +1,7 @@
'use server';
import { auth } from '@clerk/nextjs/server';
import { revalidatePath } from 'next/cache';
import { revalidatePath, revalidateTag } from 'next/cache';
import { ACTION, ENTITY_TYPE } from '@prisma/client';
import { db } from '@/lib/db';
@ -48,6 +48,7 @@ const handler = async (data: InputType): Promise<ReturnType> => {
};
}
revalidateTag(`card-${id}`);
revalidatePath(`/board/${boardId}`);
return { data: card };
};