<!--
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Mon May 20 15:49:24 UTC 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://www.doctrine-project.org/jira/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+DC+AND+resolution+%3D+Unresolved+AND+component+%3D+Caching+ORDER+BY+priority+DESC&tempMax=1000&field=key&field=summary
-->
<!-- If you wish to do custom client-side styling of RSS, uncomment this:
<?xml-stylesheet href="http://www.doctrine-project.org/jira/styles/jiraxml2html.xsl" type="text/xsl"?>
-->
<rss version="0.92">
    <channel>
        <title>Doctrine Project</title>
        <link>http://www.doctrine-project.org/jira/secure/IssueNavigator.jspa?reset=true&amp;jqlQuery=project+%3D+DC+AND+resolution+%3D+Unresolved+AND+component+%3D+Caching+ORDER+BY+priority+DESC</link>
        <description>An XML representation of a search request</description>
                <language>en-us</language>
                        <issue start="0" end="9" total="9"/>
                <build-info>
            <version>5.2.7</version>
            <build-number>850</build-number>
            <build-date>21-02-2013</build-date>
        </build-info>
<item>
            <title>[DC-963] Doctrine cache - Salt dissociation</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-963</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Doctrine Cache store data into a persistence storage.&lt;/p&gt;

&lt;p&gt;Regarding APC, Doctrine use a share storage.&lt;br/&gt;
Doctrine is able to cache SQL from DQL, and DOM from SQL.&lt;br/&gt;
To do this, Doctrine create a DQL hash, and store the SQL result refer to the hash. &lt;/p&gt;

&lt;p&gt;I&apos;m using a server to host two Doctrine project, a preproduction &amp;amp; production Website. In some case, DQL is the same on both project, but the data model definition isn&apos;t.&lt;/p&gt;

&lt;p&gt;Preproduction convert DQL to SQL using data model definition, and store the SQL result into APC cache refer to the DQL hash.&lt;br/&gt;
Production create a DQL hash, this is the same hash as preproduction.. So production instance use the SQL refer to the preproduction.. &lt;/p&gt;

&lt;p&gt;I&apos;m not sure about the quality of this explanation... But I can add some information is needed.&lt;/p&gt;


&lt;p&gt;The solution of this problem is easy. Just add a SALT to any cache id&apos;s. It&apos;s a Doctrine_Cache problem, not only a Doctrine_Cache_APC problem..&lt;br/&gt;
For Query cache it&apos;s not really important because this cache is optional, but for result cache.. It&apos;s more critical.&lt;br/&gt;
The SALT can be define when instantiate the Doctrine_Cache object, it&apos;s just an option..&lt;/p&gt;


&lt;p&gt;$cacheDriver = new doctrine_Cache_Apc ();&lt;br/&gt;
$cacheDriver-&amp;gt;setOption (&quot;salt&quot;, &quot;domain.tld&quot;);&lt;/p&gt;</description>
                <environment></environment>
            <key id="12351">DC-963</key>
            <summary>Doctrine cache - Salt dissociation</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/critical.png">Critical</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="romanb">Roman S. Borschel</assignee>
                                <reporter username="armetiz">Thomas Tourlourat - Armetiz</reporter>
                        <labels>
                    </labels>
                <created>Thu, 3 Feb 2011 05:05:19 +0000</created>
                <updated>Mon, 18 Apr 2011 10:13:28 +0000</updated>
                                                                    <component>Caching</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="15219" author="armetiz" created="Thu, 3 Feb 2011 05:12:45 +0000"  >&lt;p&gt;to complete this bug, I think it&apos;s also a problem on DC 2..&lt;/p&gt;</comment>
                    <comment id="15737" author="jaikdean" created="Mon, 18 Apr 2011 10:13:28 +0000"  >&lt;p&gt;There is already an (undocumented?) option &quot;prefix&quot; that allows this.&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;$cacheDriver = new Doctrine_Cache_Apc(array(&apos;prefix&apos; =&amp;gt; &apos;MY UNIQUE SALT&apos;));&lt;/tt&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-644] _getCacheKeys() exhausts memory</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-644</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>
&lt;p&gt;My scripts have excessive memory consumption and I&apos;ve often saw in my logs:&lt;/p&gt;

&lt;p&gt;PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 2097152 bytes) in /proj/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Cache/Apc.php on line 111&lt;/p&gt;

&lt;p&gt;Looking into the code I&apos;ve found which function to blame:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;    protected function _getCacheKeys()&lt;br/&gt;
    {&lt;br/&gt;
        $ci = apc_cache_info(&apos;user&apos;);&lt;br/&gt;
        $keys = array();&lt;/p&gt;

&lt;p&gt;        foreach ($ci&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;cache_list&amp;#39;&amp;#93;&lt;/span&gt; as $entry) &lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {          $keys[] = $entry[&amp;#39;info&amp;#39;]; ######### THIS IS THE LINE        }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;        return $keys;&lt;br/&gt;
    }&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;My server extensively uses APC caching and it&apos;s normal to have many cache keys.&lt;br/&gt;
Obviously retrieving ALL of them is time and memory consuming.&lt;br/&gt;
As I&apos;m not well versed with Doctrine&apos;s code, I didn&apos;t want to dive further in.&lt;/p&gt;

&lt;p&gt;Is there another way to avoid this pitfall? &lt;/p&gt;</description>
                <environment>Doctrine is installed as a Symfony plugin. Using the latest Symfony from SVN.</environment>
            <key id="11258">DC-644</key>
            <summary>_getCacheKeys() exhausts memory</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/critical.png">Critical</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="colnector">Amir W</reporter>
                        <labels>
                    </labels>
                <created>Thu, 22 Apr 2010 12:54:15 +0000</created>
                <updated>Wed, 6 Jul 2011 08:17:14 +0000</updated>
                                                                    <component>Caching</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="12757" author="colnector" created="Mon, 26 Apr 2010 20:38:25 +0000"  >&lt;p&gt;Is there any patch that could be provided meanwhile? This is quite a problem on a live website.&lt;/p&gt;</comment>
                    <comment id="12887" author="colnector" created="Mon, 10 May 2010 02:44:24 +0000"  >&lt;p&gt;Is this not a critical issue for Doctrine&apos;s cache? It&apos;s been up for 2 weeks with not even a comment...&lt;/p&gt;</comment>
                    <comment id="12896" author="jwage" created="Mon, 10 May 2010 12:34:16 +0000"  >&lt;p&gt;Hi, what are you calling that is invoking _getCacheKeys()? The only methods that call it are the deleteBy*() methods. It is expected that these methods have to get the entire list of cache keys from the driver in order to perform the delete by operation. These cache clearing operations should probably be done in the CLI environment where the memory limits are higher. If you want to avoid _getCacheKeys() being invoked, then you must not use the deleteBy*() methods.&lt;/p&gt;</comment>
                    <comment id="12897" author="colnector" created="Mon, 10 May 2010 13:15:10 +0000"  >&lt;p&gt;Thank you for commenting. Yes, I am using deleteByRegex() since I need to expire some result cache entries upon an update operation. What other choice do I have if I wish to keep using the result cache offered by Doctrine? Is there any other mechanism?&lt;/p&gt;

&lt;p&gt;Can&apos;t _getCacheKeys() be optimized some way?&lt;/p&gt;</comment>
                    <comment id="12898" author="jwage" created="Mon, 10 May 2010 13:22:50 +0000"  >&lt;p&gt;No, it is not able to be optimized anymore. It has to load all the keys into a php array in memory in order to loop over them to compare against the regex. You should probably not be doing cache clearing operations in the browser under apache. If you do, you&apos;ll need to raise your memory limit.&lt;/p&gt;</comment>
                    <comment id="12899" author="colnector" created="Mon, 10 May 2010 13:29:32 +0000"  >&lt;p&gt;My code actually had a few of these calls and I&apos;ve now removed use of the result cache with Doctrine. What you&apos;re writing means the result cache is not usable for dynamic websites. IMHO, it&apos;s a good practice to cache results and remove them once an update is made to the data (which naturally can happen due to an update from a user). However, if that by itself creates an overload on the server (and as you know even a temporary memory abuse leads to an overload), I cannot see how it can be useful.&lt;br/&gt;
Please tell me if you think there&apos;s a way the results cache can still be usable for a dynamic website.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</comment>
                    <comment id="12900" author="jwage" created="Mon, 10 May 2010 13:37:08 +0000"  >&lt;p&gt;This is the only way to allow more complex delete functionality. How you use it, is not up to us. We intended that cache clearing is done from the command line or in an environment where the memory limit is high enough to be able to load all those keys. It may not be able to be used by everyone, if it is not working for how you are using it then you will need to think of another solution I suppose.&lt;/p&gt;</comment>
                    <comment id="12901" author="colnector" created="Mon, 10 May 2010 13:58:34 +0000"  >&lt;p&gt;Thank you for your response and I&apos;ll think of another solution for my application.&lt;/p&gt;

&lt;p&gt;I did dive into the code and there&apos;s a relevant &lt;b&gt;optimization&lt;/b&gt; that could be made.&lt;/p&gt;

&lt;p&gt;_getCacheKeys() is actually creating another array for all the cache keys which needlessly increases the memory used.&lt;br/&gt;
If the deleteBy*() method would be implemented at the driver level (such as with Apc.php) and not at the general level (Driver.php as it is now) this array would not have to be created. It won&apos;t be such a code bloat and would surely lessen memory use.&lt;/p&gt;

&lt;p&gt;There could be a way around the problem which also implements another feature I miss with the results cache. By allowing some sort of cache tagging to mark the items that may need to be deleted we could easily delete relevant entries. I&apos;ll describe the interface here.&lt;/p&gt;

&lt;p&gt;Instead of &lt;br/&gt;
$q = $q-&amp;gt;useResultCache(true, 86400);&lt;/p&gt;

&lt;p&gt;There should be&lt;br/&gt;
$q = $q-&amp;gt;useTagResultCache(&apos;SomeTag&apos;, true, 86400);&lt;br/&gt;
which does the same PLUS update a cached variable (such as &apos;Doctrine_Result_Cache_Tag_SomeTag&apos;) which references the result cache keys of &apos;SomeTag&apos;.&lt;/p&gt;

&lt;p&gt;We can then easily implement deletion of relevant result cache entries with&lt;/p&gt;

&lt;p&gt;deleteByTag(&apos;SomeTag&apos;)&lt;/p&gt;

&lt;p&gt;which would read  &apos;Doctrine_Result_Cache_Tag_SomeTag&apos; to figure out which entries should be removed from the cache.&lt;/p&gt;

&lt;p&gt;I&apos;m pretty sure my usage scenario is not marginal but let me know what you think.&lt;/p&gt;</comment>
                    <comment id="12902" author="jwage" created="Mon, 10 May 2010 14:08:13 +0000"  >&lt;p&gt;This is already possible if I understand what you describe.&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$q-&amp;gt;useResultCache(&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;, 3600, &apos;key_to_store_cache_under&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now you can do:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$cacheDriver-&amp;gt;delete(&apos;key_to_store_cache_under&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Also what you describe useTagResultCache() and keeping up with our own list of cache keys is the way it used to be and was changed to this after worse performance problems were discovered with that approach.&lt;/p&gt;</comment>
                    <comment id="12903" author="colnector" created="Mon, 10 May 2010 14:44:26 +0000"  >&lt;p&gt;Perhaps I&apos;ve been misunderstood so I&apos;ll try explain from the start.&lt;/p&gt;

&lt;p&gt;In my system a few queries do relate to the same pieces of information. That information can be updated by a user and thus I would need to remove anywhere between 0 and 50 related result cache variables. I cannot easily name each and every one of my queries thus giving a specific key name doesn&apos;t help. So what I did was to prefix the name of each of the queries to indicate that I&apos;ll know how to remove them. I may have thousands of results cached and would need to clear just a few. That&apos;s why I use the deleteBy*() which proves to be extremely inefficient as it retrieves ALL the keys in my cache driver and not only the Doctrine related ones.&lt;/p&gt;

&lt;p&gt;I really don&apos;t know how it has been implemented before but what I suggest wouldn&apos;t hurt performance as tagging would be an optional addition managed with another variable. If you think that won&apos;t b useful to other Doctrine users, I&apos;ll simply implement it for my system.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</comment>
                    <comment id="12904" author="jwage" created="Mon, 10 May 2010 14:54:35 +0000"  >&lt;p&gt;I think the best solution is the one you suggested earlier. That each cache driver should directly implement this functionality and bypass the creation of the array. What do you think? It is backwards compatible so that way we can commit it in 1.2.&lt;/p&gt;</comment>
                    <comment id="12905" author="colnector" created="Mon, 10 May 2010 15:20:07 +0000"  >&lt;p&gt;Bypassing the array is a required optimization which is easy to implement but it&apos;s not really a solution to the problem I&apos;m facing and I believe is common enough (Zend_Cache for example implements tagging) and need to be offered. As it&apos;ll be 2 new functions that will implement tagging only when specifically requested, it&apos;ll also be backward compatible. The only thing I&apos;m not sure about is if an implementation of some locking mechanism would be needed for the cached variable which would hold the list of cache keys for a specific tag.&lt;/p&gt;</comment>
                    <comment id="12906" author="jwage" created="Mon, 10 May 2010 15:38:52 +0000"  >&lt;p&gt;Let me know what you come up with and we&apos;ll have a look at including it in the next 1.2.x release.&lt;/p&gt;</comment>
                    <comment id="12981" author="colnector" created="Sun, 16 May 2010 14:21:37 +0000"  >&lt;p&gt;Bypassing the extra array is still not good enough and IMHO the whole idea of deleteBy() should NOT be used if many such requests could be made, as is my case.&lt;/p&gt;

&lt;p&gt;What I&apos;ve done now is what I mentioned before with a patch that is quite ugly.&lt;/p&gt;

&lt;p&gt;In Doctrine/Query/Abstract.php right after the line&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$cacheDriver-&amp;gt;save($hash, $cached, $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getResultCacheLifeSpan());
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I&apos;ve added &lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!empty($GLOBALS[&apos;rcache_users_in_query&apos;])) {
                	MyCache::keepRelatedCacheKey($GLOBALS[&apos;rcache_users_in_query&apos;], $hash);
                }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Which saves another cache key which holds the hash tags that would have to be deleted on an update.&lt;br/&gt;
My global variable is actually an array as a Doctrine query result may be associated with more than one user and possibly other parameters.&lt;br/&gt;
Before calling the $q-&amp;gt;execute(), I simply update this variable.&lt;/p&gt;

&lt;p&gt;When a user on my system does the update, I then delete all relevant Doctrine keys with something like&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;		&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (is_null($cacheDriver)) $cacheDriver = Doctrine_Manager::getInstance()-&amp;gt;getAttribute(Doctrine_Core::ATTR_RESULT_CACHE);
		
		foreach($arKeys as $key) {
			$cacheDriver-&amp;gt;delete($key);			
		}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and then delete my other cache key.&lt;/p&gt;

&lt;p&gt;This solution works well for me. Sorry I cannot make a nice Doctrine patch for it as I&apos;m not well versed with your code. I still believe it should be supported by Doctrine with an optional extra parameter for $q-&amp;gt;useResultCache()&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</comment>
                    <comment id="13191" author="hobodave" created="Tue, 8 Jun 2010 14:42:42 +0000"  >&lt;p&gt;Hi Amir,&lt;/p&gt;

&lt;p&gt;Zend_Cache does not implement tagging for either APC or Memcached backends, see the &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-460&quot; class=&quot;external-link&quot;&gt;documentation&lt;/a&gt;. It also likely never will, all requests for this functionality have been closed with Wont Fix.&lt;/p&gt;

&lt;p&gt;I don&apos;t think the deleteBy methods should have ever been implemented. When initially implemented they cached a &quot;doctrine_cache_keys&quot; variable to store the keys known to Doctrine. This however led to a crippling bug that would crash my production servers after a few hours. Not even a friendly &quot;out of memory&quot; limit, but a slowdown and eventual crash. Please see &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-460&quot; class=&quot;external-link&quot;&gt;DDC-460&lt;/a&gt; for details. Note that I don&apos;t use the magic delete methods, just simple saves with timeouts and this was affecting me.&lt;/p&gt;

&lt;p&gt;I fixed the solution as you&apos;ve seen using the _getCacheKeys() method. I don&apos;t believe this functionality should have ever been added to Doctrine to begin with, but this is what we have to work with. It should be the responsibility of the cache store to handle tagging and such, not poorly hacked on with application code.&lt;/p&gt;

&lt;p&gt;As it stands, the current implementation doesn&apos;t affect people who aren&apos;t even using this functionality, as it should be. As Jon suggested, you shouldn&apos;t be using this in the context of a page request. Use a CLI script or work on another solution. Your idea of tracking your keys in application code is a good idea, but it doesn&apos;t belong in Doctrine imo.&lt;/p&gt;</comment>
                    <comment id="13263" author="colnector" created="Thu, 10 Jun 2010 02:07:13 +0000"  >&lt;p&gt;Thanks David for your comment.&lt;/p&gt;

&lt;p&gt;I agree with you that my implementation should not belong in Doctrine and that tagging should have been a part of the cache backends.&lt;/p&gt;

&lt;p&gt;Continuing with the same logic you&apos;ve presented, deleteBy...() functionality **&lt;b&gt;should be removed&lt;/b&gt;** from Doctrine if it causes the system to crash as it does so in an obnoxious way so that it would take too long for most developers to notice this is where the problem lies. It has certainly taken too much of my time and efforts and I&apos;d rather save the pain from others.&lt;/p&gt;</comment>
                    <comment id="16119" author="carsten" created="Wed, 6 Jul 2011 08:17:13 +0000"  >&lt;p&gt;We had the exact same problem. We used a &quot;deleteAll()&quot; of a ApcCache object and ran into the &quot;allowed memory size exhausted&quot; pitfall. We helped ourselves with a new class that extends ApcCache and uses the simpler apc_clear_cache function.&lt;/p&gt;


&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; 
namespace Foo\Cache;

class ApcCache extends \Doctrine\Common\Cache\ApcCache
{
    /**
     * Delete all cache entries. Memory saving version...
     *
     * @return bool
     */
    public function deleteAll()
    {
        return apc_clear_cache(&apos;user&apos;);
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; 
use Foo\Cache\ApcCache as Apc;
...
$this-&amp;gt;_apc = new Apc();
$this-&amp;gt;_apc-&amp;gt;deleteAll();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;This doesn&apos;t return the ids of the deleted entries like the original function but we don&apos;t need that. So this works fine for us.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-902] Xcache Cache Driver is not documented</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-902</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Xcache Cache Driver is not documented at all. Is it working? Is it stable? Can we use it?&lt;/p&gt;</description>
                <environment>All</environment>
            <key id="12035">DC-902</key>
            <summary>Xcache Cache Driver is not documented</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="romanb">Roman S. Borschel</assignee>
                                <reporter username="leszczu">Piotr Leszczy&#324;ski</reporter>
                        <labels>
                    </labels>
                <created>Tue, 26 Oct 2010 14:38:59 +0000</created>
                <updated>Tue, 26 Oct 2010 14:38:59 +0000</updated>
                                    <version>1.2.0-ALPHA1</version>
                <version>1.2.0-ALPHA2</version>
                <version>1.2.0-ALPHA3</version>
                <version>1.2.0-BETA1</version>
                <version>1.2.0-BETA2</version>
                <version>1.2.0-BETA3</version>
                <version>1.2.0-RC1</version>
                <version>1.2.0</version>
                <version>1.2.1</version>
                <version>1.2.2</version>
                <version>1.2.3</version>
                <version>1.2.4</version>
                                                <component>Caching</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-999] Query cache key can be incorrectly generated</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-999</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;1. We have two versions of the application on the same server. &lt;br/&gt;
2. Second application has an updated database. New field is added to one of the models. &lt;br/&gt;
3. When the second app is hit first, query is stored in APC.&lt;br/&gt;
4. First app finds cached query and tries to call it. Exception is thrown as it doesn&apos;t know anything about the new field yet.&lt;/p&gt;

&lt;p&gt;Situation often happens on shared development machine when one developer adds a field but others don&apos;t have in their models yet. It also happens on staging server if it&apos;s shared with production.&lt;/p&gt;

&lt;p&gt;I suspect it only affects &lt;b&gt;queries without explicitly listed fields&lt;/b&gt;. &lt;/p&gt;

&lt;p&gt;To quickly fix the issue in my symfony project I extended Doctrine_Cache_Apc to implement namespaces (&lt;a href=&quot;https://gist.github.com/944524&quot; class=&quot;external-link&quot;&gt;https://gist.github.com/944524&lt;/a&gt;). More appropriate place to fix it would be Doctrine_Query_Abstract::calculateQueryCacheHash().&lt;/p&gt;</description>
                <environment></environment>
            <key id="12587">DC-999</key>
            <summary>Query cache key can be incorrectly generated</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="romanb">Roman S. Borschel</assignee>
                                <reporter username="kuba">Jakub Zalas</reporter>
                        <labels>
                    </labels>
                <created>Thu, 28 Apr 2011 04:50:07 +0000</created>
                <updated>Mon, 27 Jun 2011 18:20:20 +0000</updated>
                                    <version>1.2.4</version>
                                                <component>Caching</component>
                <component>Query</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="16084" author="grass" created="Mon, 27 Jun 2011 18:20:20 +0000"  >&lt;p&gt;Could this be a duplicate of &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-389&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/jira/browse/DC-389&lt;/a&gt; ?&lt;br/&gt;
Are you querying a model with a *-to-many relation and applying a limit?&lt;/p&gt;

&lt;p&gt;See also &lt;a href=&quot;http://www.doctrine-project.org/documentation/manual/1_2/en/dql-doctrine-query-language:limit-and-offset-clauses:the-limit-subquery-algorithm&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/documentation/manual/1_2/en/dql-doctrine-query-language:limit-and-offset-clauses:the-limit-subquery-algorithm&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-390] doctrine_cache_keys bigger than 1mb</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-390</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;When multiple projects using doctrine use the same memcached server the doctrine_cache_keys can get bigger then 1mb and php will be throwing warnings telling that the data is too big to be stored by memcached.&lt;/p&gt;

&lt;p&gt;I am currently using a workaround, having 1 doctrine_cache_keys per application, on the file Cache/Driver.php i added the following line to the constructor&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;$this-&amp;gt;_cacheKeyIndexKey = &apos;doctrine_cache_keys_&apos; . md5(Doctrine_Manager::getInstance()-&amp;gt;getCurrentConnection()-&amp;gt;getOption(&apos;dsn&apos;));
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;but if an application uses more than 1mb en keys then the notice will rise again.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10669">DC-390</key>
            <summary>doctrine_cache_keys bigger than 1mb</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="crosspad">Douglas Yau</reporter>
                        <labels>
                    </labels>
                <created>Wed, 30 Dec 2009 17:49:24 +0000</created>
                <updated>Wed, 27 Jan 2010 23:33:01 +0000</updated>
                                    <version>1.2.1</version>
                                                <component>Caching</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="11368" author="circlechu" created="Wed, 13 Jan 2010 13:33:10 +0000"  >&lt;p&gt;Why doctrine need to save the keys when it is timeout? I found doctrine will hold the duplicated keys in doctrine_cache_keys map. So this is why it will become more and more bigger.  So I think if I remove those duplicated key it will be better? Here is my solution&lt;br/&gt;
I add array_unique function to remove all duplicated keys in the map. This method is in the Doctrine_Cache_Driver class.&lt;/p&gt;

&lt;p&gt;    /**&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Save a cache key in the index of cache keys&lt;br/&gt;
     *&lt;/li&gt;
	&lt;li&gt;@param string $key&lt;/li&gt;
	&lt;li&gt;@return boolean True if successful and false if something went wrong.&lt;br/&gt;
     */&lt;br/&gt;
    protected function _saveKey($key)
    {
        $keys = $this-&amp;gt;fetch($this-&amp;gt;_cacheKeyIndexKey);
        $keys[] = $key;
        $keys=array_unique ($keys);
        return $this-&amp;gt;save($this-&amp;gt;_cacheKeyIndexKey, $keys, null, false);
    }&lt;/li&gt;
&lt;/ul&gt;
</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10001">
                <name>Reference</name>
                                                <inwardlinks description="is referenced by">
                            <issuelink>
            <issuekey id="10795">DC-460</issuekey>
        </issuelink>
                    </inwardlinks>
                            </issuelinktype>
                    </issuelinks>
                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-389] query cache doesn&apos;t cache _isLimitSubqueryUsed</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-389</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;The problem is that _isLimitSubqueryUsed is not cached with query cache. &lt;br/&gt;
It gets calculated when building query, but when the query is coming &lt;br/&gt;
from cache it&apos;s not. &lt;br/&gt;
Because of this, line 1087 of Query/Abstract.php is never executed, &lt;br/&gt;
when coming from cache: &lt;br/&gt;
if ($this-&amp;gt;isLimitSubqueryUsed() &amp;amp;&amp;amp; &lt;br/&gt;
    $this-&amp;gt;_conn-&amp;gt;getAttribute(Doctrine::ATTR_DRIVER_NAME) !== &lt;br/&gt;
&apos;mysql&apos;) &lt;/p&gt;
{ 
    $params = array_merge((array) $params, (array) $params); 
} 

Maybe it is on purpose, but I didn&apos;t get any answer on the google-groups.

Here is a diff I use now: 
Index: trunk/gui/doctrine-library/Doctrine/Query/Abstract.php 
=================================================================== 
--- a/trunk/gui/doctrine-library/Doctrine/Query/Abstract.php 
+++ b/trunk/gui/doctrine-library/Doctrine/Query/Abstract.php 
@@ -1286,4 +1286,5 @@ 
         $cached = unserialize($cached); 
         $this-&amp;gt;_tableAliasMap = $cached[2]; 
+        $this-&amp;gt;_isLimitSubqueryUsed = $cached[3]; 
         $customComponent = $cached[0]; 
@@ -1346,5 +1347,5 @@ 
         }
&lt;p&gt; &lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;return serialize(array($customComponent, $componentInfo,&lt;br/&gt;
$this-&amp;gt;getTableAliasMap())); &lt;br/&gt;
+        return serialize(array($customComponent, $componentInfo, &lt;br/&gt;
$this-&amp;gt;getTableAliasMap(), $this-&amp;gt;isLimitSubqueryUsed())); &lt;br/&gt;
     }&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment>Postgres db, php5.2, linux</environment>
            <key id="10664">DC-389</key>
            <summary>query cache doesn&apos;t cache _isLimitSubqueryUsed</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="szotyi">Peter Kovacs</reporter>
                        <labels>
                    </labels>
                <created>Sat, 26 Dec 2009 20:53:34 +0000</created>
                <updated>Mon, 27 Jun 2011 18:06:25 +0000</updated>
                                    <version>1.1.5</version>
                <version>1.1.6</version>
                <version>1.2.4</version>
                                                <component>Caching</component>
                <component>Query</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="16082" author="grass" created="Mon, 27 Jun 2011 18:06:25 +0000"  >&lt;p&gt;This still seems to be a problem in version 1.2.4, rendering the query cache unusable for our project.&lt;br/&gt;
The suggested fix works fine, and seems to hold litte potential for trouble.&lt;/p&gt;

&lt;p&gt;Anyone still listening/reading here? We are aware of the EOL, but would love to produce a test case to anyone (&quot;official&quot;) trying to fix this - just not sure if it is still worth bothering...&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-829] Hydrator/RecordDriver/setLastElement And APC useResultCache</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-829</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;1) I have a Query with APC useResultCache  with leftJoin between User and Avatar. (With no avatar for this User).&lt;br/&gt;
2) I have au Query without APC useResultCache  with leftJoin between Gallery, User and Avatar (Same user than 1))&lt;/p&gt;

&lt;p&gt;On the first show of my page =&amp;gt; OK&lt;br/&gt;
On second show of my page (With APC Cache) error when i call user-&amp;gt;getGalleries() :&lt;/p&gt;

&lt;p&gt;In Hydrator/RecordDriver.php setLastElement()&lt;/p&gt;

&lt;p&gt;$coll is instanceOf Doctrine_Null and count($coll) return 1, so =&amp;gt; Crash because -&amp;gt;getLast doesn&apos;t exist in Doctrine_Null class&lt;/p&gt;

&lt;p&gt;If you add in setLastElement() (Before if (count($coll) &amp;gt; 0) ....&lt;/p&gt;

&lt;p&gt;if ($coll instanceOf Doctrine_Null) &lt;/p&gt;
{
        	return;
        }

&lt;p&gt;It&apos;s works.&lt;/p&gt;</description>
                <environment></environment>
            <key id="11779">DC-829</key>
            <summary>Hydrator/RecordDriver/setLastElement And APC useResultCache</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="romanb">Roman S. Borschel</assignee>
                                <reporter username="zaor">PIERRONT Julien</reporter>
                        <labels>
                    </labels>
                <created>Mon, 16 Aug 2010 17:02:25 +0000</created>
                <updated>Mon, 16 Aug 2010 17:02:25 +0000</updated>
                                    <version>1.2.0</version>
                                                <component>Caching</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-812] Postgresql and query cache</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-812</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;After enabling:&lt;/p&gt;

&lt;p&gt;$manager-&amp;gt;setAttribute(Doctrine_Core::ATTR_QUERY_CACHE, $cacheDriver);&lt;br/&gt;
(both Memcache and APC)&lt;/p&gt;

&lt;p&gt;I get:&lt;/p&gt;

&lt;p&gt;Doctrine_Connection_Pgsql_Exception: SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;08P01&amp;#93;&lt;/span&gt;: &amp;lt;&amp;gt;: 7 ERROR: bind message supplies 8 parameters, but prepared statement &quot;pdo_stmt_00000008&quot; requires 16 in /home/taat/www/library/Doctrine/1.2.2/lib/Doctrine/Connection.php on line 1082&lt;/p&gt;

&lt;p&gt;Without the cache everything works OK.&lt;br/&gt;
RESULT_CACHE works OK too.&lt;/p&gt;

&lt;p&gt;Maybe this may help somehow:&lt;br/&gt;
&lt;a href=&quot;http://bugs.php.net/33886&quot; class=&quot;external-link&quot;&gt;http://bugs.php.net/33886&lt;/a&gt;&lt;/p&gt;
</description>
                <environment>Postgresql 8.4, Ubuntu 10.04, PHP 5.3, latest APC and Memcache, Memcached</environment>
            <key id="11735">DC-812</key>
            <summary>Postgresql and query cache</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="romanb">Roman S. Borschel</assignee>
                                <reporter username="admirau">admirau</reporter>
                        <labels>
                    </labels>
                <created>Fri, 6 Aug 2010 17:13:54 +0000</created>
                <updated>Fri, 6 Aug 2010 17:14:47 +0000</updated>
                                    <version>1.2.2</version>
                                                <component>Caching</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-1001] Doctrine Caching page does not mention the &quot;prefix&quot; option</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-1001</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;&lt;a href=&quot;http://www.doctrine-project.org/documentation/manual/1_1/en/caching&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/documentation/manual/1_1/en/caching&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When not using a prefix with multiple / yet similay projects a mixup of query caching will occur (for example with sfDoctrineGuard queries). This is very easialy fixed with a prefix - but I only realized after two months - that this feature actually existed. There is no mention of this in the documention.&lt;/p&gt;

&lt;p&gt;A mention of the feature &lt;/p&gt;

&lt;p&gt;$q = Doctrine_Query::create()&lt;br/&gt;
    -&amp;gt;useResultCache(new Doctrine_Cache_Apc(array(&apos;prefix&apos;=&amp;gt;&apos;myproject_&apos;)));&lt;/p&gt;

&lt;p&gt;Would have helped me and I think it will also help others.&lt;/p&gt;</description>
                <environment></environment>
            <key id="12595">DC-1001</key>
            <summary>Doctrine Caching page does not mention the &quot;prefix&quot; option</summary>
                <type id="6" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/documentation.png">Documentation</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="romanb">Roman S. Borschel</assignee>
                                <reporter username="arendvw">Arend van Waart</reporter>
                        <labels>
                    </labels>
                <created>Fri, 29 Apr 2011 19:26:40 +0000</created>
                <updated>Mon, 27 Jun 2011 18:14:37 +0000</updated>
                                    <version>1.2.4</version>
                                                <component>Caching</component>
                <component>Documentation</component>
                        <due></due>
                    <votes>1</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="16083" author="grass" created="Mon, 27 Jun 2011 18:14:37 +0000"  >&lt;p&gt;I concur with Arend - mentioning of &apos;prefix&apos; in the documentation could make this valuable feature much less of a pain to find...&lt;br/&gt;
Still holds true in 1.2. documentation: &lt;a href=&quot;http://www.doctrine-project.org/projects/orm/1.2/docs/manual/caching/en&quot; class=&quot;external-link&quot;&gt;http://www.doctrine-project.org/projects/orm/1.2/docs/manual/caching/en&lt;/a&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>