Yii Framework v1.1.10 绫诲弬鑰

CZendDataCache

system.caching
缁ф壙 class CZendDataCache » CCache » CApplicationComponent » CComponent
瀹炵幇 ArrayAccess, ICache, IApplicationComponent
鐗堟湰 $Id: CZendDataCache.php 3515 2011-12-28 12:29:24Z mdomba $
婧愮爜 framework/caching/CZendDataCache.php
CZendDataCache鍩轰簬ZendServer 鎻愪緵鐨刏end Data Cache瀹炵幇涓涓紦瀛樺簲鐢ㄦā鍧椼

PHP鎵╁睍Zend Data Cache蹇呴』鍔犺浇浠ヤ娇鐢ㄨ繖涓簲鐢ㄧ▼搴忕粍浠躲

See CCache manual for common cache operations that are supported by CZendDataCache.

鍏叡灞炴

闅愯棌缁ф壙灞炴

灞炴绫诲瀷鎻忚堪瀹氫箟鍦
behaviors array 杩欎釜搴旂敤缁勪欢闄勫姞鐨勮涓恒 杩欐琛屼负灏嗗湪搴旂敤缁勪欢璋冪敤init鏃堕檮鍔犲湪搴旂敤缁勪欢涓娿 璇峰弬鐓CModel::behaviors濡備綍鎸囧畾姝ゅ睘鎬у笺 CApplicationComponent
isInitialized boolean 妫鏌ュ簲鐢ㄧ粍浠舵槸鍚﹀凡缁忓垵濮嬪寲銆 CApplicationComponent
keyPrefix string 鍔犲湪姣忎釜缂撳瓨閿悕鍓嶇殑瀛楃涓蹭互淇濊瘉閿悕鏄敮涓鐨勩傞粯璁ゅ兼槸application ID CCache

鍏叡鏂规硶

闅愯棌缁ф壙鏂规硶

鏂规硶鎻忚堪瀹氫箟鍦
__call() 濡傛灉绫讳腑娌℃湁璋冪殑鏂规硶鍚嶏紝鍒欒皟鐢ㄨ繖涓柟娉曘 CComponent
__get() 杩斿洖涓涓睘鎬у笺佷竴涓簨浠跺鐞嗙▼搴忓垪琛ㄦ垨涓涓涓哄悕绉般 CComponent
__isset() 妫鏌ヤ竴涓睘鎬ф槸鍚︿负null銆 CComponent
__set() 璁剧疆涓涓粍浠剁殑灞炴у笺 CComponent
__unset() 璁剧疆涓涓粍浠剁殑灞炴т负null銆 CComponent
add() 浠呬粎鍦ㄧ攧鍒紦瀛樺肩殑閿悕涓嶅瓨鍦ㄧ殑鎯呭喌涓嬶紝寰缂撳瓨涓瓨鍌ㄥ笺 CCache
asa() 杩斿洖杩欎釜鍚嶅瓧鐨勮涓哄璞° CComponent
attachBehavior() 闄勫姞涓涓涓哄埌缁勪欢銆 CComponent
attachBehaviors() 闄勫姞涓涓涓哄垪琛ㄥ埌缁勪欢銆 CComponent
attachEventHandler() 涓轰簨浠堕檮鍔犱竴涓簨浠跺鐞嗙▼搴忋 CComponent
canGetProperty() 纭畾灞炴ф槸鍚﹀彲璇汇 CComponent
canSetProperty() 纭畾灞炴ф槸鍚﹀彲鍐欍 CComponent
delete() 浠庣紦瀛樹腑鍒犻櫎鎸囧畾閿悕瀵瑰簲鐨勫 CCache
detachBehavior() 浠庣粍浠朵腑鍒嗙涓涓涓恒 CComponent
detachBehaviors() 浠庣粍浠朵腑鍒嗙鎵鏈夎涓恒 CComponent
detachEventHandler() 鍒嗙涓涓瓨鍦ㄧ殑浜嬩欢澶勭悊绋嬪簭銆 CComponent
disableBehavior() 绂佺敤涓涓檮鍔犺涓恒 CComponent
disableBehaviors() 绂佺敤缁勪欢闄勫姞鐨勬墍鏈夎涓恒 CComponent
enableBehavior() 鍚敤涓涓檮鍔犺涓恒 CComponent
enableBehaviors() 鍚敤缁勪欢闄勫姞鐨勬墍鏈夎涓恒 CComponent
evaluateExpression() 璁$畻涓涓狿HP琛ㄨ揪寮忥紝鎴栨牴鎹粍浠朵笂涓嬫枃鎵ц鍥炶皟銆 CComponent
flush() 鍒犻櫎鎵鏈夌紦瀛樺笺 CCache
get() 浠庣紦瀛樹腑妫绱竴涓尮閰嶆寚瀹氶敭鍚嶇殑鍊笺 CCache
getEventHandlers() 杩斿洖涓涓簨浠剁殑闄勫姞澶勭悊绋嬪簭鍒楄〃銆 CComponent
getIsInitialized() 妫鏌ュ簲鐢ㄧ粍浠舵槸鍚﹀凡缁忓垵濮嬪寲銆 CApplicationComponent
hasEvent() 纭畾涓涓簨浠舵槸鍚﹀畾涔夈 CComponent
hasEventHandler() 妫鏌ヤ簨浠舵槸鍚︽湁闄勫姞鐨勫鐞嗙▼搴忋 CComponent
hasProperty() 纭畾灞炴ф槸鍚﹁瀹氫箟銆 CComponent
init() 鍒濆鍖栧簲鐢ㄧ▼搴忕粍浠躲 CZendDataCache
mget() 浠庣紦瀛樹腑妫绱㈠嚭澶氫釜鍖归厤鎸囧畾閿悕鐨勫笺 CCache
offsetExists() 杩斿洖鎸囧畾閿悕鐨勭紦瀛樻潯鐩槸鍚﹀瓨鍦ㄣ CCache
offsetGet() 浠庣紦瀛樹腑妫绱竴涓尮閰嶆寚瀹氶敭鍚嶇殑鍊笺 CCache
offsetSet() 寰缂撳瓨涓瓨鍌ㄤ竴涓敤閿悕鍖哄垎鐨勫笺 CCache
offsetUnset() 浠庣紦瀛樹腑鍒犻櫎鎸囧畾閿悕瀵瑰簲鐨勫 CCache
raiseEvent() 鍙戣捣涓涓簨浠躲 CComponent
set() 鏍规嵁涓涓敤浠ョ攧鍒殑閿悕寰缂撳瓨涓瓨鍌ㄤ竴涓笺 CCache

鍙椾繚鎶ゆ柟娉

闅愯棌缁ф壙鏂规硶

鏂规硶鎻忚堪瀹氫箟鍦
addValue() 浠呬粎鍦ㄧ攧鍒紦瀛樺肩殑閿悕涓嶅瓨鍦ㄧ殑鎯呭喌涓嬶紝寰缂撳瓨涓瓨鍌ㄥ笺 CZendDataCache
deleteValue() 浠庣紦瀛樹腑鍒犻櫎鎸囧畾閿悕瀵瑰簲鐨勫 CZendDataCache
flushValues() 鍒犻櫎鎵鏈夌紦瀛樺笺 CZendDataCache
generateUniqueKey() CCache
getValue() 浠庣紦瀛樹腑妫绱竴涓尮閰嶆寚瀹氶敭鍚嶇殑鍊笺 CZendDataCache
getValues() 浠庣紦瀛樹腑妫绱㈠嚭澶氫釜鍖归厤鎸囧畾閿悕鐨勫笺 CCache
setValue() 寰缂撳瓨涓瓨鍌ㄤ竴涓敤閿悕鍖哄垎鐨勫笺 CZendDataCache

鏂规硶璇︾粏

addValue() 鏂规硶
protected boolean addValue(string $key, string $value, integer $expire)
$key string 鐢ㄤ互鐢勫埆缂撳瓨鍊肩殑閿悕
$value string 瑕佺紦瀛樼殑鍊
$expire integer 浠ョ涓哄崟浣嶇殑鏁板硷紝琛ㄧず缂撳瓨鐨勮繃鏈熸椂闂淬備负0鍒欐案涓嶈繃鏈熴
{return} boolean 鎴愬姛瀛樺偍鍒扮紦瀛樹腑鍒欒繑鍥瀟rue锛屽惁鍒欒繑鍥瀎alse
婧愮爜锛 framework/caching/CZendDataCache.php#73 (鏄剧ず)
protected function addValue($key,$value,$expire)
{
    return (
NULL === zend_shm_cache_fetch($key)) ? $this->setValue($key,$value,$expire) : false;
}

浠呬粎鍦ㄧ攧鍒紦瀛樺肩殑閿悕涓嶅瓨鍦ㄧ殑鎯呭喌涓嬶紝寰缂撳瓨涓瓨鍌ㄥ笺 杩欐槸鍦ㄧ埗绫讳腑瀹氫箟鐨勬柟娉曠殑鍏蜂綋瀹炵幇銆

deleteValue() 鏂规硶
protected boolean deleteValue(string $key)
$key string 瑕佸垹闄ゅ肩殑閿悕
{return} boolean 濡傛灉鍒犻櫎鏈熼棿娌℃湁鍙戠敓閿欒
婧愮爜锛 framework/caching/CZendDataCache.php#84 (鏄剧ず)
protected function deleteValue($key)
{
    return 
zend_shm_cache_delete($key);
}

浠庣紦瀛樹腑鍒犻櫎鎸囧畾閿悕瀵瑰簲鐨勫 杩欐槸鍦ㄧ埗绫讳腑瀹氫箟鐨勬柟娉曠殑鍏蜂綋瀹炵幇銆

flushValues() 鏂规硶 锛堝彲鐢ㄨ嚜 v1.1.5锛
protected boolean flushValues()
{return} boolean 濡傛灉娓呯┖鎿嶄綔鎴愬姛鎵ц銆
婧愮爜锛 framework/caching/CZendDataCache.php#95 (鏄剧ず)
protected function flushValues()
{
    return 
zend_shm_cache_clear();
}

鍒犻櫎鎵鏈夌紦瀛樺笺 杩欐槸鍦ㄧ埗绫讳腑瀹氫箟鐨勬柟娉曠殑鍏蜂綋瀹炵幇銆

getValue() 鏂规硶
protected string getValue(string $key)
$key string 鐢ㄤ互鐢勫埆缂撳瓨鍊肩殑鍞竴閿悕
{return} string 缂撳瓨涓瓨鍌ㄧ殑鍊硷紝濡傛灉璇ュ间笉瀛樺湪鎴栬呭凡杩囨湡鍒欒繑鍥瀎alse銆
婧愮爜锛 framework/caching/CZendDataCache.php#44 (鏄剧ず)
protected function getValue($key)
{
    
$result zend_shm_cache_fetch($key);
    return 
$result !== NULL $result false;
}

浠庣紦瀛樹腑妫绱竴涓尮閰嶆寚瀹氶敭鍚嶇殑鍊笺 杩欐槸鍦ㄧ埗绫讳腑瀹氫箟鐨勬柟娉曠殑鍏蜂綋瀹炵幇銆

init() 鏂规硶
public void init()
婧愮爜锛 framework/caching/CZendDataCache.php#31 (鏄剧ず)
public function init()
{
    
parent::init();
    if(!
function_exists('zend_shm_cache_store'))
        throw new 
CException(Yii::t('yii','CZendDataCache requires PHP Zend Data Cache extension to be loaded.'));
}

鍒濆鍖栧簲鐢ㄧ▼搴忕粍浠躲 璇ユ柟娉曞湪鎺ュ彛IApplicationComponent涓湁瑕佹眰銆 瀹冩鏌end Data Cache鏄惁鍙敤銆侷t checks the availability of Zend Data Cache.

setValue() 鏂规硶
protected boolean setValue(string $key, string $value, integer $expire)
$key string 鐢ㄤ互鐢勫埆缂撳瓨鍊肩殑閿悕
$value string 瑕佺紦瀛樼殑鍊
$expire integer 浠ョ涓哄崟浣嶇殑鏁板硷紝琛ㄧず缂撳瓨鐨勮繃鏈熸椂闂淬備负0鍒欐案涓嶈繃鏈熴
{return} boolean 鎴愬姛瀛樺偍鍒扮紦瀛樹腑鍒欒繑鍥瀟rue锛屽惁鍒欒繑鍥瀎alse
婧愮爜锛 framework/caching/CZendDataCache.php#59 (鏄剧ず)
protected function setValue($key,$value,$expire)
{
    return 
zend_shm_cache_store($key,$value,$expire);
}

寰缂撳瓨涓瓨鍌ㄤ竴涓敤閿悕鍖哄垎鐨勫笺 杩欐槸鍦ㄧ埗绫讳腑瀹氫箟鐨勬柟娉曠殑鍏蜂綋瀹炵幇銆

Copyright © 2008-2011 by Yii Software LLC
All Rights Reserved.