blob: 4f45cac9c697b4ba757482ca79f941836dc91dbe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
<?php
/**
* TCache and cache dependency classes.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
* @copyright Copyright © 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
* @package Prado\Caching
*/
namespace Prado\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 <qiang.xue@gmail.com>
* @package Prado\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;
}
}
|