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

  • CApcCache
  • CCache
  • CDbCache
  • CDummyCache
  • CEAcceleratorCache
  • CFileCache
  • CMemCache
  • CMemCacheServerConfiguration
  • CRedisCache
  • CWinCache
  • CXCache
  • CZendDataCache
  • X2FileCache

Interfaces

  • ICache
  • ICacheDependency
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * CDummyCache 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:  * CDummyCache is a placeholder cache component.
 13:  *
 14:  * CDummyCache does not cache anything. It is provided so that one can always configure
 15:  * a 'cache' application component and he does not need to check if Yii::app()->cache is null or not.
 16:  * By replacing CDummyCache with some other cache component, one can quickly switch from
 17:  * non-caching mode to caching mode.
 18:  *
 19:  * @author Qiang Xue <qiang.xue@gmail.com>
 20:  * @package system.caching
 21:  * @since 1.0
 22:  */
 23: class CDummyCache extends CApplicationComponent implements ICache, ArrayAccess
 24: {
 25:     /**
 26:      * @var string a string prefixed to every cache key so that it is unique. Defaults to {@link CApplication::getId() application ID}.
 27:      */
 28:     public $keyPrefix;
 29: 
 30:     /**
 31:      * Initializes the application component.
 32:      * This method overrides the parent implementation by setting default cache key prefix.
 33:      */
 34:     public function init()
 35:     {
 36:         parent::init();
 37:         if($this->keyPrefix===null)
 38:             $this->keyPrefix=Yii::app()->getId();
 39:     }
 40: 
 41:     /**
 42:      * Retrieves a value from cache with a specified key.
 43:      * @param string $id a key identifying the cached value
 44:      * @return mixed the value stored in cache, false if the value is not in the cache, expired or the dependency has changed.
 45:      */
 46:     public function get($id)
 47:     {
 48:         return false;
 49:     }
 50: 
 51:     /**
 52:      * Retrieves multiple values from cache with the specified keys.
 53:      * Some caches (such as memcache, apc) allow retrieving multiple cached values at one time,
 54:      * which may improve the performance since it reduces the communication cost.
 55:      * In case a cache doesn't support this feature natively, it will be simulated by this method.
 56:      * @param array $ids list of keys identifying the cached values
 57:      * @return array list of cached values corresponding to the specified keys. The array
 58:      * is returned in terms of (key,value) pairs.
 59:      * If a value is not cached or expired, the corresponding array value will be false.
 60:      */
 61:     public function mget($ids)
 62:     {
 63:         $results=array();
 64:         foreach($ids as $id)
 65:             $results[$id]=false;
 66:         return $results;
 67:     }
 68: 
 69:     /**
 70:      * Stores a value identified by a key into cache.
 71:      * If the cache already contains such a key, the existing value and
 72:      * expiration time will be replaced with the new ones.
 73:      *
 74:      * @param string $id the key identifying the value to be cached
 75:      * @param mixed $value the value to be cached
 76:      * @param integer $expire the number of seconds in which the cached value will expire. 0 means never expire.
 77:      * @param ICacheDependency $dependency dependency of the cached item. If the dependency changes, the item is labeled invalid.
 78:      * @return boolean true if the value is successfully stored into cache, false otherwise
 79:      */
 80:     public function set($id,$value,$expire=0,$dependency=null)
 81:     {
 82:         return true;
 83:     }
 84: 
 85:     /**
 86:      * Stores a value identified by a key into cache if the cache does not contain this key.
 87:      * Nothing will be done if the cache already contains the key.
 88:      * @param string $id the key identifying the value to be cached
 89:      * @param mixed $value the value to be cached
 90:      * @param integer $expire the number of seconds in which the cached value will expire. 0 means never expire.
 91:      * @param ICacheDependency $dependency dependency of the cached item. If the dependency changes, the item is labeled invalid.
 92:      * @return boolean true if the value is successfully stored into cache, false otherwise
 93:      */
 94:     public function add($id,$value,$expire=0,$dependency=null)
 95:     {
 96:         return true;
 97:     }
 98: 
 99:     /**
100:      * Deletes a value with the specified key from cache
101:      * @param string $id the key of the value to be deleted
102:      * @return boolean if no error happens during deletion
103:      */
104:     public function delete($id)
105:     {
106:         return true;
107:     }
108: 
109:     /**
110:      * Deletes all values from cache.
111:      * Be careful of performing this operation if the cache is shared by multiple applications.
112:      * @return boolean whether the flush operation was successful.
113:      * @throws CException if this method is not overridden by child classes
114:      */
115:     public function flush()
116:     {
117:         return true;
118:     }
119: 
120:     /**
121:      * Returns whether there is a cache entry with a specified key.
122:      * This method is required by the interface ArrayAccess.
123:      * @param string $id a key identifying the cached value
124:      * @return boolean
125:      */
126:     public function offsetExists($id)
127:     {
128:         return false;
129:     }
130: 
131:     /**
132:      * Retrieves the value from cache with a specified key.
133:      * This method is required by the interface ArrayAccess.
134:      * @param string $id a key identifying the cached value
135:      * @return mixed the value stored in cache, false if the value is not in the cache or expired.
136:      */
137:     public function offsetGet($id)
138:     {
139:         return false;
140:     }
141: 
142:     /**
143:      * Stores the value identified by a key into cache.
144:      * If the cache already contains such a key, the existing value will be
145:      * replaced with the new ones. To add expiration and dependencies, use the set() method.
146:      * This method is required by the interface ArrayAccess.
147:      * @param string $id the key identifying the value to be cached
148:      * @param mixed $value the value to be cached
149:      */
150:     public function offsetSet($id, $value)
151:     {
152:     }
153: 
154:     /**
155:      * Deletes the value with the specified key from cache
156:      * This method is required by the interface ArrayAccess.
157:      * @param string $id the key of the value to be deleted
158:      * @return boolean if no error happens during deletion
159:      */
160:     public function offsetUnset($id)
161:     {
162:     }
163: }
164: 
API documentation generated by ApiGen 2.8.0