laravel的 storage\framework\views 缓存文件生成规则

 Laravel  2021-04-12  admin  1790  2416

laravel的 storage\framework\views 缓存文件生成规则

vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php

/**
 * Get the path to the compiled version of a view.
 *
 * @param  string  $path
 * @return string
 */
public function getCompiledPath($path)
{
    return $this->cachePath.'/'.sha1($path).'.php';
}

/**
 * Determine if the view at the given path is expired.
 *
 * @param  string  $path
 * @return bool
 */
public function isExpired($path)
{
    $compiled = $this->getCompiledPath($path);

    // If the compiled file doesn't exist we will indicate that the view is expired
    // so that it can be re-compiled. Else, we will verify the last modification
    // of the views is less than the modification times of the compiled views.
    if (! $this->files->exists($compiled)) {
        return true;
    }

    return $this->files->lastModified($path) >=
           $this->files->lastModified($compiled);
}

laravel 缓存view文件以blade.php文件的绝对地址的sha1值来命名,并且根据blade.php的修改时间和缓存文件的生成时间对比,如果过期会重新生成。

如果文章对您有帮助,点击下方的广告,支持一下作者吧!

相关推荐


Systemd Web 管理系统:简化服务管理

# Systemd Web Systemd Web 是一个 Systemd 的 Web UI 管理系统,通过直观的界面和易用的操作,让用户能够轻松地管理 Linux 系统和服务。该项目旨在简化 Systemd 的使用,使得无论是专业的系统管理员还是普通的用户,都能够方便地对系统进行操作。 ## [github地址] (https://github.com/topascend/systemd

laravel 自定义写入日志

laravel 自定义写入日志if(!function_exists('myLog')){ /** *生成自定义文件日志内容 *@param$data *@paramstring$title *@parambool$isClear *@returnvoid *@Author:cent123.com */ functionmyLog($data,string$tit

systemctl 使用

Systemd是Linux系统工具,用来启动守护进程,已成为大多数发行版的标准配置。而systemctl是Systemd的主命令,用于管理系统。其实我们大部分服务都有使用systemctl管理,比如MySQL、Nginx等等。常见配置如下:[Unit] #单元描述 Description=GFAPP #在什么服务启动之后再执行本程序 After=mysql.service [Serv

封装 laravel 的公共队列,延迟处理任务

封装 laravel 的公共队列,延迟处理任务<?php /** *ThisfileispartofLunanShopTeam. *http://code.cent123.com/ *@authorhttp://code.cent123.com/view/387 */ namespaceApp\Jobs; useException; useIlluminate\B