Merge branch 'extended-cookie'
[scuttle] / services / cacheservice.php
index fe66d38e995d23e38804267f0cffa75ec8480d6f..2169e2d442f457152c5c87764f2eed67699805a1 100644 (file)
@@ -1,38 +1,36 @@
 <?php
 class CacheService {
-    var $basedir;
-    var $fileextension = '.cache';
+  var $basedir;
+  var $fileextension = '.cache';
 
-    function &getInstance() {
-        static $instance;
-        
-        if (!isset($instance))
-            $instance =& new CacheService();
-
-        return $instance;
+  function &getInstance() {
+    static $instance;
+    if (!isset($instance)) {
+      $instance = new CacheService();
     }
+    return $instance;
+  }
 
-    function CacheService() {
-        $this->basedir = $GLOBALS['dir_cache'];    
-    }
+  function CacheService() {
+    $this->basedir = $GLOBALS['dir_cache'];
+  }
 
-    function Start($hash, $time = 300) {
-        $cachefile = $this->basedir .'/'. $hash . $this->fileextension;
-        if (file_exists($cachefile) && time() < filemtime($cachefile) + $time) {
-            @readfile($cachefile);
-            echo "\n<!-- Cached: ". date('r', filemtime($cachefile)) ." -->\n";
-            unset($cachefile);
-            exit;
-        }
-        ob_start("ob_gzhandler");
+  function Start($hash, $time = 300) {
+    $cachefile = $this->basedir .'/'. $hash . $this->fileextension;
+    if (file_exists($cachefile) && time() < filemtime($cachefile) + $time) {
+      @readfile($cachefile);
+      echo "\n<!-- Cached: ". date('r', filemtime($cachefile)) ." -->\n";
+      unset($cachefile);
+      exit;
     }
+    ob_start("ob_gzhandler");
+  }
 
-    function End($hash) {
-        $cachefile = $this->basedir .'/'. $hash . $this->fileextension;      
-        $handle = fopen($cachefile, 'w');
-        fwrite($handle, ob_get_contents());
-        fclose($handle);
-        ob_flush();
-    }
+  function End($hash) {
+    $cachefile = $this->basedir .'/'. $hash . $this->fileextension;
+    $handle = fopen($cachefile, 'w');
+    fwrite($handle, ob_get_contents());
+    fclose($handle);
+    ob_flush();
+  }
 }
-?>
\ No newline at end of file

Benjamin Mako Hill || Want to submit a patch?