Skip to content

[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).#54
sobstel wants to merge 1 commit intodoctrine:masterfrom
sobstel:DDC-217

Conversation

@sobstel
Copy link

@sobstel sobstel commented May 11, 2011

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

@beberlei
Copy link
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.

@beberlei beberlei closed this May 15, 2011
@sobstel
Copy link
Author

sobstel commented May 16, 2011

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants