Merged in fix/cache-graphql-data (pull request #2248)
fix: add missing cache for cms data * fix: cache cms data Approved-by: Linus Flood
This commit is contained in:
committed by
Linus Flood
parent
1d733c5ca3
commit
26b005d72a
@@ -25,6 +25,10 @@ export default async function CurrentContentPage({
|
||||
{
|
||||
locale: params.lang,
|
||||
url: searchParams.uri,
|
||||
},
|
||||
{
|
||||
key: `${params.lang}:current-block-page:${searchParams.uri}`,
|
||||
ttl: "max",
|
||||
}
|
||||
)
|
||||
|
||||
@@ -38,7 +42,11 @@ export default async function CurrentContentPage({
|
||||
// This is currently to be considered a temporary solution to provide the tracking with a few values in english to align with existing reports
|
||||
const pageDataForTracking = await request<TrackingData>(
|
||||
GetCurrentBlockPageTrackingData,
|
||||
{ uid: response.data.all_current_blocks_page.items[0].system.uid }
|
||||
{ uid: response.data.all_current_blocks_page.items[0].system.uid },
|
||||
{
|
||||
key: `${params.lang}:current-block-page-tracking:${searchParams.uri}`,
|
||||
ttl: "max",
|
||||
}
|
||||
)
|
||||
|
||||
const pageData = response.data.all_current_blocks_page.items[0]
|
||||
|
||||
@@ -12,6 +12,8 @@ services:
|
||||
- PRIMARY_API_KEY=
|
||||
- SECONDARY_API_KEY=
|
||||
- NODE_ENV=development
|
||||
- SENTRY_DSN=fake-dsn
|
||||
- SENTRY_ENVIRONMENT=development
|
||||
redis:
|
||||
image: redis:6
|
||||
ports:
|
||||
|
||||
@@ -81,6 +81,9 @@ export async function request<T>(
|
||||
const response = await client.request<T>({
|
||||
document: query,
|
||||
variables,
|
||||
requestHeaders: {
|
||||
"User-Agent": `scandic-web-${env.SENTRY_ENVIRONMENT}`,
|
||||
},
|
||||
})
|
||||
|
||||
try {
|
||||
|
||||
@@ -3,7 +3,6 @@ import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
|
||||
import { getCacheClient } from "@/services/dataCache"
|
||||
import {
|
||||
generateRefsResponseTag,
|
||||
generateTag,
|
||||
@@ -32,16 +31,17 @@ export async function fetchCollectionPageRefs(lang: Lang, uid: string) {
|
||||
|
||||
metricsGetCollectionPageRefs.start()
|
||||
|
||||
const cacheClient = await getCacheClient()
|
||||
const cacheKey = generateRefsResponseTag(lang, uid)
|
||||
const refsResponse = await cacheClient.cacheOrGet(
|
||||
cacheKey,
|
||||
async () =>
|
||||
await request<GetCollectionPageRefsSchema>(GetCollectionPageRefs, {
|
||||
locale: lang,
|
||||
uid,
|
||||
}),
|
||||
"max"
|
||||
const refsResponse = await request<GetCollectionPageRefsSchema>(
|
||||
GetCollectionPageRefs,
|
||||
{
|
||||
locale: lang,
|
||||
uid,
|
||||
},
|
||||
{
|
||||
key: cacheKey,
|
||||
ttl: "max",
|
||||
}
|
||||
)
|
||||
|
||||
if (!refsResponse.data) {
|
||||
|
||||
Reference in New Issue
Block a user