首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在编写器中,为什么某些依赖项从缓存中“加载”,而一些依赖项“克隆”来自缓存?

在编写器中,为什么某些依赖项从缓存中“加载”,而一些依赖项“克隆”来自缓存?
EN

Stack Overflow用户
提问于 2017-11-16 12:58:48
回答 1查看 1.1K关注 0票数 2

我正在尝试优化我的项目的composer install过程。我已经安装了Prestissimo,将我所有的dev依赖项移到‘require’中,并且在我的composer.json文件中将‘首选-install’设置为'dist‘。所有这些都把安装时间从4分钟缩短到2分钟。

我的依赖项包括我自己在Gitlab上的一些私有repos,当我观看composer安装过程时,我的repos说‘从缓存中克隆’,每个处理需要几秒钟,而所有其他依赖项都说‘从缓存加载’,并且几乎是立即处理。

这是composer.json

代码语言:javascript
复制
{
    "name": "my-project",
    "description": "My Project",
    "minimum-stability": "stable",
    "require": {
        "toruinteractive/ti-cms": "0.13.1"
    },
    "require-dev" : {
        "yiisoft/yii2-debug": "^2.0@dev"
    },
    "config": {
        "fxp-asset": {
          "installer-paths": {
            "npm-asset-library": "vendor/npm",
            "bower-asset-library": "vendor/bower"
          }
        },
        "process-timeout": 1800,
        "preferred-install" : "dist"
    },
    "extra": {
        "require-bower" : {
            "angular-elastic" : "2.5.*",
            "angular-trix" : "1.0.2",
            "aos":"2.1.1",
            "handlebars" : "4.0.*",
            "bootstrap-toggle" : "^2.2.2",
            "image-map-resizer" : "1.0.*"
        }
    },
    "repositories": [
        { "type": "git", "url" : "git@gitlab.com:ti-cms/ti-banner.git" },
        { "type": "git", "url" : "git@gitlab.com:ti-cms/ti-blog.git" },
        { "type": "git", "url" : "git@gitlab.com:ti-cms/ti-suggest.git" },
        { "type": "git", "url":  "git@gitlab.com:ti-cms/ti-cms.git" },
        { "type": "git", "url":  "git@gitlab.com:ti-cms/ti-dashboard.git" },
        { "type": "git", "url":  "git@gitlab.com:ti-cms/ti-file.git" },
        { "type": "git", "url":  "git@gitlab.com:ti-cms/ti-image.git" },
        { "type": "git", "url":  "git@gitlab.com:ti-cms/ti-export-import.git" },
        { "type": "git", "url":  "git@gitlab.com:ti-cms/ti-login.git" },
        { "type": "git", "url":  "git@gitlab.com:ti-cms/ti-navbar.git" },
        { "type": "git", "url":  "git@gitlab.com:ti-cms/ti-page.git" },
        { "type": "git", "url":  "git@gitlab.com:ti-cms/ti-search.git" },
        { "type": "git", "url":  "git@gitlab.com:ti-cms/ti-slides.git" },
        { "type": "git", "url":  "git@gitlab.com:ti-cms/ti-superadmin.git" },
        { "type": "git", "url":  "git@gitlab.com:ti-cms/ti-translator.git" },
        { "type": "git", "url":  "git@gitlab.com:ti-cms/ti-tree.git" }
    ]
}

这是composer install输出。

代码语言:javascript
复制
ghost$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 45 installs, 0 updates, 0 removals
  - Installing yiisoft/yii2-composer (2.0.5): Loading from cache
  - Installing bower-asset/jquery (3.2.1): Loading from cache
  - Installing bower-asset/bootstrap (v3.3.7): Loading from cache
  - Installing bower-asset/inputmask (3.3.10): Loading from cache
  - Installing bower-asset/punycode (v1.3.2): Loading from cache
  - Installing bower-asset/yii2-pjax (2.0.7.1): Loading from cache
  - Installing cebe/markdown (1.1.2): Loading from cache
  - Installing ezyang/htmlpurifier (v4.9.3): Loading from cache
  - Installing psr/log (1.0.2): Loading from cache
  - Installing monolog/monolog (1.23.0): Loading from cache
  - Installing paragonie/random_compat (v2.0.11): Loading from cache
  - Installing phenx/php-font-lib (0.4): Loading from cache
  - Installing phenx/php-svg-lib (0.1): Loading from cache
  - Installing phpoffice/phpexcel (1.8.1): Loading from cache
  - Installing yiisoft/yii2 (2.0.13.1): Loading from cache
  - Installing bower-asset/jquery-ui (1.11.4): Loading from cache
  - Installing yiisoft/yii2-jui (2.0.6): Loading from cache
  - Installing yiisoft/yii2-bootstrap (2.0.7): Loading from cache
  - Installing yiisoft/yii2-httpclient (2.0.5): Loading from cache
  - Installing yiisoft/yii2-authclient (2.1.4): Loading from cache
  - Installing toruinteractive/ti-tree (0.13.1): Cloning 867ff3625c from cache
  - Installing toruinteractive/ti-translator (0.13.1): Cloning eec41060e4 from cache
  - Installing toruinteractive/ti-superadmin (0.13.1): Cloning a783cd0bb9 from cache
  - Installing toruinteractive/ti-suggest (0.13.1): Cloning b52895d1ab from cache
  - Installing toruinteractive/ti-slides (0.13.1): Cloning e0a5f9738f from cache
  - Installing toruinteractive/ti-search (0.13.1): Cloning a2e1f8ac89 from cache
  - Installing toruinteractive/ti-page (0.13.1): Cloning 9b3653a648 from cache
  - Installing toruinteractive/ti-navbar (0.13.1): Cloning 711fe81e0a from cache
  - Installing toruinteractive/ti-login (0.13.1): Cloning e7f64c010b from cache
  - Installing imagine/imagine (v0.6.3): Loading from cache
  - Installing flowjs/flow-php-server (v1.0.3): Loading from cache
  - Installing toruinteractive/ti-image (0.13.1): Cloning 5089e00de0 from cache
  - Installing toruinteractive/ti-file (0.13.1): Cloning 68ec65c025 from cache
  - Installing arogachev/yii2-excel (0.1.1): Loading from cache
  - Installing toruinteractive/ti-export-import (0.13.1): Cloning cd8309c01d from cache
  - Installing toruinteractive/ti-dashboard (0.13.1): Cloning ccb9d159e4 from cache
  - Installing toruinteractive/ti-blog (0.13.1): Cloning e0d3296d01 from cache
  - Installing toruinteractive/ti-banner (0.13.1): Cloning cadf895998 from cache
  - Installing sentry/sentry (0.17.0): Loading from cache
  - Installing ramsey/uuid (3.7.1): Loading from cache
  - Installing mandrill/mandrill (1.0.55): Loading from cache
  - Installing fightbulc/moment (1.26.10): Loading from cache
  - Installing dompdf/dompdf (v0.7.0): Loading from cache
  - Installing toruinteractive/ti-cms (0.13.1): Cloning 6fd9d9fe53 from cache
  - Installing yiisoft/yii2-debug (dev-master b2cd366): Loading from cache
Generating autoload files

因此,我的问题是,如何使我自己的包‘加载’从缓存,以加快我的安装过程?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-11-18 16:26:38

我认为这只是git和准备好的包之间的区别,即克隆git与dist(zip/tar)文件。缓存后,只需解压缩zip文件,您就完成了。

对于git来说,克隆是一种需要更多时间的操作,很可能是通过网络来确保缓存的回购仍然是最新的,然后执行实际的缓存回购到工作目录克隆。

如果希望从缓存加载自己的包,请尝试以dist (zip/tar)格式分发它们。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47330302

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档