有没有办法刷新Laravel 4中的所有缓存?我使用file进行缓存.我在文件上读到你可以使用Cache::forget('key'),但是如果我需要删除所有缓存呢?

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

此外,您还可以使用

foreach (Cache::getMemory() as $cacheKey => $cacheValue)
{

    Cache::forget($cacheKey);
}

Update:

Cache::flush();

Laravel相关问答推荐

当使用Craftable PRO时,Wysiwig是什么时候生成的?

在Laravel Livewire中,如果一个输入基于另一个唯一的字段是唯一的,如何判断验证?

Laravel 模型事件:delete() 不会从存储中删除文件

如何使用动态翻译键翻译 Laravel硬编码字符串(还有 1 个错误)..(验证异常类)

1 子编译中的警告(使用'stats.children:true'和'--stats-children'了解更多详细信息)

Laravel 5.3:语法错误或访问冲突:1463 HAVING 子句中使用了非分组字段距离

Laravel 5.3 创建模型返回字段没有默认值

laravel:如何在 Eloquent Query 中使用 LOWERCASE 函数?

Laravel - 如何恢复本地存储符号链接并刷新

Laravel 表 * 没有名为 * 的列

控制器中的 Laravel Auth 用户 ID

laravel 5中的配置缓存导致找不到视图

不支持驱动Driver[] - Laravel 5.3

如果值存在于另一个字段数组中,Laravel 验证规则

Laravel:自定义或扩展通知 - 数据库模型

禁用Eager的关系

调用未定义的方法 Illuminate\Routing\Route::get()

Laravel 手动登录功能

如何让 Laravel 将 View 的Content-Type标头返回为application/javascript?

如何判断是否连接到 Laravel 4 中的数据库?