mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-21 18:04:39 -05:00
33 lines
844 B
TypeScript
33 lines
844 B
TypeScript
import cachified from "@epic-web/cachified";
|
|
import {
|
|
ONE_HOUR_IN_MS,
|
|
TEN_MINUTES_IN_MS,
|
|
TWO_HOURS_IN_MS,
|
|
} from "~/constants";
|
|
import * as Changelog from "~/features/front-page/core/Changelog.server";
|
|
import * as TournamentRepository from "~/features/tournament/TournamentRepository.server";
|
|
import { cache, ttl } from "~/utils/cache.server";
|
|
|
|
export const loader = async () => {
|
|
return {
|
|
tournaments: await cachified({
|
|
key: "tournament-showcase",
|
|
cache,
|
|
ttl: ttl(TEN_MINUTES_IN_MS),
|
|
staleWhileRevalidate: ttl(ONE_HOUR_IN_MS),
|
|
async getFreshValue() {
|
|
return TournamentRepository.forShowcase();
|
|
},
|
|
}),
|
|
changelog: await cachified({
|
|
key: "changelog",
|
|
cache,
|
|
ttl: ttl(ONE_HOUR_IN_MS),
|
|
staleWhileRevalidate: ttl(TWO_HOURS_IN_MS),
|
|
async getFreshValue() {
|
|
return Changelog.get();
|
|
},
|
|
}),
|
|
};
|
|
};
|