Skip to content

Is there a way to use query builder result cache? #29

Closed Answered by mbabker
fd6130 asked this question in Q&A
Discussion options

You must be logged in to vote

In one of my projects, we use the result cache with the Doctrine ORM query adapter in a few different circumstances, for those you'd just need to call $qb->enableResultCache() as you would elsewhere before getting the current page's results. Do make sure your cache is pagination aware (and if your request supports them, filters as well) that way you aren't serving the wrong page's results because of an invalid cache.

There isn't a way to use the result cache with the Doctrine DBAL query adapter, the query builder's execute() method doesn't give a way to call the connection's executeQuery() method with a query cache profile. So if you wanted to use a result cache with the DBAL, you'd need …

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@fd6130
Comment options

@mbabker
Comment options

@fd6130
Comment options

@mbabker
Comment options

Answer selected by fd6130
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #28 on May 11, 2021 14:21.