How to create server cache for my website

We have developed one website site. Now some user are using this site, so i plan to create server cache for some page in the site’s so send some tips or ways to create simply without problem.

I am working in PHP and I think ob_start() function and ob_end_flash function will help you to create you server cache for your website.
Here is the example coding:

<?php
// Define path and name of cached file
$cachefile = ‘cache/’.date(‘M-d-Y’).‘.php’;
// How long to keep cache file?
$cachetime = 18000;
//Is cache file still fresh? If so, serve it.
if (file_exists($cachefile) && time() - $cachetime <
filemtime($cachefile))
{
include($cachefile);
exit;
}
// if no file or too old, render and capture HTML page.
ob_start();
?>

<html>
Webpage content in here
</html>

<?php
// Save the cached content to a file
$fp = fopen($cachefile, ‘w’);
fwrite($fp, ob_get_contents());
fclose($fp);
// Send browser output
ob_end_flush();
?>