I search a good resources with examples to use a doctrine memcached and zend framework.
i search in google but not found, i need resource that Combine all this things.
using Doctrine_Cache_Memcache in zend framework.
thanks
I search a good resources with examples to use a doctrine memcached and zend framework.
i search in google but not found, i need resource that Combine all this things.
using Doctrine_Cache_Memcache in zend framework.
thanks
For ZF and Doctrine integration see: beberlei's zf-doctrine at GitHub
To enable cache, in your application Bootstrap.php:
public function _initDoctrineCache()
{
    $this->bootstrap('doctrine');
    $manager = Doctrine_Manager::getInstance();
    $cacheDriver = null;
    if (extension_loaded('memcache')) {
        $servers = array(
            'host' => 'localhost',
            'port' => 11211,
            'persistent' => true
        );
        $cacheDriver = new Doctrine_Cache_Memcache(array(
                    'servers' => $servers,
                    'compression' => false
                        )
        );
    } else if (function_exists('apc_add')) {
        $cacheDriver = new Doctrine_Cache_Apc();
    }
    if (null !== $cacheDriver) {
        //$manager->setAttribute(Doctrine_Core::ATTR_QUERY_CACHE, $cacheDriver);
        $manager->setAttribute(Doctrine_Core::ATTR_RESULT_CACHE, $cacheDriver);
        $manager->setAttribute(Doctrine_Core::ATTR_RESULT_CACHE_LIFESPAN, 120); // in seconds
    }
    return $cacheDriver;
    }
Of course, you need to have apc, memcache and memcached installed first.