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:  * CZendDataCache class file
 4:  *
 5:  * @author Steffen Dietz <steffo.dietz[at]googlemail[dot]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:  * CZendDataCache implements a cache application module based on the Zend Data Cache
13:  * delivered with {@link http://www.zend.com/en/products/server/ ZendServer}.
14:  *
15:  * To use this application component, the Zend Data Cache PHP extension must be loaded.
16:  *
17:  * See {@link CCache} manual for common cache operations that are supported by CZendDataCache.
18:  *
19:  * @author Steffen Dietz <steffo.dietz[at]googlemail[dot]com>
20:  * @package system.caching
21:  */
22: class CZendDataCache extends CCache
23: {
24:     /**
25:      * Initializes this application component.
26:      * This method is required by the {@link IApplicationComponent} interface.
27:      * It checks the availability of Zend Data Cache.
28:      * @throws CException if Zend Data Cache extension is not loaded.
29:      */
30:     public function init()
31:     {
32:         parent::init();
33:         if(!function_exists('zend_shm_cache_store'))
34:             throw new CException(Yii::t('yii','CZendDataCache requires PHP Zend Data Cache extension to be loaded.'));
35:     }
36: 
37:     /**
38:      * Retrieves a value from cache with a specified key.
39:      * This is the implementation of the method declared in the parent class.
40:      * @param string $key a unique key identifying the cached value
41:      * @return string|boolean the value stored in cache, false if the value is not in the cache or expired.
42:      */
43:     protected function getValue($key)
44:     {
45:         $result = zend_shm_cache_fetch($key);
46:         return $result !== NULL ? $result : false;
47:     }
48: 
49:     /**
50:      * Stores a value identified by a key in cache.
51:      * This is the implementation of the method declared in the parent class.
52:      *
53:      * @param string $key the key identifying the value to be cached
54:      * @param string $value the value to be cached
55:      * @param integer $expire the number of seconds in which the cached value will expire. 0 means never expire.
56:      * @return boolean true if the value is successfully stored into cache, false otherwise
57:      */
58:     protected function setValue($key,$value,$expire)
59:     {
60:         return zend_shm_cache_store($key,$value,$expire);
61:     }
62: 
63:     /**
64:      * Stores a value identified by a key into cache if the cache does not contain this key.
65:      * This is the implementation of the method declared in the parent class.
66:      *
67:      * @param string $key the key identifying the value to be cached
68:      * @param string $value the value to be cached
69:      * @param integer $expire the number of seconds in which the cached value will expire. 0 means never expire.
70:      * @return boolean true if the value is successfully stored into cache, false otherwise
71:      */
72:     protected function addValue($key,$value,$expire)
73:     {
74:         return (NULL === zend_shm_cache_fetch($key)) ? $this->setValue($key,$value,$expire) : false;
75:     }
76: 
77:     /**
78:      * Deletes a value with the specified key from cache
79:      * This is the implementation of the method declared in the parent class.
80:      * @param string $key the key of the value to be deleted
81:      * @return boolean if no error happens during deletion
82:      */
83:     protected function deleteValue($key)
84:     {
85:         return zend_shm_cache_delete($key);
86:     }
87: 
88:     /**
89:      * Deletes all values from cache.
90:      * This is the implementation of the method declared in the parent class.
91:      * @return boolean whether the flush operation was successful.
92:      * @since 1.1.5
93:      */
94:     protected function flushValues()
95:     {
96:         return zend_shm_cache_clear();
97:     }
98: }
99: 
API documentation generated by ApiGen 2.8.0