PHP Classes
Icontem

File: test1.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Cesar D. Rodas  >  gCache  >  test1.php  
File: test1.php
Role: Example script
Content type: text/plain
Description: Test File
Class: gCache
Capture and cache Web page content
 

Contents

Class file image Download
<?php
include("gCache.php");
$cache = new gCache;
$cache->folder "./cache/";
$cache->contentId="var45";
$cache->timeout 1;
/* its mean gCache cached the whole page */
/* so, gcache, decide if he must response the compressed or */
/* uncompressed cache*/
$cache->isPage true
if (
$cache->Valid()) {
    echo 
$cache->content;
} else {
$cache->capture();
?>
<html>
<head>
<title>Cached page</title>
<head>
<body bgcolor="#CCCCCC">
    <h1>Testing Cesar D. Rodas' gCache Class</h1>
    <hr>
    <h2>Example of how to cache a hole page</h2>
    <hr>
<p>Basicaly what the gCache do, is to store a web-page or a portion of it into 
  a<em> <em>cache file</em>. </em>The <em><em>cache file</em></em> has a $timeout 
  in second of cache vitality, after that the cache will be re-created.</p>
<p>Also this class provides and locking system which is not depending of POSIX 
  or other OS, this feature becomes to this class very portable.</p>
<hr>
<font size="1">This cache page was generated at 
<?php echo date("Y/m/d H:i:s")?>
</font><font size="1"> by <a href="http://cesars.users.phpclasses.org/gcache">gCache</a> 
</font>
</body>
</html>
<? 
$cache
->endcapture();
}
?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products