2010年1月28日星期四

Re: [fw-mvc] zend_registry or zend_cache_manager

Really depends. Zend_Cache_Manager was designed as a "Lazy Loader". You set your configuration for caches on it, and instantiate them later using Zend_Cache_Manager::getCache() if needed. Otherwise they are not instantiated. Using it as a Registry (which it is of sorts) is also fine. You can retrieve it from any Controller using:

$this->_helper->getHelper('Cache')->getManager()->getCache('myCache');

Important point is that sticking an existing cache object anywhere is fairly cheap - all you are doing is passing around object references ;).
 
Pádraic Brady

http://blog.astrumfutura.com
http://www.survivethedeepend.com
OpenID Europe Foundation Irish Representative



From: sina miandashti <miandashti@gmail.com>
To: Zend MVC <fw-mvc@lists.zend.com>
Sent: Thu, January 28, 2010 1:45:14 PM
Subject: [fw-mvc] zend_registry or zend_cache_manager

hi all developers ;)


$cache = Zend_Cache::factory('Core','File',$frontend,$backend);

1:


$manager = new Zend_Cache_Manager;
$manager->setCache('appcache', $cache);


2:

Zend_Registry::set ( 'cache', $cache );

------------------------------------------------------------------------

which one is better for storing the $cache object ...   ?

for better performance and better memory usage and etc...

--
________________
Sincerely
Sina Miandashti
MuSicBasE.ir & InvisionPower.ir Admin

没有评论: