title: Caching plugin and normal controllers with duplicate names
body: <p>I'm running into a problem related to caching, plugins and duplicate model names in Cake 2.0. My application has several controllers containing only actions for public use (view, index and equivalents). The data is managed by a CMS which is added as a plugin, some names of the plugin's controller are the same. </p>
  
  <p>For example, I have a PostsController in my application and a PostsController for the plugin. The plugin controller extends <code>PluginAppController</code> and the public controller extends <code>AppController</code> as per the manual. As soon as caching is kicked in (by setting <code>debug</code> to <code>0</code>) the problems start. Cake tries to access a non-existing <code>add</code> action in the controller which extends <code>AppController</code> and the public application tries to access methods from the <code>PluginAppController</code>.</p>
  
  <p>I don't understand why Cake would do this and it creates all kinds of errors (blank pages, lost sessions) which aren't logged properly as well. Everything was working well while the app still ran on Cake 1.3 and also in 2.0 production mode.</p>
  
  <p>The file <code>cake_core_file_map</code> in the <code>/tmp/cache/persistent/</code> directory seems to be causing the issue. As soon as I remove this and reload either of the views, it renders correctly. So the procedure is as follows:</p>
  
  <ul>
  <li>Load <code>http://www.example.com/admin/posts</code> successfully;</li>
  <li>Load <code>http://www.example.com/posts</code> (it fails to render);</li>
  <li>Clear the cache (or just cake_core_file_map);</li>
  <li>Load <code>http://www.example.com/posts</code> successfully;</li>
  <li>Load <code>http://www.example.com/admin/posts</code> (which now fails to load properly).</li>
  </ul>
  
  <p>My guess is Cake fails to save the correct references to the plugin and main application paths in <code>cake_core_file_map</code>, but I have no clue how to force Cake to behave nicely in that regard. </p>
  
  <p>Does anybody know how to stop Cake from confusing the plugin's controllers with the other ones with duplicate names?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>This issue might be related to a bug in Cake, as <a href="http://cakephp.lighthouseapp.com/projects/42648/tickets/2108-fatal-error-plugin-appmodel-not-found-with-caching-enabled-in-certain-circumstance" rel="nofollow">this report</a> mentions similar problems and <code>cake_core_file_map</code> as well. The fix mentioned <a href="http://cakephp.lighthouseapp.com/projects/42648/tickets/2108-fatal-error-plugin-appmodel-not-found-with-caching-enabled-in-certain-circumstance#ticket-2108-16" rel="nofollow">here</a> doesn't work unfortunately.</p>
  
  <p><strong>EDIT 2</strong>
  There is indeed some custom routing going on, which was working normally in Cake 1.3. This is from <code>routes.php</code>:</p>
  
  <pre><code>Router::connect('/plugin_name', array('plugin' =&gt; 'plugin_name', 'controller' =&gt; 'users', 'action' =&gt; 'login'));
  Router::connect('/admin/*', array('plugin' =&gt; 'plugin_name', 'controller' =&gt; 'posts', 'action' =&gt; 'index'));
  </code></pre>