2010年1月15日星期五

Re: [fw-mvc] Re: [fw-general] Bootstrap Resource usage in model - best practice advice please

> Does this means that you should have base class for all models with
> getCache method, and extend it?

Then the cache instance probably should be a singleton.

protected function _getCache()
{
if (self::$_cacheInstance === NULL) {
// self::$_cacheInstance = Zend_Registry::get('Zend_Cache');
self::$_cacheInstance =
Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('Cache');
}
return self::$_cacheInstance;
}


Best regards,

Andreas

没有评论: