The optimize command in Laravel just runs config:cache and route:cache. When the cached files exist Laravel use them instead of loading up config and routes. By the way in a Laravel app the cached config and routes lives in the ./bootstrap/cache directory.
Lumen does not even look for cached config or routes files, as you can see here:
- https://github.com/laravel/lumen/blob/54044ce32aa7bb78bf1ca3d780fb954a2f0eec63/bootstrap/app.php#L109-L113
- https://github.com/laravel/lumen-framework/blob/1b05a57a038866d1db10631dc2e5e3f5491cdf09/src/Application.php#L677-L690
Neither Lumen has a ./bootstrap/cache directory.