Vindozo mods: Cache site - turbo speed

Various mods to change or add features.

Vindozo mods: Cache site - turbo speed

Postby VINDOZO » 2008-02-23 11:48 pm

This of mod increases productivity of system in a hundred times,
allowing to receive more than million visitors in day on a site

Show footer:
Script Execution Time: 0.14432 | SQL Queries: 9 | Members: 1
Cache: on | Time: 0.00239 | File age: 0 sec, limit 10 sec | Files: 1 | Unlinked: 0


1. create catalog "cache" CMOD 755
2. add in index.php

after:
Code: Select all
// Require some classes and start the timer
require_once("{$CONF['path']}/sources/misc/classes.php");
$TIMER = new timer;

insert:

Code: Select all
// Cache
$TIMERCACHE = new timer;

$CONF['cache'] = 1;
$CACHESEC=10;

$pagecache='./cache/wrapper';  $cacheunlink=0;
foreach ($_GET as $check_url) {$pagecache.=$check_url;};
foreach ($_POST as $check_url) {$pagecache.=$check_url;};
foreach ($_COOKIE as $check_url) {$pagecache.=$check_url;};
$pagecache='./cache/wrapper'.abs(crc32($pagecache)).'.html';
$timem ='0';
if(file_exists($pagecache) && $CONF['cache']==1) {
    $timem=time()-filemtime($pagecache);
    if ($timem>$CACHESEC) {@unlink($pagecache);$cacheunlink++;};
};

if( !file_exists($pagecache) || $CONF['cache']==0)
{


after
Code: Select all
// Display the page
$skin = new main_skin('wrapper');

replace all down on:
Code: Select all
$content = $skin->make();
$DB->close();

} else {
    $fh = fopen($pagecache, 'r');
    $content = @fread($fh, filesize($pagecache));
    fclose($fh);
    if( $content === FALSE ){exit("Error: Could not display requested page cache");};
};
if ($CONF['cache']) {
$cacheinfo='Cache: on';

if( !file_exists($pagecache)){
    $fh = fopen($pagecache, 'w');
    flock($fh, LOCK_EX);
    fwrite($fh, $content);
    flock($fh, LOCK_UN);
    fclose($fh);
}
// Clear old cache files
$dir=opendir('./cache'); $cachefiles=0;
while (($file=readdir($dir))) {
 $file='./cache/'.$file;
 if(is_file($file)){ $cachefiles++;
  if ((time()-filemtime($file))>$CACHESEC) {@unlink($file);$cacheunlink++;};
 }
}

$cacheinfo.=' | Time: '.$TIMERCACHE->get_time();
$cacheinfo.=' | File age: '.$timem.' sec, limit '.$CACHESEC.' sec';
$cacheinfo.=' | Files: '.$cachefiles;
$cacheinfo.=' | Unlinked: '.$cacheunlink;
$content=str_replace('{$cache_off}',$cacheinfo,$content);
}

echo $content;

// Print out debugging info, if necessary
if ($CONF['debug']&&!$CONF['cache']) {
  echo '<div style="clear: both;">';
  foreach ($DB->queries as $value) {
    echo "<hr /><pre>{$value}</pre>";
  }
  echo '<hr /><pre>';
  print_r($_REQUEST);
  echo '</pre>';
  echo '<hr /><pre>';
  echo htmlspecialchars($content);
  echo '</div>';
}
?>


3. add in skins/../wrapper.html
after:
Code: Select all
{$lng->main_executiontime}: {$execution_time} | {$lng->main_queries}: {$num_queries} | {$lng->main_members}: {$num_members}<br />

insert
Code: Select all
{$cache_off}<br />


compatible:
Vindozo mods: Captcha in comments New Reviews for ver 5.2
viewtopic.php?f=8&t=7905
Vindozo mods: include php code in skins {php .. php}
viewtopic.php?f=8&t=7908
Last edited by VINDOZO on 2008-02-24 12:11 am, edited 1 time in total.
VINDOZO
Newbie
 
Posts: 7
Joined: 2008-02-11 11:30 pm

Re: Vindozo mods: Cache site - turbo speed

Postby VINDOZO » 2008-02-24 12:09 am

Jeremy Scheff, your opinion? :D

add this mods in new version 5.3?
VINDOZO
Newbie
 
Posts: 7
Joined: 2008-02-11 11:30 pm

Re: Vindozo mods: Cache site - turbo speed

Postby Jeremy » 2008-02-26 10:41 pm

seems like a good idea. i'm a little skeptical of you encoding all of the GET, POST, and COOKIE data into urls. that seems like it could be a security problem. and i don't think that POST and COOKIE are supposed to be cached in general, only GET.
Jeremy
Supreme Diety
 
Posts: 8922
Joined: 2003-05-05 04:41 pm
Location: NJ, USA

Re: Vindozo mods: Cache site - turbo speed

Postby Polymath » 2008-05-24 04:29 am

So. Does that mean this is ok to add to my topsite. vers 5.1.2?
(\__/)
(O.o ) *If You need help, best not to ask me*
(> < ) EZMNetwork.com
Gamesocket.geek.nz
Kiwitopsite.co.nz
Polymath
Advanced Member
 
Posts: 55
Joined: 2007-02-25 09:22 am
Location: New Zealand

Re: Vindozo mods: Cache site - turbo speed

Postby Polymath » 2008-05-26 04:16 am

What does replace all down on: mean, please?

Edit: ok worked it all out. No change. Don't even have it showing in the footer.
(\__/)
(O.o ) *If You need help, best not to ask me*
(> < ) EZMNetwork.com
Gamesocket.geek.nz
Kiwitopsite.co.nz
Polymath
Advanced Member
 
Posts: 55
Joined: 2007-02-25 09:22 am
Location: New Zealand

Re: Vindozo mods: Cache site - turbo speed

Postby Polymath » 2008-05-29 11:57 pm

Testing Testing, one, two, three. Anybody out there?

Installed and nothing changes. Anybody else tried this?
Polymath
Advanced Member
 
Posts: 55
Joined: 2007-02-25 09:22 am
Location: New Zealand

Re: Vindozo mods: Cache site - turbo speed

Postby Basti » 2008-05-30 07:43 am

nope never tested it, since my topsite is allready fast :P
i also doubt its good to use this one, because of wha jeremy posted
Basti
Advanced Member
 
Posts: 1619
Joined: 2004-06-20 06:17 pm
Location: Germany

Re: Vindozo mods: Cache site - turbo speed

Postby mattsson » 2008-06-08 08:35 am

Works fine on my toplist thanks for the mod.
mattsson
Newbie
 
Posts: 8
Joined: 2007-03-31 06:50 am

Re: Vindozo mods: Cache site - turbo speed

Postby alamandra » 2011-11-20 04:24 am

hi guys, hi Vindozo :)))

i dont know if you will read this,

but i used your mod, seems running well, but infos are not shown,

any idea about the var $cache ? in wrapper i mean ;)

$conf cache has to be defined to ON ?
alamandra
Newbie
 
Posts: 5
Joined: 2009-12-10 06:13 am


Return to Mods

Who is online

Users browsing this forum: No registered users and 3 guests

cron