fix: uses default image in episode results if image is missing, reduces cache life to next hour, clears cache during build
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Search\Action\Handler\GetMediaInfoHandler;
|
||||
use App\Search\Action\Handler\SearchHandler;
|
||||
use App\Search\Action\Input\GetMediaInfoInput;
|
||||
use App\Search\Action\Input\SearchInput;
|
||||
use Carbon\Carbon;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
@@ -37,8 +38,8 @@ final class SearchController extends AbstractController
|
||||
): Response {
|
||||
$cacheId = sprintf("page.%s.%s", $input->mediaType, $input->tmdbId);
|
||||
|
||||
// return $cache->get($cacheId, function (ItemInterface $item) use ($input) {
|
||||
// $item->expiresAt(new \DateTimeImmutable("today 11:59 pm"));
|
||||
return $cache->get($cacheId, function (ItemInterface $item) use ($input) {
|
||||
$item->expiresAt(Carbon::now()->addHour()->setMinute(0)->setSecond(0));
|
||||
$result = $this->getMediaInfoHandler->handle($input->toCommand());
|
||||
return $this->render('search/result.html.twig', [
|
||||
'results' => $result,
|
||||
@@ -51,6 +52,6 @@ final class SearchController extends AbstractController
|
||||
'episode' => ''
|
||||
]
|
||||
]);
|
||||
// });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user