diff --git a/system/cache/driver/file.php b/system/cache/driver/file.php index 0994f75d..ce5128b7 100644 --- a/system/cache/driver/file.php +++ b/system/cache/driver/file.php @@ -36,20 +36,17 @@ public function get($key, $default = null) if ( ! file_exists(APP_PATH.'storage/cache/'.$key)) { - return $default; + return is_callable($default) ? call_user_func($default) : $default; } $cache = file_get_contents(APP_PATH.'storage/cache/'.$key); - // -------------------------------------------------- - // Has the cache expired? The UNIX expiration time - // is stored at the beginning of the file. - // -------------------------------------------------- + // Has the cache expired? The UNIX expiration time is stored at the beginning of the file. if (time() >= substr($cache, 0, 10)) { $this->forget($key); - return $default; + return is_callable($default) ? call_user_func($default) : $default; } return $this->items[$key] = unserialize(substr($cache, 10));