ThinkPHP中的動態(tài)緩存(S步驟)和快速緩存(F方法)
Jun 13, 2016 pm 12:26 PM
ThinkPHP中的動態(tài)緩存(S方法)和快速緩存(F方法)
系統(tǒng)默認的緩存方式是采用File方式緩存,我們可以在項目配置文件里面定義其他的緩存方式,例如,修改默認的緩存方式為Xcache(當然,你的環(huán)境需要支持Xcache)
????對于File方式緩存下的緩存目錄下面因為緩存數(shù)據(jù)過多而導致存在大量的文件問題,ThinkPHP也給出了解決方案,可以啟用哈希子目錄緩存的方式。
????'DATA_CACHE_SUBDIR'=>true???
????還可以設置哈希目錄的層次,例如
????'DATA_PATH_LEVEL'=>2??
????就可以根據(jù)緩存標識的哈希自動創(chuàng)建多層子目錄來緩存。
????S方法支持緩存有效期,在很多情況下,可能我們并不需要有效期的概念,或者使用文件方式的緩存就能夠滿足要求,所以系統(tǒng)還提供了一個專門用于文件方式的快速緩存方法F方法。F方法只能用于緩存簡單數(shù)據(jù)類型,不支持有效期和緩存對象,使用如下:
???
????//快速緩存Data數(shù)據(jù),默認保存在DATA_PATH目錄下面????
??????F('data',$data);
????//快速緩存Data數(shù)據(jù),保存到指定的目錄???
??????F('data',$data,TEMP_PATH);
??????F('user/data',$data);
????//刪除緩存數(shù)據(jù)
??????F('data',null);
????//獲取緩存數(shù)據(jù)
??????$data=F('data');????????
配置文件config.php
//動態(tài)緩存,緩存文件存在于\Runtime\Temp
'DATA_CACHE_TYPE'=>'file',
'DATA_CACHE_TIME'=>'3600',
//'DATA_CACHE_SUBDIR'=>true,//開啟子目錄
//'DATA_CACHE_LEVEL'=>3,//設置子目錄的層次
Action文件:
????function view(){
????????//緩存
????????//$cache=Cache::getInstance('緩存方式','緩存參數(shù)');
????????//$cache=Cache::getInstance('Xcache',array('expire'=>60));
????????//$cache->set('名字','值');或者$cache->name='值';
????????//$value=$cache->get('名字');或者$value=$cache->name;
????????//$cache->rm('名字');或者unset($cache->name);
???????
????????//S('名字','數(shù)據(jù)','3600','類型')緩存快捷方法
?????????
????????$user=M('haodetong');
???????
????????$value=S('list');
????????if(empty($value)){
????????????$list=$user->select();
???????????
????????????S('list',$list,3600);
????????????echo '這個是直接從數(shù)據(jù)庫中讀取的文件';???
????????????dump($list);
????????}else{
????????????echo '這個是緩存文件';
????????????dump($value);
????????}
??????
????}
第一次訪問時如下圖:
再次刷新后如下圖:

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

Windows 11? ???? ??? ???? ??? ??????. ???? ?????? ?? ? ???? ?? ??? ?? ??? ????? ??? ? ????. ? ?????? Windows ?? ???? ??? ???? ???? ??? ??? ? ??? ?? ??? ??? ?????. ? ??? ??? ???? ??? ?????? +? ?? ?? ?? ???. Windows?? ???? ???? ?? ??? ?????. ?? ?? ? ??? ?? ? 11" Width="643" Height="500" > ?? ??? ? ? ???? ?? ?? ?? ??? ?? ?? ?? ???? ?????. ?? ?? ? ?? ???? ?? ??? ????? ?? ??? ?? ???? ?? ??? ????? ?? ??? ?? ???? ?? ??? ???.

??? ??? "??? ???? PIN ??? ?????"?? ???? ?????. ?? ?? ??? ??? ? ?? ?? ?? ?? ??? ???? ????? PIN ?? ??? ??? ?? ?????. ??? ?? ??? ???? Windows? ???? ?? ?????? ?? ???? ???? ????. ?? ?? ?? ????. ??? ??? ???? ???? ?? ??? ???? ?????. ???? Windows 11?? PIN? ????? ???? ??? ?????? ??? ??? ??? ???? ?? ? ???? ?? ???? ?? ?? ?? ?????. ??? ????? ???? ??? ? ? ????! ?? ?? ??? ?? ?? ???? ??? ????? ?? ?? ??? ??? ? ????. ?? ??

????? Windows 11? ?? ??? ??? ??? ???/?? ??? ?? ????. ??? ??? ???? ??? ? ????. ? ?????? ?? ???? ???? ??? ????? ????? ????? ??? ? ?? ??? ?? ??? ??? ?????. ?? ?? ??? ?? ?? ??? ??? ??? ? ????? ?, ?? ?? ???? ?? ?? ?? ??? ??? ????? ????? ???? ???? ??? ?? ?? ??? ??? ??? ? ????. ??? ??? ????? ?? ???? ?????. Windows 11?? ?? ??? ??? ???? ??? ?????? 1. ?? ?? ???? +? ?? ?? ?? ???. Windows"?? ??"?? ??? ??

?? ??? ???? ???? ?? ??? ??? ???? ??? ???? ? ?? ????. ? ?? ?? ??? ?? ???? ????? ???? ??? ??? ?? ? ? ??? ?? ????. ? ?? ??? ? ?? ??? ???? ????? ????. ??? ??? ???? ?? ? ?? ??? ?? ??? ?????? ??? ????????. ??? ???? ??? ?? ??? ? ?? ?? ??? ??? ?? ???? ? ????. Windows 11?? ?? ??? ??? ?? ??? ????? ??? ?????? 1. ?? ?? ???? ?? ??? ??? ?????. Windows??? ???? ???? ??? ?????. ?? ??? ??? ?????. ?? ??? ???? ?? ???? ??? ?????. "?? ??"? ?????.

Windows Installer ???? "OOBELANGUAGE" ?? ?? "??? ??????."? ?????? ??? ??? ?? Windows ??? ???? ??? ????. OOBE? ?? ?? ??? ??? ?????. ?? ????? ? ? ??? ?? OOBE ?? ??? ??? ?????. ??? ??? ????. OOBE ?? ???? ?????? ???? ? ??? ??? ? ????. ?? ?? – 1. OOBE ? ??? ?? “?? ??” ??? ?????. ??? ? ??? ?? ?? ????? ?????. 2. ?? ??? ???? ???? ?? ?????. ???? ?? ??? ? OOBE? ????? ???. 3. ????? ??? ??? ????. ???? ???? OOBE? ?? ??? ?????.

?? ??? ?? ??? ??? ??? ? ???? ????, ?? ??? ??? ? ? ?? ?????. ?? ??? ???, ???? ???, ???? ?? ????? ?? ? ??? ???. ??? ??? ?? ?? ??? ??? ? ???, ?? ??? UI ??? ??? Windows 11??? ?? ?????. ??? ???? ? ??? ?? ?? Windows 11?? ??? ???? ?? ??? ??? ????. Windows 11?? ??? ???? ?? [10?? ??] ?? ??? ???? ?? ??? ???? Windows 11?? ??? ??? ? ????. ???? ?? ???? ???? ???? ???? ???? ?????. ????. ?? 1: ?? ?? ?? ?? ??? ???? ? ????.

Windows 11? ????? ?? ??? ???? ?? ??? ?? ?? ???? ??? ????. ? ???? ???? ??? ??, ?? ???? ???? ??? ????. ??? ??? ?? ??? ????? ??? ??? ?????. ??? ?? ?? ???? ???? ??? ?? ??? ?? ? ???? ???? ? ???? ??? ??? ??? ????? ?? ??? ???? ??? ??? ???. Custom Zoom? ??: ??? ???? ?? ??? ????? ??? ?????. ? ?? ???? ? ?? ?? ? ? ??? ?????. ?? ??? ? ?? ?????? ???? ??? ?? ?? ???? ??? ? ????. ??? ????? ??? ????? ? ??? ? ? ????. ?? ?? ??? ??? ? ????? ??? ? ????. ??? 11? ???? ??

Windows? ?? ?? ?????? ??? ? ?? ?? 0xc004f069? ??? ?? ???? ???? ??? ????. ??? ????? ????? ?????? Windows Server? ???? ?? ?? ????? ? ??? ??? ? ????. ??? ?? ??? ???? ??? ???? ??? ?? ??? ?? ?? ???? ???? ??? ??????. ?? ?? - ?? ???? ??? ?? ????. ?? ?? ???? ?? ??????. Windows ?? ?? ????? ???? ?? ?????. ?? 1 – ????? ??? cmd ????? Windows Server Edition ???? ??????. 1?? – Windows Server ?? ?? ?? ???? ?? W ??? ???? ???.
