【发布时间】:2014-04-21 18:05:30
【问题描述】:
我正在使用带有自定义存储库的 PHP 作曲家。由于超出我自己调试能力的原因,composer 正在下载存储库的packages.json每次我运行一个命令。
$ composer.phar --profile -vvv --no-dev --repository-url=http://packages.firegento.com create-project magento-hackathon/magento-composer-installer .
[4.2MB/0.05s] Downloading http://packages.firegento.com/packages.json
[70.6MB/152.18s] Writing /Users/alanstorm/.composer/cache/repo/http---packages.firegento.com/packages.json into cache
...
$ composer.phar --profile -vvv update
[3.7MB/0.01s] Reading ./composer.json
[4.2MB/0.02s] Executing command (CWD): git describe --exact-match --tags
[4.4MB/0.03s] Executing command (CWD): git branch --no-color --no-abbrev -v
[4.5MB/0.05s] Executing command (CWD): hg branch
[4.5MB/0.12s] Executing command (CWD): svn info --xml
[6.6MB/0.17s] Loading composer repositories with package information
[6.8MB/0.19s] Downloading http://packages.firegento.com/packages.json
[73.2MB/125.50s] Writing /Users/alanstorm/.composer/cache/repo/http---packages.firegento.com/packages.json into cache
第一次读取是 152.18s 秒,第二次读取是 125.50s 秒。
这与标准包装师packages.json 的行为背道而驰,作曲家似乎只下载一次,然后从缓存中读取。
如何进一步调试此缓存缺失?我对作曲家的了解不够,无法快速追踪“我需要从缓存中获取它”逻辑的位置,而且我不控制自定义存储库服务器。
另外,我对缓存命中/未命中理论可能完全错误,因此对这种缓慢行为的任何其他想法表示赞赏。
【问题讨论】:
-
your blog post 自己回答了吗?
-
@biship 是的——作曲家不打算缓存那个文件,所以这个问题从一个无效的前提开始。在这个特定的例子中,我们使用 gzip 压缩加快了速度。
标签: php composer-php