You don't have to do this at all. Vapor is handling all of this for you.
For example, caching your config won't make sense since Vapor controls your environment variables. If you cache your config, the env variables won't be loaded anymore. Either this is not done, or automatically done by Vapor.
For route caching and view caching I'm not sure. I expect that Vapor is doing this automatically for you on each deployment.
If you want to control your caches I would highly recommend storing it in Redis for example. This way you can still get access or clear it by yourself without having to deploy on Vapor.
I am 95% certain that Vapor is NOT caching routes or the configuration files as part of a deployment. I know this because I had 4 or 5 routes that were defined as closures. In the documentation it is said that all routes must be defined using classes. If you try to cache your routes while using closures the process will throw a fatal error.
Just to be clear, Laravel Vapor will cache your config. It will not cache your routes, events or views. You can see the config:cache command in your Lambda logs being called. It will say 'Caching laravel configuration'. You can find this code in the fpmRuntime.php and cliRuntime and octaneRuntime.php files in the vapor-core repo.
<?php
namespace Laravel\VaporCli\BuildProcess;
use Illuminate\Support\Str;
use Laravel\VaporCli\Helpers;
use Laravel\VaporCli\Manifest;
use Symfony\Component\Process\Process;
class ExecuteBuildCommands
{
use ParticipatesInBuildProcess;
/**
* @var array<int, string>
*/
protected $unsupportedCommands = [
'clear-compiled',
'optimize:clear',
'route:cache',
];
I’ve added config:cache to my deploy hook and I have, without exaggeration, noticed a substantial performance increase. Each request is much snappier responding.