From 0d99d13298f123acf86b48967e6fe8af8ea4b721 Mon Sep 17 00:00:00 2001 From: Pavel Puchkin Date: Fri, 29 Mar 2013 11:02:26 +1100 Subject: [PATCH] Ability to flush file-based cache storage --- laravel/cache/drivers/file.php | 12 +++++++++++- laravel/cache/drivers/redis.php | 12 ++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/laravel/cache/drivers/file.php b/laravel/cache/drivers/file.php index c37520ea..31ef9a4e 100644 --- a/laravel/cache/drivers/file.php +++ b/laravel/cache/drivers/file.php @@ -97,4 +97,14 @@ public function forget($key) if (file_exists($this->path.$key)) @unlink($this->path.$key); } -} \ No newline at end of file + /** + * Flush the entire cache. + * + * @return void + */ + public function flush() + { + array_map('unlink', glob($this->path.'*')); + } + +} diff --git a/laravel/cache/drivers/redis.php b/laravel/cache/drivers/redis.php index f0a71d07..ebc1c08f 100644 --- a/laravel/cache/drivers/redis.php +++ b/laravel/cache/drivers/redis.php @@ -87,15 +87,15 @@ public function forget($key) { $this->redis->del($key); } - + /** * Flush the entire cache. - * + * * @return void */ - public function flush() - { - $this->redis->flushdb(); - } + public function flush() + { + $this->redis->flushdb(); + } }