You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi ! I'm using your fabulous bundle but for performances issues i need to use doctrine second level cache with redis.
Second level cache working very well because cache is hitting when i use query result without the paginator bundle. But in case of i'm using it, cache is not writing in the redis DB et was not hit by doctrine. Can you help me ?
Thanks you ! :)
Nicolas
The text was updated successfully, but these errors were encountered:
Can you provide some examples of how you're using second level cache without paginator? And maybe some examples of how you think you can use it with paginator
For exemple i have a list view with the paginator that display 40 items per page. I have configured Redis cache pool in my symfony config file. So i would like to use doctrine second level cache to improve page performances.
Here is my controller :
public function index(Request $request, PaginatorInterface $paginator): Response
{
$itemRepository = $this->getDoctrine()->getManager()->getRepository(Item::class);
$query = $itemRepository->findAllQuery(); // Give a Query
$items = $paginator->paginate($query, $request->query->getInt("page", 1), 40);
return $this->render('items/index.html.twig', [
'items' => $items,
]);
}
But with that, cache is not put in redis
So i remove the paginator implementation and then cache is put in Redis :
public function index(): Response
{
$itemRepository = $this->getDoctrine()->getManager()->getRepository(Item::class);
$items = $itemRepository->findAll(); // Give a result
return $this->render('items/index.html.twig', [
'items' => $items,
]);
}
Thanks for you help. Hope my explainations is clear :)
Can you check the query that retrieves your results? With paginator, it should be the same as without it, except for the limits.
If so, can you try to add a limit to your query by hand and see what happens?
Support Question
Hi ! I'm using your fabulous bundle but for performances issues i need to use doctrine second level cache with redis.
Second level cache working very well because cache is hitting when i use query result without the paginator bundle. But in case of i'm using it, cache is not writing in the redis DB et was not hit by doctrine. Can you help me ?
Thanks you ! :)
Nicolas
The text was updated successfully, but these errors were encountered: