DDC-1588: There is no way to get the Query's result cache impl without going to EM #1992

Closed
opened 2026-01-22 13:36:34 +01:00 by admin · 4 comments
Owner

Originally created by @doctrinebot on GitHub (Jan 8, 2012).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user ambis:

Ok, my problem is this:

I have created a Query object. Now I'd like to get it's result cache driver.

My options:

  1. Ask QueryCacheProfile for the driver. I can, but it's never populated by default so I always get just NULL.
  2. Ask Query with getResultCacheDriver(), but wait, I can't, that's now deprecated
  3. Ask from EM's configuration the result cache driver. This always works.

I propose that either the QueryCacheProfile is always populated with the Query's default result cache impl unless specifically overridden for the QueryCacheProfile

OR

Make getResultCacheDriver() not deprecated. Like the other two related methods, they are not deprecated, why should this one. Calling this could populate the QueryCacheProfile for future use like all the other (get cache ttl, id) methods.

My problem with with option 3) is "leaving the context of my method and the Query" (mentally of course). Why should I have to go poke around in EM's configuration when the result cache IS (or is easily obtainable behind the scenes) in the query object anyways?

Originally created by @doctrinebot on GitHub (Jan 8, 2012). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user ambis: Ok, my problem is this: I have created a Query object. Now I'd like to get it's result cache driver. My options: 1) Ask QueryCacheProfile for the driver. I can, but it's never populated by default so I always get just NULL. 2) Ask Query with getResultCacheDriver(), but wait, I can't, that's now deprecated 3) Ask from EM's configuration the result cache driver. This always works. I propose that either the QueryCacheProfile is always populated with the Query's default result cache impl unless specifically overridden for the QueryCacheProfile OR Make getResultCacheDriver() not deprecated. Like the other two related methods, they are not deprecated, why should this one. Calling this could populate the QueryCacheProfile for future use like all the other (get cache ttl, id) methods. My problem with with option 3) is "leaving the context of my method and the Query" (mentally of course). Why should I have to go poke around in EM's configuration when the result cache IS (or is easily obtainable behind the scenes) in the query object anyways?
admin added the Improvement label 2026-01-22 13:36:34 +01:00
admin closed this issue 2026-01-22 13:36:35 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jan 8, 2012):

Comment created by @beberlei:

Weird, this code looks very strange. I will check and fix that before the 2.2 RC release.

@doctrinebot commented on GitHub (Jan 8, 2012): Comment created by @beberlei: Weird, this code looks very strange. I will check and fix that before the 2.2 RC release.
Author
Owner

@doctrinebot commented on GitHub (Jan 9, 2012):

Comment created by @beberlei:

The default result cache is now passed to any new query cache profile. The following API is now working as expected:

$query->useResultCache(true);
$cache = $query->getQueryCacheProfile()->getResultCacheDriver();
@doctrinebot commented on GitHub (Jan 9, 2012): Comment created by @beberlei: The default result cache is now passed to any new query cache profile. The following API is now working as expected: ``` $query->useResultCache(true); $cache = $query->getQueryCacheProfile()->getResultCacheDriver(); ```
Author
Owner

@doctrinebot commented on GitHub (Jan 9, 2012):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Jan 9, 2012): Issue was closed with resolution "Fixed"
Author
Owner

@doctrinebot commented on GitHub (Jan 9, 2012):

Comment created by ambis:

That's perfect! Thank you!

@doctrinebot commented on GitHub (Jan 9, 2012): Comment created by ambis: That's perfect! Thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1992