Don't think so. Singleton only if you have base model class, and/or only for default cache (BaseModel::setDefaultCache(), BaseModel::getDefaultCache()). Otherwise singleton is wrong approach.
--
Regards,
Vladas Diržys
On Fri, Jan 15, 2010 at 19:31, Andreas Möller <localheinz@l8m.de> wrote:
Then the cache instance probably should be a singleton.Does this means that you should have base class for all models with
getCache method, and extend it?
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
没有评论:
发表评论