From b26a9cd9ff496bf9bad2a19d9a107fba20ce8791 Mon Sep 17 00:00:00 2001 From: Ritesh Ghosh Date: Sun, 22 Dec 2024 00:43:18 +0530 Subject: refactor: integrate new `getOrSet` method definition --- src/routes/hianime.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/routes/hianime.ts b/src/routes/hianime.ts index e636a5e..04be1bb 100644 --- a/src/routes/hianime.ts +++ b/src/routes/hianime.ts @@ -14,8 +14,8 @@ hianimeRouter.get("/home", async (c) => { const cacheConfig = c.get("CACHE_CONFIG"); const data = await cache.getOrSet( - cacheConfig.key, hianime.getHomePage, + cacheConfig.key, cacheConfig.duration ); @@ -33,8 +33,8 @@ hianimeRouter.get("/azlist/:sortOption", async (c) => { Number(decodeURIComponent(c.req.query("page") || "")) || 1; const data = await cache.getOrSet( - cacheConfig.key, async () => hianime.getAZList(sortOption, page), + cacheConfig.key, cacheConfig.duration ); @@ -51,8 +51,8 @@ hianimeRouter.get("/category/:name", async (c) => { Number(decodeURIComponent(c.req.query("page") || "")) || 1; const data = await cache.getOrSet( - cacheConfig.key, async () => hianime.getCategoryAnime(categoryName, page), + cacheConfig.key, cacheConfig.duration ); @@ -67,8 +67,8 @@ hianimeRouter.get("/genre/:name", async (c) => { Number(decodeURIComponent(c.req.query("page") || "")) || 1; const data = await cache.getOrSet( - cacheConfig.key, async () => hianime.getGenreAnime(genreName, page), + cacheConfig.key, cacheConfig.duration ); @@ -83,8 +83,8 @@ hianimeRouter.get("/producer/:name", async (c) => { Number(decodeURIComponent(c.req.query("page") || "")) || 1; const data = await cache.getOrSet( - cacheConfig.key, async () => hianime.getProducerAnimes(producerName, page), + cacheConfig.key, cacheConfig.duration ); @@ -97,8 +97,8 @@ hianimeRouter.get("/schedule", async (c) => { const date = decodeURIComponent(c.req.query("date") || ""); const data = await cache.getOrSet( - cacheConfig.key, async () => hianime.getEstimatedSchedule(date), + cacheConfig.key, cacheConfig.duration ); @@ -114,8 +114,8 @@ hianimeRouter.get("/search", async (c) => { const pageNo = Number(decodeURIComponent(page || "")) || 1; const data = await cache.getOrSet( - cacheConfig.key, async () => hianime.search(query, pageNo, filters), + cacheConfig.key, cacheConfig.duration ); @@ -128,8 +128,8 @@ hianimeRouter.get("/search/suggestion", async (c) => { const query = decodeURIComponent(c.req.query("q") || ""); const data = await cache.getOrSet( - cacheConfig.key, async () => hianime.searchSuggestions(query), + cacheConfig.key, cacheConfig.duration ); @@ -142,8 +142,8 @@ hianimeRouter.get("/anime/:animeId", async (c) => { const animeId = decodeURIComponent(c.req.param("animeId").trim()); const data = await cache.getOrSet( - cacheConfig.key, async () => hianime.getInfo(animeId), + cacheConfig.key, cacheConfig.duration ); @@ -158,8 +158,8 @@ hianimeRouter.get("/episode/servers", async (c) => { ); const data = await cache.getOrSet( - cacheConfig.key, async () => hianime.getEpisodeServers(animeEpisodeId), + cacheConfig.key, cacheConfig.duration ); @@ -182,8 +182,8 @@ hianimeRouter.get("/episode/sources", async (c) => { | "raw"; const data = await cache.getOrSet( - cacheConfig.key, async () => hianime.getEpisodeSources(animeEpisodeId, server, category), + cacheConfig.key, cacheConfig.duration ); @@ -196,8 +196,8 @@ hianimeRouter.get("/anime/:animeId/episodes", async (c) => { const animeId = decodeURIComponent(c.req.param("animeId").trim()); const data = await cache.getOrSet( - cacheConfig.key, async () => hianime.getEpisodes(animeId), + cacheConfig.key, cacheConfig.duration ); -- cgit v1.2.3