[DDC-217] Cache SQL results before hydration (and not after).#54
Closed
sobstel wants to merge 1 commit intodoctrine:masterfrom
sobstel:DDC-217
Closed
[DDC-217] Cache SQL results before hydration (and not after).#54sobstel wants to merge 1 commit intodoctrine:masterfrom sobstel:DDC-217
sobstel wants to merge 1 commit intodoctrine:masterfrom
sobstel:DDC-217
Conversation
Member
|
The idea we are now going with is an SQL cache at the Doctrine\DBAL\Connection level. This does not add another layer of complexity in the hydration/query layer. |
Author
|
Nice, was thinking about using Connection for this but wasn't sure how to relate it with cache id. Btw, will it also include caching for data fetched via finders ($em->find()) as well as relations? Right now, there's no way to cache this at Doctrine level. |
guilhermeblanco
added a commit
that referenced
this pull request
Jan 23, 2013
Changed external link to internal link.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've made my own implementation for this:
https://github.com/sobstel/doctrine2/commit/f583625f791da22dec77dd7d6c83b813f0bcbdaa
There are no changes in specific hydrators and there is no fetchAll(). I've added 2 wrappers: one for cached result array, and one for uncached pdo statement. The former (CachedResultStatement) is actually ArrayIterator which just implements used methods (fetch & closeCursor => also specified in ResultStatementInterface). The latter is decorator for stmt, which just collects results on each call of fetch() (results are later available by calling getResult), and apart from this all calls are delegated to actual stmt object.
I've used (copied) following changes from Daniel dcousineau@c23b5a9
Whole discussion: http://www.doctrine-project.org/jira/browse/DDC-217