For the first time I have set up a results cache in doctrine 1.24 by applying the following code:
$servers = array(
'host' => 'localhost',
'port' => 11211,
'persistent' => true
);
$cacheDriver = new Doctrine_Cache_Memcache(
array(
'servers' => $servers,
'compression' => false
)
);
$manager->setAttribute(Doctrine::ATTR_RESULT_CACHE,$cacheDriver);
$manager->setAttribute(Doctrine::ATTR_RESULT_CACHE_LIFESPAN, 3600 );
This works great for caching DQL quires such as:
enter code here$q = Doctrine_Query::create()
->from('Software s')
->leftJoin('s.Files f')
->useResultCache();
$q->execute();
However, What interests me is how do I cache table lookups such as:
xyzTable::getInstance()->findOneBySufff($stuff);
These are by far more frequent in my application code. How do I achieve this? Additionally, if anyone has a guide for using memcache with doctrine 1.2 I'd be more then happy.