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

Gcorelabs:美国GPU服务器,8路RTX2080Ti;2*Silver-4214/256G内存/1T SSD,1815欧/月

gcorelabs怎么样?gcorelabs是创建于2011年的俄罗斯一家IDC服务商,Gcorelabs提供优质的托管服务和VPS主机服务,Gcorelabs有一支强大的技术队伍,对主机的性能和稳定性要求非常高。Gcorelabs在 2017年收购了SkyparkCDN并提供全球CDN服务,目标是进入全球前五的网络服务商。G-Core Labs总部位于卢森堡,在莫斯科,明斯克和彼尔姆设有办事处。...

数脉科技8月促销,新客减400港币,BGP、CN2+BGP、阿里云线路低至350元

数脉科技(shuhost)8月促销:香港独立服务器,自营BGP、CN2+BGP、阿里云线路,新客立减400港币/月,老用户按照优惠码减免!香港服务器带宽可选10Mbps、30Mbps、50Mbps、100Mbps带宽,支持中文本Windows、Linux等系统。官方网站:https://www.shuhost.com* 更大带宽可在选购时选择同样享受优惠。* 目前仅提供HKBGP、阿里云产品,香港...

PIGYun月付14.4元起,美国洛杉矶/韩国VPS七月6折

PIGYun是成立于2019年的国人商家,提供香港、韩国和美西CUVIP-9929等机房线路基于KVM架构的VPS主机,本月商家针对韩国首尔、美国洛杉矶CUVIP-AS29、GIA回程带防御等多条线路VPS提供6-8.5折优惠码,优惠后韩国首尔CN2混合BGP特惠型/美国洛杉矶GIA回程带10Gbps攻击防御VPS主机最低每月14.4元起。下面列出几款不同机房VPS主机配置信息,请留意不同优惠码。...

eaccelerator为你推荐
投资者适当性客户端系统国家标准苹果5ipad如何上网ipad如何允许app使用网络ipadwifiIpad怎么用移动无线上网itunes备份itunes就是备份不了怎么办啊联通iphone4联通iphone4跟苹果的iphone4有什么不一样? 比如少了什么功能? 还是什么的?联通iphone4北京 朝阳区 哪家联通店可以卖Iphone4的,本周周末过去买csshack什么是Css Hack?ie6,7,8的hack分别是什么micromediawww.macromedia.com 是什么网站googleadsensegoogle adsense 和google adwords有什么区别?适合什么样的人群?
域名交易 服务器租用托管 vps租用 edgecast 搬瓦工官网 海外服务器 建站代码 网站被封 全站静态化 刀片服务器是什么 双线主机 服务器合租 东莞服务器 网站在线扫描 域名与空间 shuang12 监控服务器 什么是web服务器 帽子云排名 可外链的相册 更多