Skip to content

Commit

Permalink
Add TTL caching directive to GraphQL queries (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmrossy authored May 27, 2024
2 parents 86911bf + 37794a4 commit ae5b099
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/features/messages/queries/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function buildMessageQuery(
const variables = { identifier: stringToPostgresBytea(idValue) };

const query = `
query ($identifier: bytea!){
query ($identifier: bytea!) @cached(ttl: 5) {
message_view(
where: {${whereClause}},
limit: ${limit}
Expand Down Expand Up @@ -107,7 +107,7 @@ export function buildMessageSearchQuery(
}`,
);

const query = `query ($search: bytea, $originChains: [bigint!], $destinationChains: [bigint!], $startTime: timestamp, $endTime: timestamp) {
const query = `query ($search: bytea, $originChains: [bigint!], $destinationChains: [bigint!], $startTime: timestamp, $endTime: timestamp) @cached(ttl: 5) {
${queries.join('\n')}
}`;
return { query, variables };
Expand Down

0 comments on commit ae5b099

Please sign in to comment.