Default to no expiration.
authorJan Schneider <jan@horde.org>
Tue, 30 Nov 2010 14:32:04 +0000 (15:32 +0100)
committerJan Schneider <jan@horde.org>
Tue, 30 Nov 2010 14:32:04 +0000 (15:32 +0100)
framework/Cache/lib/Horde/Cache/Storage/Apc.php
framework/Cache/lib/Horde/Cache/Storage/Base.php
framework/Cache/lib/Horde/Cache/Storage/Eaccelerator.php
framework/Cache/lib/Horde/Cache/Storage/File.php
framework/Cache/lib/Horde/Cache/Storage/Memcache.php
framework/Cache/lib/Horde/Cache/Storage/Mock.php
framework/Cache/lib/Horde/Cache/Storage/Null.php
framework/Cache/lib/Horde/Cache/Storage/Session.php
framework/Cache/lib/Horde/Cache/Storage/Sql.php
framework/Cache/lib/Horde/Cache/Storage/Stack.php
framework/Cache/lib/Horde/Cache/Storage/Xcache.php

index f0b7c13..51fd3c7 100644 (file)
@@ -32,7 +32,7 @@ class Horde_Cache_Storage_Apc extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function get($key, $lifetime)
+    public function get($key, $lifetime = 0)
     {
         $key = $this->_params['prefix'] . $key;
         $this->_setExpire($key, $lifetime);
@@ -41,7 +41,7 @@ class Horde_Cache_Storage_Apc extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function set($key, $data, $lifetime)
+    public function set($key, $data, $lifetime = 0)
     {
         $key = $this->_params['prefix'] . $key;
         if (apc_store($key . '_expire', time(), $lifetime)) {
@@ -51,7 +51,7 @@ class Horde_Cache_Storage_Apc extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function exists($key, $lifetime)
+    public function exists($key, $lifetime = 0)
     {
         $key = $this->_params['prefix'] . $key;
         $this->_setExpire($key, $lifetime);
index 18666bc..ff1e22a 100644 (file)
@@ -57,7 +57,7 @@ abstract class Horde_Cache_Storage_Base
      *
      * @return mixed  Cached data, or false if none was found.
      */
-    abstract public function get($key, $lifetime);
+    abstract public function get($key, $lifetime = 0);
 
     /**
      * Store an object in the cache.
@@ -68,7 +68,7 @@ abstract class Horde_Cache_Storage_Base
      *                           data becomes available for garbage
      *                           collection. If 0 will not be GC'd.
      */
-    abstract public function set($key, $data, $lifetime);
+    abstract public function set($key, $data, $lifetime = 0);
 
     /**
      * Checks if a given key exists in the cache, valid for the given
@@ -79,7 +79,7 @@ abstract class Horde_Cache_Storage_Base
      *
      * @return boolean  Existence.
      */
-    abstract public function exists($key, $lifetime);
+    abstract public function exists($key, $lifetime = 0);
 
     /**
      * Expire any existing data for the given key.
index 349b152..695b8b4 100644 (file)
@@ -38,7 +38,7 @@ class Horde_Cache_Storage_Eaccelerator extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function get($key, $lifetime)
+    public function get($key, $lifetime = 0)
     {
         $key = $this->_params['prefix'] . $key;
         $this->_setExpire($key, $lifetime);
@@ -47,7 +47,7 @@ class Horde_Cache_Storage_Eaccelerator extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function set($key, $data, $lifetime)
+    public function set($key, $data, $lifetime = 0)
     {
         $key = $this->_params['prefix'] . $key;
         if (eaccelerator_put($key . '_expire', time(), $lifetime)) {
@@ -57,7 +57,7 @@ class Horde_Cache_Storage_Eaccelerator extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function exists($key, $lifetime)
+    public function exists($key, $lifetime = 0)
     {
         $key = $this->_params['prefix'] . $key;
         $this->_setExpire($key, $lifetime);
index 7aa1e6f..e833da4 100644 (file)
@@ -120,7 +120,7 @@ class Horde_Cache_Storage_File extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function get($key, $lifetime)
+    public function get($key, $lifetime = 0)
     {
         if (!$this->exists($key, $lifetime)) {
             /* Nothing cached, return failure. */
@@ -137,7 +137,7 @@ class Horde_Cache_Storage_File extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function set($key, $data, $lifetime)
+    public function set($key, $data, $lifetime = 0)
     {
         $filename = $this->_keyToFile($key, true);
         $tmp_file = Horde_Util::getTempFile('HordeCache', true, $this->_dir);
@@ -163,7 +163,7 @@ class Horde_Cache_Storage_File extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function exists($key, $lifetime)
+    public function exists($key, $lifetime = 0)
     {
         $filename = $this->_keyToFile($key);
 
index 81a0255..e68b233 100644 (file)
@@ -59,7 +59,7 @@ class Horde_Cache_Storage_Memcache extends Horde_Cache_Storage_Base implements S
 
     /**
      */
-    public function get($key, $lifetime)
+    public function get($key, $lifetime = 0)
     {
         $key = $this->_params['prefix'] . $key;
         if (isset($this->_expirecache[$key])) {
@@ -91,7 +91,7 @@ class Horde_Cache_Storage_Memcache extends Horde_Cache_Storage_Base implements S
 
     /**
      */
-    public function set($key, $data, $lifetime)
+    public function set($key, $data, $lifetime = 0)
     {
         $key = $this->_params['prefix'] . $key;
 
@@ -102,7 +102,7 @@ class Horde_Cache_Storage_Memcache extends Horde_Cache_Storage_Base implements S
 
     /**
      */
-    public function exists($key, $lifetime)
+    public function exists($key, $lifetime = 0)
     {
         $key = $this->_params['prefix'] . $key;
 
index 6f43c30..46fae77 100644 (file)
@@ -26,7 +26,7 @@ class Horde_Cache_Storage_Mock extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function get($key, $lifetime)
+    public function get($key, $lifetime = 0)
     {
         return isset($this->_cache[$key])
             ? $this->_cache[$key]
@@ -35,14 +35,14 @@ class Horde_Cache_Storage_Mock extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function set($key, $data, $lifetime)
+    public function set($key, $data, $lifetime = 0)
     {
         $this->_cache[$key] = $data;
     }
 
     /**
      */
-    public function exists($key, $lifetime = 1)
+    public function exists($key, $lifetime = 0)
     {
         return isset($this->_cache[$key]);
     }
index 73d6261..68528e8 100644 (file)
@@ -16,20 +16,20 @@ class Horde_Cache_Storage_Null extends Horde_Cache_Storage_Base
 {
     /**
      */
-    public function get($key, $lifetime)
+    public function get($key, $lifetime = 0)
     {
         return false;
     }
 
     /**
      */
-    public function set($key, $data, $lifetime)
+    public function set($key, $data, $lifetime = 0)
     {
     }
 
     /**
      */
-    public function exists($key, $lifetime)
+    public function exists($key, $lifetime = 0)
     {
         return false;
     }
index c0b0aec..e0a8bd7 100644 (file)
@@ -46,7 +46,7 @@ class Horde_Cache_Storage_Session extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function get($key, $lifetime)
+    public function get($key, $lifetime = 0)
     {
         return $this->exists($key, $lifetime)
             ? $this->_sess[$key]['d']
@@ -55,7 +55,7 @@ class Horde_Cache_Storage_Session extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function set($key, $data, $lifetime)
+    public function set($key, $data, $lifetime = 0)
     {
         $this->_sess[$key] = array(
             'd' => $data,
@@ -65,7 +65,7 @@ class Horde_Cache_Storage_Session extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function exists($key, $lifetime)
+    public function exists($key, $lifetime = 0)
     {
         if (isset($this->_sess[$key])) {
             /* 0 means no expire. */
index 328fe02..b1ea254 100644 (file)
@@ -85,7 +85,7 @@ class Horde_Cache_Storage_Sql extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function get($key, $lifetime)
+    public function get($key, $lifetime = 0)
     {
         $okey = $key;
         $key = hash('md5', $key);
@@ -127,7 +127,7 @@ class Horde_Cache_Storage_Sql extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function set($key, $data, $lifetime)
+    public function set($key, $data, $lifetime = 0)
     {
         $okey = $key;
         $key = hash('md5', $key);
@@ -165,7 +165,7 @@ class Horde_Cache_Storage_Sql extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function exists($key, $lifetime)
+    public function exists($key, $lifetime = 0)
     {
         $okey = $key;
         $key = hash('md5', $key);
index f22ea85..09e9e42 100644 (file)
@@ -48,7 +48,7 @@ class Horde_Cache_Storage_Stack extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function get($key, $lifetime)
+    public function get($key, $lifetime = 0)
     {
         foreach ($this->_stack as $val) {
             $result = $val->get($key, $lifetime);
@@ -62,7 +62,7 @@ class Horde_Cache_Storage_Stack extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function set($key, $data, $lifetime)
+    public function set($key, $data, $lifetime = 0)
     {
         /* Do writes in *reverse* order - it is OK if a write to one of the
          * non-master backends fails. */
@@ -84,7 +84,7 @@ class Horde_Cache_Storage_Stack extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function exists($key, $lifetime)
+    public function exists($key, $lifetime = 0)
     {
         foreach ($this->_stack as $val) {
             $result = $val->exists($key, $lifetime);
index 6f969d1..29ef31f 100644 (file)
@@ -32,7 +32,7 @@ class Horde_Cache_Storage_Xcache extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function get($key, $lifetime)
+    public function get($key, $lifetime = 0)
     {
         $key = $this->_params['prefix'] . $key;
         $this->_setExpire($key, $lifetime);
@@ -45,7 +45,7 @@ class Horde_Cache_Storage_Xcache extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function set($key, $data, $lifetime)
+    public function set($key, $data, $lifetime = 0)
     {
         $key = $this->_params['prefix'] . $key;
         if (xcache_set($key . '_expire', time(), $lifetime)) {
@@ -55,7 +55,7 @@ class Horde_Cache_Storage_Xcache extends Horde_Cache_Storage_Base
 
     /**
      */
-    public function exists($key, $lifetime)
+    public function exists($key, $lifetime = 0)
     {
         $key = $this->_params['prefix'] . $key;
         $this->_setExpire($key, $lifetime);