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?
When a request is executed that renders a view, Laravel will compile the view if a pre-compiled view does not already exist (or if the view has been modified more recently than the compiled view). View caching pre-compiles all of the views utilized by your application.
To enable Laravel caching services, first use the Illuminate\Contracts\Cache\Factory and Illuminate\Contracts\Cache\Repository, as they provide access to the Laravel caching services. The Factory contract gives access to all the cache drivers of your application.
Laravel supports the use of Redis, which uses caches for temporary data storage to speed up the process of performing database queries and getting feedback, which will, in turn, reduce the amount of time spent pulling up data.
A cache is a collection of duplicate data, where the original data is expensive to fetch or compute (usually in terms of access time) relative to the cache. In PHP, caching is used to minimize page generation time.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With