From a61f51fa933e8a94d353806727bb2560504659c5 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 14 Mar 2012 14:08:52 -0500 Subject: [PATCH] Add forever and flush methods to memory driver. Signed-off-by: Taylor Otwell --- laravel/cache/drivers/memory.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/laravel/cache/drivers/memory.php b/laravel/cache/drivers/memory.php index 60957c33..8510890a 100644 --- a/laravel/cache/drivers/memory.php +++ b/laravel/cache/drivers/memory.php @@ -52,6 +52,18 @@ public function put($key, $value, $minutes) $this->storage[$key] = $value; } + /** + * Write an item to the cache that lasts forever. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + $this->put($key, $value, 0); + } + /** * Delete an item from the cache. * @@ -63,4 +75,14 @@ public function forget($key) unset($this->storage[$key]); } + /** + * Flush the entire cache. + * + * @return void + */ + public function flush() + { + $this->stroage = array(); + } + } \ No newline at end of file