From 33091d22c052ef345279411f62d3d443a0f3d490 Mon Sep 17 00:00:00 2001 From: Maximilian Kaske <56969857+mxkaske@users.noreply.github.com> Date: Mon, 25 Nov 2024 20:41:21 +0100 Subject: [PATCH] chore: add public cache (#1115) --- packages/tinybird/src/client.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/tinybird/src/client.ts b/packages/tinybird/src/client.ts index 0a5ff55e..66884544 100644 --- a/packages/tinybird/src/client.ts +++ b/packages/tinybird/src/client.ts @@ -3,6 +3,8 @@ import { z } from "zod"; import { flyRegions } from "../../db/src/schema/constants"; import { headersSchema, timingSchema, triggers } from "./schema"; +const PUBLIC_CACHE = 300; // 5 * 60 = 300s = 5m + export class OSTinybird { private readonly tb: Client; @@ -314,7 +316,11 @@ export class OSTinybird { count: z.number().default(0), ok: z.number().default(0), }), - opts: { cache: "no-store" }, + opts: { + next: { + revalidate: PUBLIC_CACHE, + }, + }, }); } @@ -655,7 +661,11 @@ export class OSTinybird { count: z.number().default(0), ok: z.number().default(0), }), - opts: { cache: "no-store" }, + opts: { + next: { + revalidate: PUBLIC_CACHE, + }, + }, }); } -- 2.51.2