Skip to content

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

Closed
doctrinebot opened this Issue Jan 8, 2012 · 4 comments

2 participants

@doctrinebot

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?

@doctrinebot

Comment created by @beberlei:

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

@doctrinebot

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

Issue was closed with resolution "Fixed"

@doctrinebot

Comment created by ambis:

That's perfect! Thank you!

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added this to the 2.2 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.