Browse Source

Ability to flush file-based cache storage

Pavel Puchkin 11 years ago
parent
commit
0d99d13298
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();
+	}
 
 }