[DDC-3174] Query Cache not correct working when using SQLFilter Created: 17/Jun/14  Updated: 17/Jun/14

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.4.1
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benno Eggnauer Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: cache, sqlfilter


 Description   

We have an SQLFilter to filter on entities with a specific Trait implemented. The filter is very easy:

$res = $targetTableAlias . '.agency_id = ' . $this->getCurrentAgencyId();

On our system we have the query cache enabled, this works as long the "AgencyId" doesn't change. When the ID changes, the query cache seems to return the wrong (old cache) query.



 Comments   
Comment by Marco Pivetta [ 17/Jun/14 ]

I'm not sure if this case should be contemplated by the ORM. Filters are low-level and supposed to be stateless (services).

Comment by Benno Eggnauer [ 17/Jun/14 ]

OK, we can disable the query cache for this case. But then should at least the documentation be updated, which explicitly mentions to use filter for locales, which are also not stateless: http://doctrine-orm.readthedocs.org/en/latest/reference/filters.html#example-filter-class

Also in the query cache chapter: http://doctrine-orm.readthedocs.org/en/latest/reference/caching.html#query-cache

It is highly recommended that in a production environment you cache the transformation of a DQL query to its SQL counterpart. It doesn’t make sense to do this parsing multiple times as it doesn’t change unless you alter the DQL query.

Comment by Marco Pivetta [ 17/Jun/14 ]

Benno Eggnauer can you eventually provide a pull request?





[DDC-3078] Doctrine\ORM\Cache::__construct is in an interface Created: 10/Apr/14  Updated: 17/Apr/14  Resolved: 17/Apr/14

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: Git Master
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Blocker
Reporter: Marco Pivetta Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: cache, config, second-level-cache

Issue Links:
Dependency
depends on DDC-3080 [GH-1008] DDC-3078 SLC Cache interfac... Resolved

 Description   

CTOR in the interface is a huge problem. This absolutely needs to be fixed before 2.5 is released, or we will have trouble in future.

I'm writing a PoC patch right now.



 Comments   
Comment by Fabio B. Silva [ 17/Apr/14 ]

Fixed by https://github.com/doctrine/doctrine2/commit/6af3236ba6f285fe14763866b20ddc1085e6ea39





[DDC-2570] Doctrine CLI Tools - Clear All Cache Created: 24/Jul/13  Updated: 08/Feb/14

Status: Awaiting Feedback
Project: Doctrine 2 - ORM
Component/s: ORM, Tools
Affects Version/s: 2.3.4
Fix Version/s: 2.x, 2.5

Type: Improvement Priority: Minor
Reporter: Frederick Marcoux Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: Cli, cache, orm


 Description   

It would be nice to be able to clear all cache one shot instead of clearing them one after one...

Like this:

root$ ./doctrine orm:clear-cache:all

Instead of:

root$ ./doctrine orm:clear-cache:metadata
root$ ./doctrine orm:clear-cache:result
root$ ./doctrine orm:clear-cache:query






[DDC-2164] Extend the cache support to eAccelerator Created: 23/Nov/12  Updated: 26/Nov/12

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.4, 3.0
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Minor
Reporter: Enea Bette Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: cache, drivers


 Description   

It would be nice if the Doctrine caching drivers would support the eAccelerator library.



 Comments   
Comment by Marco Pivetta [ 23/Nov/12 ]

Enea Bette eAccelerator is known for being stripping comments from cached source (making it impossible to use annotations)... Do you happen to know if this is fixed? Supporting it as cache driver is fine btw, I just wonder how many users will start thinking of using eAccelerator and then will be facing this huge limitation.

Comment by Enea Bette [ 26/Nov/12 ]

I know that eAccelerator has this issue. It would be nice if we could utilize it with XML, YML and PHP based mapping though.
Do you know if the same problem would appear with these kinds of mapping strategies?

To give response to your question (eAccelerator and annotations incompatibility), there is a pull request on github, https://github.com/eaccelerator/eaccelerator/issues/19 .

It seems that in the future these could be resolved, and at that time it would be very nice to have that supported with doctrine (symfony2 already has support for this library).

"I just wonder how many users will start thinking of using eAccelerator and then will be facing this huge limitation". Sometimes users just does not have a choice. Imagine the case when you have a hosted site that requires caching functionalities and the only available cache library is eAccelerator (as just in my case). You would be fried as a chicken hehe





[DDC-2155] problem with DQL and cache Created: 18/Nov/12  Updated: 25/Nov/12  Resolved: 25/Nov/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: DQL, ORM
Affects Version/s: 2.3
Fix Version/s: None
Security Level: All

Type: Bug Priority: Critical
Reporter: gabriel sancho Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: cache, dql
Environment:

linux , php 5.4.8, mysql 5.5.28



 Description   

I have a problem when I get database records through a query DQL
and then they are changed by another application
If I repeat the query, Doctrine always return the first value, not the current value of the base

<?php

// bootstrap

$cache = new \Doctrine\Common\Cache\ArrayCache();
$config = new Doctrine\ORM\Configuration();
$config->setQueryCacheImpl($cache);
$conn = array(
				'dbname' => $database_name,
				'user' => $cnx_user,
				'password' => $cnx_pass,
				'host' => $cnx_host,
				'driver' => $cnx_type,
				'charset' => 'utf8',
				'driverOptions' => array( 1002 => "SET NAMES 'utf8'" )
				);

			$em = Doctrine\ORM\EntityManager::create($conn, $config);




while(true){
   $dql = "SELECT s from Register s WHERE s.id = 1";
   $query = $em->createQuery($dql);
// the next line is optional, produces same result
   $query->useResultCache(false);
   $res = $query->getResult();
   $orm = reset($res);
   	
   echo " regiter id :".$orm->getId()."  field "$orm->getText()."\n";

}

I run this code in a terminal, and then edit the registry (field text), but the terminal still shows the same result



 Comments   
Comment by Benjamin Eberlei [ 25/Nov/12 ]

Doctrine uses an IdentityMap pattern which leads to this issue.

You need to call "EntityManager#clear()" to clean the in memory cache of Doctrine and fetch records from the database again. or call "EntityManager#refresh($entity)"





Generated at Thu Jul 31 23:46:50 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.