How does Laravel Views Cache works?

こ雲淡風輕ζ 提交于 2020-06-14 03:13:10

问题


According to Laravel's documentation (https://laravel.com/docs/5.3/blade#introduction) views are compiled into plain PHP code and cached until they are modified but when are they re-compiled?

I have my project in a production environment and when I deploy changes are automatically showed, I don't need to clear views cache or something similar.

Are views re-compiled automatically (in that case, when does it happen?) or do I haven't cache enabled?


回答1:


By default all views are compiled/cached. You can define a path where to store compiled version in app/config/view.php. When Laravel framework tries to compile a view it check the modification date of the source view file and compiled version if the last one exists. If the compiled file is older than a the source file Laravel recompiled the view and store it as a new cached version of the source file. It happens every time when you deploy a new version of the code.



来源:https://stackoverflow.com/questions/39209828/how-does-laravel-views-cache-works

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!