缓存phpcms缓存使用总结(memcached、eaccelerator、shm)

eaccelerator  时间:2021-04-17  阅读:()

phpcms缓存使用总结(memcached、 eaccelerator、 shm)A template compilation cache

Reference documents include/globalfuncphp andinclude/templatefuncphp

The principle of template cache is simple if the template isfirst compiled directly compile it, if not the first is tocompile the template file ($tplfile) and template cache file($compiledtplfile) modify time if the template cache filemodification time is greater than the compiled template fileis compiled template or not compile the template to improve theprogram' s execution efficiency

Copy code

The code reads as follows:

Function template ($module = phpcms, $template = index){

G lobal $CONFI G;

$compiledtplf ile =

$CONFIG[templatescachedir]$module_$templatetplphp;

If ($CONFIG[templaterefresh] )

{

$tplfile =

PHPCMS_ROOT/t emp lat es/$CONFIG[defaul ttempl ate]/$module/$t emplatehtml;

If ( ! File_exists ($compiledtplfile) | | @filemtime

($tplfile) > @filemtime ($compiledtplfile) )

{

Require_once PHPCMS_ROOT/inc lude/templatefuncphp;

Template_refresh ($tplfile, $compiledtplfile) ;

}

}

Return $compiledtplfile;

}

B generates static cache files within a dynamic page

Similar to the caching principle of C, the name of the filegenerated here is relatively fixed

Take the question module as an example

For access

This directory contains indexphp files in the current directory

to determine whether there is a file called index_cachehtml if

there is no failure period directly to include this file orPrivate Const SMART_Iwww.qushu6.comNVALID_BUFFER As dynamicLong =4 "Bad buffer (null invalid addr. . ) read after the datasaved as index_cachehtml file for the next use.

What is in the file indexphp?

Copy code

The code reads as follows:

"PHP?

Require_once /include/commonincphp;

$lastedittime = @filemtime (index_cachehtml) ;

$lastedittime = $PHP_TIME$lastedittime;

$autoupdatetime = intval ($MOD[autoupdate] ) ;

//$MOD[autoupdate] comes from the contents of the cache filedata/cache/wenba_settingphp

If (file_exists (index_cachehtml) & &

$lastedittime<$autoupdatetime)

{

Echo "include cache file"";

Include index_cachehtml;

}

Else

{

Echo "read dynamic page"";

>?

How to determine whether the file is invalid, filedata/cache/wenba_settingphp has the following settings, inwhichthe value of the fieldAutoUpdate is the file failure time,unit is seconds, in the background can be set

The file wenba_settingphp is going to come from it are installedautomatically when the various modules of the data saved to thedatabase installation generated when the cache data in theinclude/commonincphp cache_all function can also generatebackground cache settings when cache will be automaticallyupdated

Copy code

The code reads as follows:

"PHP?

Return array (. . .

Higth_score = >

Anybody_score = >

Answer_give_credit = >

Vote_give_credit = >

Highscore = >

Vote_give_actor</p> <p> </p>=>white-collar workers <p> </p><p> won the imperial wizard generals </p> <p> vagabondAutoUpdate = >

Name = > a s k.

Moduledir = > Wenba

Moduledomain = >

Linkurl = > /opensource/phpcms_sp_gbk/phpcms/wenba/

) ;

>?

Include/globalfuncphp

Update module settings function

Copy code

The code reads as follows:

Function module_setting ($module $setting)

{

G l ob al $db$MODULE$LANG;

If ( ! Is_array ($setting) | | ! Array_key_exists

($modul e$MODULE) ) return FALSE;

If (isset ($setting[moduledomainPrivate, Const,

MAX_IDE_DR IVESwww.mnmm8.c omAs, Long=, Max, number, of, driv es,assuming, primary/secondary, master/slave, topology])){

$moduledomain = $setting[moduledomain] ;

$db>que ry ("UPDATE", "TAB LE_MOD ULE", "S ET,moduledomain=$modul edomai n, WHERE, module=$modul e") ;

Unset ($setting[moduledomain]) ;

}

$setting = addslashes (serialize (new_stripslashes

($setting) )) ;

Will / more than one set of values for a module. After arrayserialization is stored in a field in setting

$db>que ry ("UPDATE", "TABLE_MODULE", "S ET, s et t i n g=$s et t i n g,WHERE, modul e=$modu l e") ;

Cache_module ($module) ;

Cache_common () ;

Return TRUE;

}

C generates static cache files within a dynamic page

With the principle of B is similar to the cache file name isgenerated according to the calculated $PHP_SELF and

$PHP_QUERYSTRING value of MD generated file name relative toall PHP dynamic pages are the same thought classic comparisonshould be signed by

Take the question module as an example

The file call order is indexphp> jsphp >adphp> globalfuncphpFor access

This directory contains indexphp files in the current directoryto determine whether there is a file called index_cachehtml

directly if this file is included if it doesnot exist this fileare dynamically read after the data stored in theindex_cachehtml file for the next use.

When accessing the above URL, the page contains the followingline of JS code

<script language=, "JavaScript",

"/opensource/phpcms_sp_gbk/phpcms/data/jsphp", "id=",src=, ></script>

This JS code is actually a dynamic call to the content of thePHP page

The contents of the jsphp file:

Copy code

The code reads as follows:

"PHP?

Chdir (/ads/) ;

Require /adphp;

>?

Adphp content

Copy code

The code reads as follows:

"PHP?

D ef i ne (SHOWJS) ;

Require /include/commonincphp;

Require MOD_ROOT/include/globalfuncphp; </p> <p>$placeid =i ntval ($i d) ; </p> <p>$qu ery = "SELECT * FROM" TABLE_ADS "ASa LEFT"JOIN"TABLE_ADS_PLACE AS P ON(aplaceid=pplaceid) WHEREaplacei d=" $p laceid "AND afromdate<=UNIX_TIMESTAMP (AND)atodate>=UNIX_TIMESTAMP (AND) ppassed= AND apassed= ANDachecked= ORDER BY aaddtime";

$ads = $db>ge t_one ($query "CAHCE") ;

I f ( ($ads) ex it (documentwri te (")") ; </p>, <p>$db>query("UPDATE", "SET, views=views+, WHERE, adsid=", $ads[ads id] ) ;</p> <p>$content = ads_content ($ads) (TABLE_ADS) ;

$templateid = $ads[templateid]? $ads[templateid] : ads;Include template (ads $templateid) ;

Phpcache () ;

>?

Adphp which calls the phpcache function reference file

创梦网络-四川大带宽、镇江电信服务器云服务器低至56元

达州创梦网络怎么样,达州创梦网络公司位于四川省达州市,属于四川本地企业,资质齐全,IDC/ISP均有,从创梦网络这边租的服务器均可以备案,属于一手资源,高防机柜、大带宽、高防IP业务,一手整C IP段,四川电信,一手四川托管服务商,成都优化线路,机柜租用、服务器云服务器租用,适合建站做游戏,不须要在套CDN,全国访问快,直连省骨干,大网封UDP,无视UDP攻击,机房集群高达1.2TB,单机可提供1...

青云互联:洛杉矶CN2弹性云限时七折,Cera机房三网CN2gia回程,13.3元/月起

青云互联怎么样?青云互联是一家成立于2020年6月份的主机服务商,致力于为用户提供高性价比稳定快速的主机托管服务,目前提供有美国免费主机、香港主机、香港服务器、美国云服务器,让您的网站高速、稳定运行。目前,美国洛杉矶cn2弹性云限时七折,美国cera机房三网CN2gia回程 13.3元/月起,可选Windows/可自定义配置。点击进入:青云互联官网青云互联优惠码:七折优惠码:dVRKp2tP (续...

水墨云历史黑名单IDC,斟酌选购

水墨云怎么样?本站黑名单idc,有被删除账号风险,建议转出及数据备份!水墨云ink cloud Service是成立于2017年的商家,自2020起开始从事香港、日本、韩国、美国等地区CN2 GIA线路的虚拟服务器租赁,同时还有台湾、国内nat vps相关业务,也有iplc专线产品,相对来说主打的是大带宽服务器产品。注意:本站黑名单IDC,有被删除账号风险,请尽量避免,如果已经购买建议转出及数据备...

eaccelerator为你推荐
深圳市富满电子集团股份有限公司程序微信5图书馆学、情报学期刊投稿指南eacceleratorCentOS5.2下安装eAccelerator,怎么都装不上tracerouteTRACEROUTE的作用是什么x-routerx-arcsinx的等价无穷小是什么?ipad无法加入网络为什么ipad无法加入网络?fastreport2.5现在化工中,法兰中pn2.5是什么意思chrome18怎么关闭chrome的自动更新,稳定版要18了,mactype要悲剧了卡巴斯基好用吗卡巴斯基好吗?
香港vps vps是什么意思 vps安全设置 网站域名备案 赵容 便宜服务器 主机 息壤备案 国外idc webhostingpad 视频存储服务器 la域名 payoneer godaddy域名转出 网盘申请 免费个人网站申请 cpanel空间 免空 双拼域名 电信虚拟主机 更多