perf: heavily optimize jikan cache by pre-warming individual anime objects and using 30-day TTLs for completed shows

This commit is contained in:
2026-04-08 16:31:10 +02:00
parent d70949362e
commit 618b807b3d
4 changed files with 26 additions and 1 deletions

View File

@@ -34,6 +34,7 @@ func (c *Client) GetSchedule(day string) (ScheduleResult, error) {
HasNextPage: result.Pagination.HasNextPage,
}
c.preWarmAnimeCache(result.Data)
c.setCache(cacheKey, res, time.Hour*1)
return res, nil
}
@@ -76,6 +77,7 @@ func (c *Client) GetSeasonsNow(page int) (TopAnimeResult, error) {
HasNextPage: result.Pagination.HasNextPage,
}
c.preWarmAnimeCache(result.Data)
c.setCache(cacheKey, res, time.Hour*1)
return res, nil
}
@@ -102,6 +104,7 @@ func (c *Client) GetSeasonsUpcoming(page int) (TopAnimeResult, error) {
HasNextPage: result.Pagination.HasNextPage,
}
c.preWarmAnimeCache(result.Data)
c.setCache(cacheKey, res, time.Hour*1)
return res, nil
}