Note that `useResultCache` is not interacting with the L2 cache. You can
see that from the hits/misses stats in the cache panel ;-)

I suggest you to reduce it to a test case that uses an `ArrayCache` and
repeats the query two times.

See
https://github.com/doctrine/doctrine2/tree/v2.5.0/tests/Doctrine/Tests/ORM/Functional/Ticket
for examples on how to write such a test.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 10 August 2015 at 17:13, Joe Warren-Meeks <[email protected]>
wrote:

>
> Hi Marco,
>
> Thanks for your help!
>
> Yep, if you look at the attached images.
>
> 1.png and 2.png are where I fetched an object with no doctrine
> relationships. You can see in 1.png that Doctrine was used for 1 query.
> Then, when I repeated the query in 2.png, there were no calls to Doctrine
> and all was fetched from the cache.
>
> In 3.png and 4.png, I have an entity which has a OneToOne mapping to an
> Image.
>
> In 3.png, you can see there are 7 Doctrine calls and in the queries list
> you can see them. I then repeated the fetch in 4.png and you can see there
> are 6 Doctrine calls. Only the base Entity is fetched from the cache, while
> all the rest are fetched from Doctrine, even though they've just been
> fetched a few seconds earlier.
>
> I can see all the valid entities in the Redis cache with "keys *"
>
>
> The repositories are configured:
>
>        public static $cacheTime = 3600;
>
>
>         $this->config = new Configuration();
>         $this->config->setQueryCacheImpl(new RedisCache());
>         $this->config->setMetadataCacheImpl(new RedisCache());
>         $this->config->setResultCacheImpl(new RedisCache());
>         $query->useResultCache(true, self::$cacheTime);
>
>
> On Thursday, 6 August 2015 17:03:39 UTC+1, Joe Warren-Meeks wrote:
>>
>>
>> Hi there,
>>
>> I'm struggling to get caching working properly.
>>
>> I have two entities, an Image and a Tag. They are related in a ManyToMany
>> relationship.
>>
>> Both are cache-able. If I fetch either I can see them in the cache
>> (Redis).
>>
>> But when I fetch the Image one, I always see the SELECT INNER JOIN query
>> hit the database.
>>
>> Is there a way to get the sub-entities to be fetched from the cache if
>> they are there?
>>
>> Thanks in advance..
>>
>>  -- joe.
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "doctrine-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/doctrine-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to