一,optimize创建的文件在哪里?
执行optimize:
$ php artisan optimize
INFO Caching framework bootstrap, configuration, and metadata.
config ................................................................ 57.67ms DONE
events ................................................................ 4.73ms DONE
routes ................................................................ 71.55ms DONE
views ................................................................. 50.69ms DONE
可以看到optimize处理了四类缓存: config/events/routes/views
查看目录:
$ ls bootstrap/cache/
config.php events.php packages.php routes-v7.php services.php
二,cache与clear
缓存命令:
php artisan config:cache
上面命令会生成文件 bootstrap/cache/config.php,
用以下命令来取消配置信息缓存:
php artisan config:clear
此命令做的事情就是把 bootstrap/cache/config.php 文件删除。
其他三项的操作与之相同:
route(路由信息)
event (事件信息)
view (视图信息)
三,统一的优化命令:
optimize命令:
$ php artisan optimize
会生成 bootstrap/cache/packages.php 和 bootstrap/cache/services.php 两个文件
清除生成的两个文件:
$ php artisan clear-compiled
INFO Compiled services and packages files removed successfully.
四,清除所有缓存:
$ ls bootstrap/cache/
config.php events.php packages.php routes-v7.php services.php
$ php artisan config:clear
INFO Configuration cache cleared successfully.
$ php artisan event:clear
INFO Cached events cleared successfully.
$ php artisan route:clear
INFO Route cache cleared successfully.
$ ls bootstrap/cache/
packages.php services.php
$ php artisan clear-compiled
INFO Compiled services and packages files removed successfully.
$ ls bootstrap/cache/
五,php artisan package:discover也会生成packages.php和services.php两个文件
$ ls bootstrap/cache/
$ php artisan package:discover
INFO Discovering packages.
laravel/sail ................................................................................................................................ DONE
laravel/sanctum ............................................................................................................................. DONE
laravel/tinker .............................................................................................................................. DONE
laravel/ui .................................................................................................................................. DONE
nesbot/carbon ............................................................................................................................... DONE
nunomaduro/collision ........................................................................................................................ DONE
nunomaduro/termwind ......................................................................................................................... DONE
$ ls bootstrap/cache/
packages.php services.php
标签:laravel,bootstrap,clear,cache,laravel11,artisan,packages,DONE,php From: https://www.cnblogs.com/architectforest/p/18531980