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

Virmach($5.23/年)年付VPS闪购

每每进入第四季度,我们就可以看到各大云服务商的促销力度是一年中最大的。一来是年底的促销节日活动比较多,二来是商家希望最后一个季度冲刺业绩。这不还没有到第四季度,我们看到有些商家已经蠢蠢欲动的开始筹备活动。比如素有低价VPS收割机之称的Virmach商家居然还没有到黑色星期五就有发布黑五促销活动。Virmach 商家有十多个数据中心,价格是便宜的,但是机器稳定性和速度肯定我们也是有数的,要不这么低的...

久久网云-目前最便宜的国内,香港,美国,日本VPS云服务器19.9元/月起,三网CN2,2天内不满意可以更换其他机房机器,IP免费更换!。

久久网云怎么样?久久网云好不好?久久网云是一家成立于2017年的主机服务商,致力于为用户提供高性价比稳定快速的主机托管服务,久久网云目前提供有美国免费主机、香港主机、韩国服务器、香港服务器、美国云服务器,香港荃湾CN2弹性云服务器。专注为个人开发者用户,中小型,大型企业用户提供一站式核心网络云端服务部署,促使用户云端部署化简为零,轻松快捷运用云计算!多年云计算领域服务经验,遍布亚太地区的海量节点为...

Megalayer美国独立服务器新用户首月优惠350元(30M优化不限流量)

Megalayer 商家在开始看到有提供香港服务器、香港站群服务器的时候有介绍过,后来就一直没有怎么关注。但是前几天有看到网友使用到他们家的美国独立服务器问其如何的,但是我没有使用过就不好评论,这不前几天也有介绍到Megalayer美国独立服务器。以及我们也有看到商家有提供美国站群服务器和美国大带宽服务器产品,可选30M不限制流量CN2优化线路,以及100M不限制流量国际带宽线路。新年元旦后,Me...

eaccelerator为你推荐
圆周刊社区责任编辑:支持ipad支持ipadDescriptionios5Deviceios5photoshop技术photoshop技术对哪些工作有用?win10445端口win的22端口和23端口作用分别是什么 ?tcpip上的netbiostcp 协议里的 netbios . 在哪,找不到win7如何关闭445端口如何关闭445端口,禁用smb协议联通iphone4联通iphone4跟苹果的iphone4有什么不一样? 比如少了什么功能? 还是什么的?
过期域名抢注 5折 163网 tightvnc 亚洲小于500m 湖南服务器托管 腾讯云分析 炎黄盛世 帽子云 howfile 183是联通还是移动 东莞服务器 根服务器 河南移动梦网 net空间 深圳主机托管 香港ip windowssever2008 cpu使用率过高怎么办 远程登录 更多