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.
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);
}
寰缂撳瓨涓瓨鍌ㄤ竴涓敤閿悕鍖哄垎鐨勫笺 杩欐槸鍦ㄧ埗绫讳腑瀹氫箟鐨勬柟娉曠殑鍏蜂綋瀹炵幇銆