From d45b5615d48bff5373a6cda0728cb26332c3d962 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Tue, 20 Jan 2015 19:19:55 +0100 Subject: One class per file: framework/Caching/ --- framework/Caching/TChainedCacheDependency.php | 59 +++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 framework/Caching/TChainedCacheDependency.php (limited to 'framework/Caching/TChainedCacheDependency.php') diff --git a/framework/Caching/TChainedCacheDependency.php b/framework/Caching/TChainedCacheDependency.php new file mode 100644 index 00000000..463919fd --- /dev/null +++ b/framework/Caching/TChainedCacheDependency.php @@ -0,0 +1,59 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package System.Caching + */ + + +/** + * TChainedCacheDependency class. + * + * TChainedCacheDependency represents a list of cache dependency objects + * and performs the dependency checking based on the checking results of + * these objects. If any of them reports a dependency change, TChainedCacheDependency + * will return true for the checking. + * + * To add dependencies to TChainedCacheDependency, use {@link getDependencies Dependencies} + * which gives a {@link TCacheDependencyList} instance and can be used like an array + * (see {@link TList} for more details}). + * + * @author Qiang Xue + * @package System.Caching + * @since 3.1.0 + */ +class TChainedCacheDependency extends TCacheDependency +{ + private $_dependencies=null; + + /** + * @return TCacheDependencyList list of dependency objects + */ + public function getDependencies() + { + if($this->_dependencies===null) + $this->_dependencies=new TCacheDependencyList; + return $this->_dependencies; + } + + /** + * Performs the actual dependency checking. + * This method returns true if any of the dependency objects + * reports a dependency change. + * @return boolean whether the dependency is changed or not. + */ + public function getHasChanged() + { + if($this->_dependencies!==null) + { + foreach($this->_dependencies as $dependency) + if($dependency->getHasChanged()) + return true; + } + return false; + } +} \ No newline at end of file -- cgit v1.2.3