Flush all cache in Laravel 4
Is there a way to flush all cache in Laravel 4? I'm using file for caching. I read on the docs that you can use Cache::forget('key')
, but what if I need to delete all the cache?
An artisan command can also be useful, I think there's an issue on the repo, but not sure if it's implemented yet.
Thanks!
If you run php artisan list
then you can find all the commands available for artisan
, anyways, there is a command to clear the cache
and it's
php artisan cache:clear
Also, you can use
foreach (Cache::getMemory() as $cacheKey => $cacheValue)
{
Cache::forget($cacheKey);
}
Update:
Cache::flush();
Illuminate\Cache\FileStore
has the function flush
, so you can use:
Cache::flush();