From e8b60312037e54c34a06d6f57d7c21946cf3cd1f Mon Sep 17 00:00:00 2001 From: xue <> Date: Wed, 28 Dec 2005 20:17:54 +0000 Subject: Modified the way to access application singleton. IService and IModule interfaces are also adjusted accordingly. --- framework/Data/TMemCache.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'framework/Data/TMemCache.php') diff --git a/framework/Data/TMemCache.php b/framework/Data/TMemCache.php index e4e9ffa3..a34cd9a6 100644 --- a/framework/Data/TMemCache.php +++ b/framework/Data/TMemCache.php @@ -44,7 +44,7 @@ * Some usage examples of TMemCache are as follows, * * $cache=new TMemCache; // TMemCache may also be loaded as a Prado application module - * $cache->init(null); + * $cache->init(); * $cache->add('object',$object); * $object2=$cache->get('object'); * @@ -105,19 +105,18 @@ class TMemCache extends TModule implements ICache * @param TXmlElement configuration for this module, can be null * @throws TConfigurationException if memcache extension is not installed or memcache sever connection fails */ - public function init($application,$config) + public function init($config=null) { - parent::init($application,$config); + parent::init($config); if(!extension_loaded('memcache')) throw new TConfigurationException('memcache_extension_required'); $this->_cache=new Memcache; if($this->_cache->connect($this->_host,$this->_port)===false) throw new TConfigurationException('memcache_connection_failed',$this->_host,$this->_port); - if($application instanceof TApplication) - $this->_prefix=$application->getUniqueID(); + $this->_prefix=$this->getApplication()->getUniqueID(); $this->_initialized=true; - $application->setCache($this); + $this->getApplication()->setCache($this); } /** -- cgit v1.2.3