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:  * CGlobalStateCacheDependency 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:  * CGlobalStateCacheDependency represents a dependency based on a global state value.
13:  *
14:  * CGlobalStateCacheDependency checks if a global state is changed or not.
15:  * If the global state is changed, the dependency is reported as changed.
16:  * To specify which global state this dependency should check with,
17:  * set {@link stateName} to the name of the global state.
18:  *
19:  * @author Qiang Xue <qiang.xue@gmail.com>
20:  * @package system.caching.dependencies
21:  * @since 1.0
22:  */
23: class CGlobalStateCacheDependency extends CCacheDependency
24: {
25:     /**
26:      * @var string the name of the global state whose value is to check
27:      * if the dependency has changed.
28:      * @see CApplication::setGlobalState
29:      */
30:     public $stateName;
31: 
32:     /**
33:      * Constructor.
34:      * @param string $name the name of the global state
35:      */
36:     public function __construct($name=null)
37:     {
38:         $this->stateName=$name;
39:     }
40: 
41:     /**
42:      * Generates the data needed to determine if dependency has been changed.
43:      * This method returns the value of the global state.
44:      * @throws CException if {@link stateName} is empty
45:      * @return mixed the data needed to determine if dependency has been changed.
46:      */
47:     protected function generateDependentData()
48:     {
49:         if($this->stateName!==null)
50:             return Yii::app()->getGlobalState($this->stateName);
51:         else
52:             throw new CException(Yii::t('yii','CGlobalStateCacheDependency.stateName cannot be empty.'));
53:     }
54: }
55: 
API documentation generated by ApiGen 2.8.0