From 10ba6d05b807d3a4a01408a4085455976d4ac89b Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 11 Jan 2008 15:17:42 +0000 Subject: TParameterModule added caching support --- framework/Util/TParameterModule.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'framework/Util') diff --git a/framework/Util/TParameterModule.php b/framework/Util/TParameterModule.php index fb962db4..e63fad1d 100644 --- a/framework/Util/TParameterModule.php +++ b/framework/Util/TParameterModule.php @@ -59,8 +59,21 @@ class TParameterModule extends TModule $this->loadParameters($config); if($this->_paramFile!==null) { - $dom=new TXmlDocument; - $dom->loadFromFile($this->_paramFile); + if(($cache=$this->getApplication()->getCache())!==null) + { + $cacheKey='TParameterModule:'.$this->_paramFile; + if(($dom=$cache->get($cacheKey))===false) + { + $dom=new TXmlDocument; + $dom->loadFromFile($this->_paramFile); + $cache->set($cacheKey,$dom,0,new TFileCacheDependency($this->_paramFile)); + } + } + else + { + $dom=new TXmlDocument; + $dom->loadFromFile($this->_paramFile); + } $this->loadParameters($dom); } $this->_initialized=true; -- cgit v1.2.3