问题很清楚.
php artisan cache:clear
是否有任何解决方法可以像上面的命令一样清除缓存,但不使用CLI.我正在使用一种流行的共享主机服务,但按照我的计划,我没有控制面板访问权限.
I want to clear the views cache.
我看到的question跟这个差不多,但对我没什么帮助.
问题很清楚.
php artisan cache:clear
是否有任何解决方法可以像上面的命令一样清除缓存,但不使用CLI.我正在使用一种流行的共享主机服务,但按照我的计划,我没有控制面板访问权限.
I want to clear the views cache.
我看到的question跟这个差不多,但对我没什么帮助.
您可以在CLI外部调用Artisan命令.
Route::get('/clear-cache', function() {
$exitCode = Artisan::call('cache:clear');
// return what you want
});
你可以在这里查看官方文件
Update
无法删除视图缓存.我也不这么认为.
如果您真的想清除视图缓存,我认为您必须编写您自己的artisan
命令并像我前面说过的那样调用它,或者完全跳过artisan
路径,清除您从控制器或路由调用的某个类中的视图缓存.
But, my real question is do you really need to clear the view cache? In a project I'm working on now, I have almost 100 cached views and they weight less then 1 Mb, while my vendor
directory is > 40 Mb. I don't think view cache is a real bottleneck in disk usage and never had a real need to clear it.
至于application cache,它存储在storage/framework/cache
目录中,但前提是您在config/cache.php
中配置了file
驱动程序.您可以 Select 许多不同的驱动程序,例如Redis或Memcached,以提高基于文件的缓存的性能.