Changeset 3135

Show
Ignore:
Timestamp:
07/17/2008 08:14:17 AM (5 months ago)
Author:
Geert
Message:

Fixing #563 again. Cache not found? Return NULL.

Location:
trunk/system/libraries
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/libraries/Cache.php

    r3134 r3135  
    9999        /** 
    100100         * Fetches a cache by id. Non-string cache items are automatically 
    101          * unserialized before the cache is returned. FALSE is returned when 
     101         * unserialized before the cache is returned. NULL is returned when 
    102102         * a cache item is not found. 
    103103         * 
    104104         * @param   string  cache id 
    105          * @return  mixed   cached data or FALSE 
     105         * @return  mixed   cached data or NULL 
    106106         */ 
    107107        public function get($id) 
     
    137137                        { 
    138138                                // Load each cache item and add it to the array 
    139                                 if (($cache = $this->get($id)) !== FALSE) 
     139                                if (($cache = $this->get($id)) !== NULL) 
    140140                                { 
    141141                                        $data[$id] = $cache; 
  • trunk/system/libraries/drivers/Cache.php

    r2999 r3135  
    2424        /** 
    2525         * Get a cache item. 
    26          * Return FALSE if the cache item is not found. 
     26         * Return NULL if the cache item is not found. 
    2727         */ 
    2828        public function get($id); 
  • trunk/system/libraries/drivers/Cache/Apc.php

    r2999 r3135  
    2020        public function get($id) 
    2121        { 
    22                 return apc_fetch($id); 
     22                return (($return = apc_fetch($id)) === FALSE) ? NULL : $return; 
    2323        } 
    2424 
  • trunk/system/libraries/drivers/Cache/Eaccelerator.php

    r2999 r3135  
    2020        public function get($id) 
    2121        { 
    22                 return (($return = eaccelerator_get($id)) === NULL) ? FALSE : $return; 
     22                return eaccelerator_get($id); 
    2323        } 
    2424 
  • trunk/system/libraries/drivers/Cache/File.php

    r2999 r3135  
    137137         * the hash does not match the stored hash. 
    138138         * 
    139          * @param  string  cache id 
    140          * @return mixed|NULL 
     139         * @param   string  cache id 
     140         * @return  mixed|NULL 
    141141         */ 
    142142        public function get($id) 
     
    174174                } 
    175175 
    176                 // Return FALSE if there is no data 
    177                 return isset($data) ? $data : FALSE; 
     176                // Return NULL if there is no data 
     177                return isset($data) ? $data : NULL; 
    178178        } 
    179179 
     
    181181         * Deletes a cache item by id or tag 
    182182         * 
    183          * @param  string  cache id or tag, or TRUE for "all items" 
    184          * @param  bool    use tags 
    185          * @return bool 
     183         * @param   string   cache id or tag, or TRUE for "all items" 
     184         * @param   boolean  use tags 
     185         * @return  boolean 
    186186         */ 
    187187        public function delete($id, $tag = FALSE) 
  • trunk/system/libraries/drivers/Cache/Memcache.php

    r2899 r3135  
    4444        public function get($id) 
    4545        { 
    46                 return $this->backend->get($id); 
     46                return (($return = $this->backend->get($id)) === FALSE) ? NULL : $return; 
    4747        } 
    4848 
  • trunk/system/libraries/drivers/Cache/Sqlite.php

    r2999 r3135  
    177177                } 
    178178 
    179                 // No valid cache foud 
    180                 return FALSE; 
     179                // No valid cache found 
     180                return NULL; 
    181181        } 
    182182 
  • trunk/system/libraries/drivers/Cache/Xcache.php

    r3008 r3135  
    2323                        return xcache_get($id); 
    2424 
    25                 return FALSE; 
     25                return NULL; 
    2626        } 
    2727