feat(cache): update cache expiration times

- Update the cache expiration time for 'championsListAllCache' and 'championsRolesCache' to 8 hours.
- Update the cache expiration time for 'championShowCache{slug}' to 3 days.
- Update the cache expiration time for 'championSplashColorCache{slug}' to 6 months.
- Update the cache expiration time for 'championSkinShowCache{slug}' to 48 hours.
- Update the cache expiration time for 'championSkinSplashColorCache{slug}' to 120 hours.
This commit is contained in:
Rico van Zelst
2024-01-14 00:13:37 +01:00
parent e3cc331923
commit 5c6f13a072
2 changed files with 11 additions and 11 deletions

View File

@@ -45,14 +45,14 @@ class ChampionController extends Controller
*/ */
public function show(Champion $champion) public function show(Champion $champion)
{ {
$eightHoursInSeconds = 60 * 60 * 8; $threeDaysInSeconds = 60 * 60 * 24 * 3;
$dayInSeconds = 60 * 60 * 24; $sixMonthsInSeconds = 60 * 60 * 24 * 30 * 6;
$champion = Cache::remember('championShowCache' . $champion->slug, $eightHoursInSeconds, static fn () => $champion->load('skins', 'lanes')); $champion = Cache::remember('championShowCache' . $champion->slug, $threeDaysInSeconds, static fn() => $champion->load('skins', 'lanes'));
$splashColor = Cache::remember( $splashColor = Cache::remember(
'championSplashColorCache' . $champion->slug, 'championSplashColorCache' . $champion->slug,
$dayInSeconds, $sixMonthsInSeconds,
static fn() => getAverageColorFromImageUrl($champion->getChampionImageAttribute()) static fn() => getAverageColorFromImageUrl($champion->getChampionImageAttribute())
); );

View File

@@ -56,13 +56,13 @@ class ChampionSkinController extends Controller
{ {
$skin = Cache::remember( $skin = Cache::remember(
'championSkinShowCache' . $championSkin->slug, 'championSkinShowCache' . $championSkin->slug,
60 * 60 * 8, 60 * 60 * 48,
static fn() => $championSkin->load('champion', 'chromas') static fn() => $championSkin->load('champion', 'chromas')
); );
$splashColor = Cache::remember( $splashColor = Cache::remember(
'championSkinSplashColorCache' . $championSkin->slug, 'championSkinSplashColorCache' . $championSkin->slug,
60 * 60 * 24, 60 * 60 * 120,
static fn() => getAverageColorFromImageUrl($championSkin->getSkinImageAttribute()) static fn() => getAverageColorFromImageUrl($championSkin->getSkinImageAttribute())
); );