osdd:cache
OSDD discovers the layers by scanning the folders of osdd.layers.paths, once per process. In production, cache the result so a request never scans the folders.
php artisan osdd:cache # also run by php artisan optimize
php artisan osdd:clear # also run by php artisan optimize:clear
osdd:cache
osdd:cache discovers the layers and writes them to bootstrap/cache/osdd.php:
INFO 3 layers cached successfully.
While the file exists, every process reads the layers from it: commands, Tinker, about, the generators and the view, translation and component namespaces of the layer providers.
It fails with exit code 1, and writes no cache, while a layer composer.json is invalid:
Invalid layer manifest [functional/orders/composer.json]: it has no "name".
osdd:clear
osdd:clear deletes bootstrap/cache/osdd.php:
INFO Layer cache cleared successfully.
With optimize
php artisan optimize runs osdd:cache as its osdd task, and php artisan optimize:clear runs osdd:clear. A deployment that already runs optimize has nothing to add. Skip the task with:
php artisan optimize --except=osdd
When the cache is refreshed
You rarely need to run the commands by hand:
osdd:layer,osdd:start,osdd:providerandosdd:removerewrite an existing cache;- Composer does too, through
php artisan package:discover, which runs after everycomposer installorcomposer update; - a cache built for other
osdd.layers.pathsis ignored.
None of them creates a cache that does not exist.
php artisan osdd:cache again, or php artisan osdd:clear, as with event:cache.See Production for every cache optimize builds for the layers.