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

Sparkedhost($8/月)美国迈阿密AMD Ryzen高性能VPS;免费100G高防

sparkedhost怎么样?sparkedhost主机。Sparkedhost于2017年7月注册在美国康涅狄格州,2018年收购了ClynexHost,2019年8月从Taltum Solutions SL收购了The Beast Hosting,同年10月从Reilly Bauer收购了OptNode Hosting。sparkedhost当前的业务主要为:为游戏“我的世界”提供服务器、虚拟...

SugarHosts糖果主机六折 云服务器五折

也有在上个月介绍到糖果主机商12周年的促销活动,我有看到不少的朋友还是选择他们家的香港虚拟主机和美国虚拟主机比较多,同时有一个网友有联系到推荐入门的个人网站主机,最后建议他选择糖果主机的迷你主机方案,适合单个站点的。这次商家又推出所谓的秋季活动促销,这里一并整理看看这个服务商在秋季活动中有哪些值得选择的主机方案,比如虚拟主机最低可以享受六折,云服务器可以享受五折优惠。 官网地址:糖果主机秋季活动促...

hostkey俄罗斯、荷兰GPU显卡服务器/免费Windows Server

Hostkey.com成立于2007年的荷兰公司,主要运营服务器出租与托管,其次是VPS、域名、域名证书,各种软件授权等。hostkey当前运作荷兰阿姆斯特丹、俄罗斯莫斯科、美国纽约等数据中心。支持Paypal,信用卡,Webmoney,以及支付宝等付款方式。禁止VPN,代理,Tor,网络诈骗,儿童色情,Spam,网络扫描,俄罗斯色情,俄罗斯电影,俄罗斯MP3,俄罗斯Trackers,以及俄罗斯法...

eaccelerator为你推荐
学生微信5aplicaiosformgraphspeakingphp支持ipad支持ipadeacceleratoreaccelerator.shm_size设置多少合适呢?windows键是哪个Windows键是哪个键啊?勒索病毒win7补丁我的电脑是windows7系统,为什么打不了针对勒索病毒的补丁(杀毒软件显xp关闭445端口Windows XP系统 关闭445端口后无法上网,求解?
二级域名 网游服务器租用 域名主机基地 免费二级域名申请 ipage 秒解服务器 php探针 qq数据库下载 hinet 双十一秒杀 nerds 阿里校园 metalink 33456 空间购买 阿里云官方网站 沈阳主机托管 smtp服务器地址 网站加速 阿里云邮箱申请 更多