Hi, i'm using fractal + pagerfanta for pagination my result in my project. I wonder how can i apply result cache in my query builder when using pagerfanta?
$adapter = new QueryAdapter($result);
$pagerfanta = new Pagerfanta($adapter);
$pagerfanta->setMaxPerPage($limitPerPage);
$pagerfanta->setCurrentPage($page);
$paginatorAdapter = new PagerfantaPaginatorAdapter($pagerfanta, function(int $page) use ($request, $limitPerPage) {
$route = $request->attributes->get('_route');
$inputParams = $request->attributes->get('_route_params');
$newParams = array_merge($inputParams, $request->query->all());
$newParams['page'] = $page;
$newParams['limit'] = $limitPerPage;
return $this->router->generate($route, $newParams, UrlGeneratorInterface::ABSOLUTE_URL);
});
$resource = new Collection($pagerfanta->getCurrentPageResults(), $transformer, 'data');
$resource->setPaginator($paginatorAdapter);
Hi, i'm using fractal + pagerfanta for pagination my result in my project. I wonder how can i apply result cache in my query builder when using pagerfanta?