logo
Apache Lounge
Webmasters

 


About

Forum Index Downloads Search Register Log in  RSS Apache Lounge
 



Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Apache Lounge is not sponsored.

Your donations will help to keep this site alive and well, and continuing building binaries.



Wincache reroute.ini and PHPBB2

 
Post new topic   Reply to topic    Apache Forum Index -> Coding & Scripting Corner



View previous topic :: View next topic  
Author Message
Kanashii



Joined: 17 Jul 2006
Posts: 155
Location: Porando

PostPosted: Sat 30 Jul '11 18:08    Post subject: Wincache reroute.ini and PHPBB2 Reply with quote

For me important is that to disable to minimum I/O, i use for one of my project template engine from PHPBB

http://php.net/manual/en/wincache.reroutes.php

Quote:


/**
* Sets the template root directory for this Template object.
*/
function set_rootdir($dir)
{
if (!wincache_is_dir($dir))
{
return false;
}

$this->root = $dir;
return true;
}

____

function get_ucache_file($file) {


$co = $file;

if ( wincache_ucache_exists($co) ) :
return wincache_ucache_get($co, $ret);
else :
$ret = wincache_file_get_contents($file);
wincache_ucache_set($co, $ret);
return $ret;
endif;
}




_____


/**
* If not already done, load the file for the given handle and populate
* the uncompiled_code[] hash with its code. Do not compile.
*/
function loadfile($handle) {

.....

$filename = $this->files[$handle];


#OLD# FILE file read
#$str = implode("", @file($filename));

#NEW# winache file_read_form_cache
@ob_start();
$str = $this->get_ucache_file($filename);

if (empty($str))
{
die("Template->loadfile(): File $filename for handle $handle is empty");
}

....




reroute.ini
Quote:

file_exists=wincache_file_exists
file_get_contents:2=wincache_file_get_contents
readfile:2=wincache_readfile
is_readable=wincache_is_readable
is_writable=wincache_is_writable
is_writeable=wincache_is_writable
is_file=wincache_is_file
is_dir=wincache_is_dir
realpath=wincache_realpath


____
Cache uptime 3 hours 24 minutes 3 seconds

Cached files 195
Hits 7549
WinCache version 1.2.1010.0


[Resolve Path Cache Overview]

Cached entries 657
Total memory 9 MB
Available memory 8.86 MB
Memory overhead 10.33 kB
_________

@@@@@@@@@@@@
Im not use Wincache Session becasue when you kill Php-cgi.exe all cache is gone.
http://splinedancer.com/memcached-win32/

@@@@@@@@


PHP session handler memcache


extension=php_wincache.dll

wincache.fcenabled = 1
wincache.enablecli = 0
wincache.fcachesize = 5
wincache.fcndetect = 0
;file modify detection function
wincache.chkinterval = 0
wincache.ocachesize = 50

wincache.ucachesize = 15

wincache.ocenabled = 1
wincache.ucenabled = 1
wincache.namesalt = asd
wincache.ttlmax = 0
wincache.rerouteini = "reroute.ini"

wincache.maxfilesize = 2048


Last edited by Kanashii on Sat 03 Nov '12 10:55; edited 3 times in total
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 2580
Location: Hilversum, NL, EU

PostPosted: Sat 30 Jul '11 19:25    Post subject: Reply with quote

I am not that familar with the template engine.

Found that I had put the php code in template.php

Thanks,

Steffen
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 2580
Location: Hilversum, NL, EU

PostPosted: Sat 30 Jul '11 20:28    Post subject: Reply with quote

Must I replace all the lines in the function set_rootdir($dir) with:

function set_rootdir($dir)
{
if (!wincache_is_dir($dir))
{
return false;
}

Steffen
Back to top
Kanashii



Joined: 17 Jul 2006
Posts: 155
Location: Porando

PostPosted: Sat 30 Jul '11 21:06    Post subject: Reply with quote

Only replace functin


is_dir

wincache_is_dir

you can modyfi fuction that save to cache eq remove white spaces with eq tindy mod for php

function to compress remove white spaces


function compre($buffer) {

$buffer = preg_replace('/\s+/', ' ', $buffer);
#$buffer = str_replace(array('> <'),array('><'), $buffer);
$buffer = str_replace(array("\t","\x0B","\r\n"),'', $buffer);


$buffer = @ereg_replace("//[\x20-\x7E]*\n", '', $buffer);
$buffer = @ereg_replace("#[\x20-\x7E]*\n", '', $buffer);
$buffer = @ereg_replace("\t|\n", '', $buffer);

return $buffer;
}
Back to top


Post new topic   Reply to topic    Apache Forum Index -> Coding & Scripting Corner
Page 1 of 1