Fixing bugs.

This commit is contained in:
Taylor Otwell
2012-04-20 11:35:47 -05:00
parent 98ea9ac41f
commit a92ab1ca30
5 changed files with 42 additions and 24 deletions

View File

@@ -69,15 +69,27 @@ abstract class Driver {
* @param int $minutes
* @return mixed
*/
public function remember($key, $default, $minutes)
public function remember($key, $default, $minutes, $function = 'put')
{
if ( ! is_null($item = $this->get($key, null))) return $item;
$this->put($key, $default = value($default), $minutes);
$this->$function($key, $default = value($default), $minutes);
return $default;
}
/**
* Get an item from the cache, or cache the default value forever.
*
* @param string $key
* @param mixed $default
* @return mixed
*/
public function sear($key, $default)
{
return $this->remember($key, $default, null, 'forever');
}
/**
* Delete an item from the cache.
*