|
@@ -69,15 +69,27 @@ abstract class Driver {
|
|
* @param int $minutes
|
|
* @param int $minutes
|
|
* @return mixed
|
|
* @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;
|
|
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;
|
|
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.
|
|
* Delete an item from the cache.
|
|
*
|
|
*
|