Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • CCacheDependency
  • CChainedCacheDependency
  • CDbCacheDependency
  • CDirectoryCacheDependency
  • CExpressionDependency
  • CFileCacheDependency
  • CGlobalStateCacheDependency
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * CChainedCacheDependency class file.
 4:  *
 5:  * @author Qiang Xue <qiang.xue@gmail.com>
 6:  * @link http://www.yiiframework.com/
 7:  * @copyright 2008-2013 Yii Software LLC
 8:  * @license http://www.yiiframework.com/license/
 9:  */
10: 
11: /**
12:  * CChainedCacheDependency represents a list of cache dependencies.
13:  *
14:  * If any of the dependencies reports a dependency change, CChainedCacheDependency
15:  * will return true for the checking.
16:  *
17:  * To add dependencies to CChainedCacheDependency, use {@link getDependencies Dependencies}
18:  * which gives a {@link CTypedList} instance and can be used like an array
19:  * (see {@link CList} for more details}).
20:  *
21:  * @property CTypedList $dependencies List of dependency objects.
22:  * @property boolean $hasChanged Whether the dependency is changed or not.
23:  *
24:  * @author Qiang Xue <qiang.xue@gmail.com>
25:  * @package system.caching.dependencies
26:  * @since 1.0
27:  */
28: class CChainedCacheDependency extends CComponent implements ICacheDependency
29: {
30:     private $_dependencies=null;
31: 
32:     /**
33:      * Constructor.
34:      * @param array $dependencies the dependencies to be added to this chain.
35:      * @since 1.1.4
36:      */
37:     public function __construct($dependencies=array())
38:     {
39:         if(!empty($dependencies))
40:             $this->setDependencies($dependencies);
41:     }
42: 
43:     /**
44:      * @return CTypedList list of dependency objects
45:      */
46:     public function getDependencies()
47:     {
48:         if($this->_dependencies===null)
49:             $this->_dependencies=new CTypedList('ICacheDependency');
50:         return $this->_dependencies;
51:     }
52: 
53:     /**
54:      * @param array $values list of dependency objects or configurations to be added to this chain.
55:      * If a dependency is specified as a configuration, it must be an array that can be recognized
56:      * by {@link YiiBase::createComponent}.
57:      */
58:     public function setDependencies($values)
59:     {
60:         $dependencies=$this->getDependencies();
61:         foreach($values as $value)
62:         {
63:             if(is_array($value))
64:                 $value=Yii::createComponent($value);
65:             $dependencies->add($value);
66:         }
67:     }
68: 
69:     /**
70:      * Evaluates the dependency by generating and saving the data related with dependency.
71:      */
72:     public function evaluateDependency()
73:     {
74:         if($this->_dependencies!==null)
75:         {
76:             foreach($this->_dependencies as $dependency)
77:                 $dependency->evaluateDependency();
78:         }
79:     }
80: 
81:     /**
82:      * Performs the actual dependency checking.
83:      * This method returns true if any of the dependency objects
84:      * reports a dependency change.
85:      * @return boolean whether the dependency is changed or not.
86:      */
87:     public function getHasChanged()
88:     {
89:         if($this->_dependencies!==null)
90:         {
91:             foreach($this->_dependencies as $dependency)
92:                 if($dependency->getHasChanged())
93:                     return true;
94:         }
95:         return false;
96:     }
97: }
98: 
API documentation generated by ApiGen 2.8.0