Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GT Cache
#1
Would it make sense to make GT cachable?

For pages that use many xml requests, api's etc. this might make sense....

Maybe in the lines of: (just wrote code here...not tested)...


<?php
// check if cache file exists
if (file_exists('data/cache/'.$file.'.cache')) {
// check how old cache file is...and use it or rewrite it
if(date("d-m-y", filemtime('data/cache/'.$file.'.cache)) > datetime(+24hrs)){
// Read cache file
readfile('data/cache/'.$file.'.cache');
exit();
}
}

// Start buffering the output
ob_start();

// Display some HTML
?>
--- HTML CONTENT ---
<?php
$buffer = ob_get_contents();
ob_end_flush();

$fp = fopen('data/cache/'.$file.'.cache', 'w');
fwrite($fp, $buffer);
fclose($fp);
?>

one could think of adding memcache in the loop as well...
Reply


Messages In This Thread
GT Cache - by nexflo - 2010-03-25, 07:05:42
GT Cache - by Zegnåt - 2010-03-25, 07:42:06
GT Cache - by nexflo - 2010-03-25, 07:51:49
GT Cache - by sal - 2010-03-25, 08:28:57
GT Cache - by ccagle8 - 2010-03-25, 20:24:47
GT Cache - by nexflo - 2010-03-26, 01:29:48
GT Cache - by nexflo - 2010-03-26, 18:12:50
GT Cache - by Zegnåt - 2010-03-27, 00:20:17
GT Cache - by nexflo - 2010-03-27, 00:55:14
GT Cache - by juliancc - 2010-03-27, 02:47:55
GT Cache - by nexflo - 2010-03-27, 02:56:58



Users browsing this thread: 1 Guest(s)