jackalope/jackalope-doctrine-dbal — pull request #60 by petesiss (2012-09-19 23:18:37+00:00)
Title: [WIP] We need to be able to denote an empty array as the cached value

On a site with 200 pages, I still have 400 unnecessary queries per page (down from 3000 earlier today - thanks @lsmith77!)

This seems to be because each content node generates a call to [``Client::getReferences``][1] and for each of our content nodes this does two queries (via [``Client::getNodeReferences``][2]) and then returns an empty array.

From what I can see, the cache cant save an empty array, so if the queried result is an empty array then it doesn't get cached and so gets re-queried on every page request.

Doing something like I have done in this commit - i.e. somehow denoting the empty array in a format in which it can be cached - removes all superflous queries once the cache is full. So now down to zero(!) cmf queries.

Obviously just using the text 'empty' is no good - but it demonstrates the sort of solution I think is needed.

Any thoughts on how we should do this "properly", if indeed this is confirmed as the source of the problem.

[1]:https://github.com/jackalope/jackalope-doctrine-dbal/blob/master/src/Jackalope/Transport/DoctrineDBAL/Client.php#L1875
[2]:https://github.com/jackalope/jackalope-doctrine-dbal/blob/master/src/Jackalope/Transport/DoctrineDBAL/Client.php#L1895