From 9c152b52a3368b738117b3b1ccd7f9ef3272ef4d Mon Sep 17 00:00:00 2001 From: Ly Tuan Kiet Date: Fri, 17 Jan 2025 22:05:29 +0700 Subject: [PATCH] feat: add cache invalidation functionality in GraphQL module - Introduced a new `invalidateCache` method in the GraphQL module to enhance cache management. - This addition allows for cache invalidation based on the session ID from request headers, improving data consistency and performance during GraphQL operations. - Aims to provide better control over cached data, ensuring that users receive the most up-to-date information. --- src/Graphql/graphql.module.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Graphql/graphql.module.ts b/src/Graphql/graphql.module.ts index f06dd7d..c3af1db 100644 --- a/src/Graphql/graphql.module.ts +++ b/src/Graphql/graphql.module.ts @@ -160,6 +160,11 @@ import { GraphqlService } from "./graphql.service"; // @ts-expect-error: TODO extra.request.headers["x-session-id"] ), + invalidateCache: () => + graphqlService.invalidateCache( + // @ts-expect-error: TODO + extra.request.headers["x-session-id"] + ), }; } return {