Commit 715bed74 by Taylor Otwell

Add support for closures to File cache driver.

parent ac38876e
......@@ -36,20 +36,17 @@ class File implements \System\Cache\Driver {
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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment