Skip to content

Commit

Permalink
chore: lower cache ttls
Browse files Browse the repository at this point in the history
  • Loading branch information
Snazzah committed Oct 20, 2023
1 parent e90a03f commit e3f8472
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/util/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class TrelloAPIError extends Error {
}
}

async function recacheKey(key: string, data: any, defaultTtl = 60 * 60) {
async function recacheKey(key: string, data: any, defaultTtl = 10 * 60) {
const ttl = await client.ttl(key);
await client.set(key, JSON.stringify(data), 'EX', ttl || defaultTtl);
}
Expand All @@ -38,7 +38,7 @@ export async function getMember(token: string, id: string): Promise<TrelloMember
const response = await trello.getMember(id);
if (response.status >= 400) throw new TrelloAPIError(response);

await client.set(key, JSON.stringify(response.data), 'EX', 3 * 60 * 60);
await client.set(key, JSON.stringify(response.data), 'EX', 10 * 60);
return response.data;
}

Expand Down Expand Up @@ -128,8 +128,8 @@ export async function getBoard(token: string, id: string, memberId: string, requ
cards: subscribedCards
};

await client.set(key, JSON.stringify(response.data), 'EX', 3 * 60 * 60);
await client.set(subsKey, JSON.stringify(subscriptions), 'EX', 3 * 60 * 60);
await client.set(key, JSON.stringify(response.data), 'EX', 10 * 60);
await client.set(subsKey, JSON.stringify(subscriptions), 'EX', 20 * 60);
return [response.data, subscriptions];
}

Expand Down Expand Up @@ -171,7 +171,7 @@ export async function getCard(token: string, id: string): Promise<TrelloCard> {
const response = await trello.getCard(id);
if (response.status >= 400) throw new TrelloAPIError(response);

await client.set(key, JSON.stringify(response.data), 'EX', 30 * 60);
await client.set(key, JSON.stringify(response.data), 'EX', 5 * 60);
return response.data;
}

Expand Down

0 comments on commit e3f8472

Please sign in to comment.