Using Memcached with Symfony 1.2 and Doctrine
September 15th, 2009
Make sure you have Memcached installed.
Add this to ProjectConfiguration.class.php
//ProjectConfiguration.class.php public function configureDoctrine(Doctrine_Manager $manager) { $servers = array( 'host' => 'localhost', 'port' => 11211, 'persistent' => true ); $cacheDriver = new Doctrine_Cache_Memcache(array( 'servers' => $servers, 'compression' => false ) ); //enable Doctrine cache $manager = Doctrine_Manager::getInstance(); $manager->setAttribute(Doctrine::ATTR_RESULT_CACHE, $cacheDriver); }
Add this to your query
->useResultCache(true);