uw              Fri Mar 16 00:40:40 2001 EDT

  Modified files:              
    /php4/pear/Cache    Output.php 
  Log:
  Usage example changes should answer peoples FAQs.
  
  
Index: php4/pear/Cache/Output.php
diff -u php4/pear/Cache/Output.php:1.12 php4/pear/Cache/Output.php:1.13
--- php4/pear/Cache/Output.php:1.12     Thu Mar 15 23:58:35 2001
+++ php4/pear/Cache/Output.php  Fri Mar 16 00:40:39 2001
@@ -17,7 +17,7 @@
 // |          Vinai Kopp <[EMAIL PROTECTED]>                           |
 // +----------------------------------------------------------------------+
 //
-// $Id: Output.php,v 1.12 2001/03/16 07:58:35 sbergmann Exp $
+// $Id: Output.php,v 1.13 2001/03/16 08:40:39 uw Exp $
 
 require_once 'Cache.php';
 
@@ -36,10 +36,10 @@
 *
 *  // place this somewhere in a central config file
 *  define(CACHE_STORAGE_CLASS, "file");
-* // file storage needs a dir to put the cache files
-* define(CACHE_DIR, "/var/tmp/");
+*  // file storage needs a dir to put the cache files
+*  define(CACHE_DIR, "/var/tmp/");
 *
-* // get a cache object
+*  // get a cache object
 *  $cache = new Cache_Output(CACHE_STORAGE_CLASS, array("cache_dir" => CACHE_DIR));
 *
 *  // compute the unique handle.
@@ -50,12 +50,20 @@
 *  //                       "post" => $HTTP_POST_VAS"
 *  //                       "cookie"  => $HTTP_COOKIE_VARS
 *  //                    );
+<<<<<<< Output.php
+*  // But be warned, using all GET or POST Variables as a seed
+*  // can be used for a DOS attack. Calling 
+http://www.example.com/example.php?whatever
+*  // where whatever is a random text might be used to flood your cache.
 *  $cache_handle = $cache->generateID($REQUEST_URI);
+=======
+*  $cache_handle = $cache->generateID($REQUEST_URI);
+>>>>>>> 1.12
 * 
 *  // now the magic happens: if cached call die() 
 *  // to end the time consumptiong script script execution and use the cached value!
 *  if ($content = $cache->start($cache_handle)) {
 *     print $content;
+*     print "<p>Cache hit</p>";
 *     die();
 *  }
 *  
@@ -63,17 +71,27 @@
 * 
 *  // store the output of the cache into the cache and print the output.
 *  print $cache->end();
+*  print "<p>Cache miss, stored using the ID '$id'.</p>";
+* 
+*  If you do not want to cache a whole page - no problem:
 * 
-* If you do not want to cache a whole page - no problem:
+*  if (!($content = $cache->start($cache_handle))) {
+*     // do the computation here
+*     print $cache->end()
+*  } else {
+     print $content;
+*  }
 * 
-* if (!($content = $cache->start($cache_handle))) {
-*    // do the computation here
-*    print $cache->end()
-* } else {
-    print $content;
-* }
+*  If you need an example script check the (auto_)prepend and (auto_)append 
+*  files of my homepage:
+* 
+*    http://www.ulf-wendel.de/php/show_source.php?file=prepend
+*    http://www.ulf-wendel.de/php/show_source.php?file=append
+*
+*  Don't know how to use it or you need profiling informations?`
+*  Ask Christian he was patient with me and he'll be so with your questions ;).
 *
-* Have fun!
+*  Have fun!
 * 
 * @authors  Ulf Wendel <[EMAIL PROTECTED]>
 * @version  $ID: $



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to