Inconsistent naming for different caches #5911

Open
opened 2026-01-22 15:21:53 +01:00 by admin · 0 comments
Owner

Originally created by @Dadibom on GitHub (Mar 6, 2018).

Trying to set a default TTL for the query cache by extending doctrine, however I cannot find the actual QUERY cache. It appears QueryCacheProfile is not actually for the query cache, but for the result cache.

I found this code in AbstractQuery:

 /**
     * @return QueryCacheProfile
     */
    public function getQueryCacheProfile()
    {
        return $this->queryCacheProfile;
    }

    /**
     * Retrieves the lifetime of resultset cache.
     *
     * @deprecated
     *
     * @return int
     */
    public function getResultCacheLifetime()
    {
        return $this->queryCacheProfile ? $this->queryCacheProfile->getLifetime() : 0;
    }

Which is very confusing, seeing as the result cache lifetime should be determined by "resultCacheProfile", don't you think?

There's also a function named executeUsingQueryCache, however this does not use $this->queryCacheProfile but instead $this->em->getCache()->getQueryCache()
...however this does not appear to be for the query cache but for l2...

And that's where I gave up. Would love some clarification :)

Originally created by @Dadibom on GitHub (Mar 6, 2018). Trying to set a default TTL for the query cache by extending doctrine, however I cannot find the actual QUERY cache. It appears QueryCacheProfile is not actually for the query cache, but for the result cache. I found this code in AbstractQuery: ``` /** * @return QueryCacheProfile */ public function getQueryCacheProfile() { return $this->queryCacheProfile; } /** * Retrieves the lifetime of resultset cache. * * @deprecated * * @return int */ public function getResultCacheLifetime() { return $this->queryCacheProfile ? $this->queryCacheProfile->getLifetime() : 0; } ``` Which is very confusing, seeing as the result cache lifetime should be determined by "resultCacheProfile", don't you think? There's also a function named `executeUsingQueryCache`, however this does not use $this->queryCacheProfile but instead $this->em->getCache()->getQueryCache() ...however this does not appear to be for the query cache but for l2... And that's where I gave up. Would love some clarification :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5911