将HTTP缓存添加到slim 3

I have a route :

$app->get('/api/home',['\App\Controllers\HomepageController','getAllCards']);

In my App.php file, I have registered the service provider as:

$dependencies = [ 'cache' => function(Container $container) {
                   return new \Slim\HttpCache\CacheProvider();
                   },
                ];

In my index.php file:

$app = new \App\App;
$container = $app->getContainer();
$app->add(new \Slim\HttpCache\Cache('public', 86400));

How do I add the cache with headers like CacheControl,Etag,expires,etc in the above route?