Browse Source

Merge pull request #1827 from neoascetic/flush_file_cache

Ability to flush file-based cache storage
Taylor Otwell 11 years ago
parent
commit
778a97b319
2 changed files with 17 additions and 7 deletions
  1. 11 1
      laravel/cache/drivers/file.php
  2. 6 6
      laravel/cache/drivers/redis.php

+ 11 - 1
laravel/cache/drivers/file.php

@@ -97,4 +97,14 @@ class File extends Driver {
 		if (file_exists($this->path.$key)) @unlink($this->path.$key);
 	}
 
-}
+	/**
+	 * Flush the entire cache.
+	 *
+	 * @return void
+	 */
+	public function flush()
+	{
+		array_map('unlink', glob($this->path.'*'));
+	}
+
+}

+ 6 - 6
laravel/cache/drivers/redis.php

@@ -87,15 +87,15 @@ class Redis extends Driver {
 	{
 		$this->redis->del($key);
 	}
-	
+
 	/**
 	 * Flush the entire cache.
-	 * 
+	 *
 	 * @return void
 	 */
-	 public function flush()
-	 {
-	 	$this->redis->flushdb();
-	 }
+	public function flush()
+	{
+		$this->redis->flushdb();
+	}
 
 }