缓存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

无忧云:洛阳/大连BGP云服务器38.4元/月,雅安物理机服务器315元/月起,香港荃湾CN2限时5折优惠

无忧云怎么样?无忧云是一家成立于2017年的老牌商家旗下的服务器销售品牌,现由深圳市云上无忧网络科技有限公司运营,是正规持证IDC/ISP/IRCS商家,主要销售国内、中国香港、国外服务器产品,线路有腾讯云国外线路、自营香港CN2线路等,都是中国大陆直连线路,非常适合免备案建站业务需求和各种负载较高的项目,同时国内服务器也有多个BGP以及高防节点,目前商家开启了夏日清凉补贴活动,商家的机器还是非常...

webhosting24:€28/年,日本NVMe3900X+Webvps

webhosting24决定从7月1日开始对日本机房的VPS进行NVMe和流量大升级,几乎是翻倍了硬盘和流量,当然前提是价格依旧不变。目前来看,国内过去走的是NTT直连,服务器托管机房应该是CDN77*(也就是datapacket.com),加上高性能平台(AMD Ryzen 9 3900X+NVMe),这样的日本VPS还是有相当大的性价比的。官方网站:https://www.webhosting...

BeerVM1GB内存/VDSps端口1GB,350元/月

beervm是一家国人商家,主要提供国内KVM VPS,有河南移动、广州移动等。现在预售湖南长沙联通vds,性价比高。湖南长沙vps(长沙vds),1GB内存/7GB SSD空间/10TB流量/1Gbps端口/独立IP/KVM,350元/月,有需要的可以关注一下。Beervm长沙联通vps套餐:长沙联通1G青春版(预售)长沙联通3G标准版(预售)长沙联通3G(预售)vCPU:1vCPU:2vCPU...

eaccelerator为你推荐
我的"点绛唇"支持ipad重庆网通重庆联通现在有哪些资费???ipad上网为什么我的ipad 显示无法连接到网络迅雷快鸟迅雷快鸟支持移动宽带提速吗micromediaMacromedia翻译成中文是什么?迅雷下载速度为什么 迅雷下载速度太慢联通合约机iphone5想咨询一下联通iphone5合约机和裸机的区别?苹果5.1.1完美越狱ios5.1.1越狱后 好用的cydia软件源morphvoxpro怎么用如何使用MorphVOX Pro变声
域名空间 云南虚拟主机 电信服务器租赁 国外免费域名网站 hawkhost sockscap 网站监控 京东云擎 云主机51web 申请个人网页 国外网站代理服务器 100m空间 最好的免费空间 idc是什么 789电视剧 免费私人服务器 丽萨 英雄联盟台服官网 全能空间 云服务器比较 更多