Skip to content

Commit

Permalink
chore: add public cache (#1115)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxkaske authored Nov 25, 2024
1 parent 8dd350b commit 33091d2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/tinybird/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
},
},
});
}

Expand Down Expand Up @@ -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,
},
},
});
}

Expand Down

0 comments on commit 33091d2

Please sign in to comment.