Skip to content

Commit

Permalink
Set CustomTtlListener cache life time
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed Jul 22, 2024
1 parent f09b49a commit cfe0a4a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/Functional/Fixtures/Symfony/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace FOS\HttpCache\Tests\Functional\Fixtures\Symfony;

use FOS\HttpCache\SymfonyCache\CustomTtlListener;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
Expand All @@ -31,25 +32,29 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ
case '/cache':
$response = new Response(microtime(true));
$response->setCache(['max_age' => 3600, 'public' => true]);
$response->headers->set('X-Reverse-Proxy-TTL', '3600');

return $response;
case '/tags':
$response = new Response(microtime(true));
$response->setCache(['max_age' => 3600, 'public' => true]);
$response->headers->set('X-Cache-Tags', 'tag1,tag2');
$response->headers->set('X-Reverse-Proxy-TTL', '3600');

return $response;
case '/tags_multi_header':
$response = new Response(microtime(true));
$response->setCache(['max_age' => 3600, 'public' => true]);
$response->headers->set('X-Cache-Tags', ['tag1', 'tag2']);
$response->headers->set('X-Reverse-Proxy-TTL', '3600');

return $response;
case '/negotiation':
$response = new Response(microtime(true));
$response->setCache(['max_age' => 3600, 'public' => true]);
$response->headers->set('Content-Type', $request->headers->get('Accept'));
$response->setVary('Accept');
$response->headers->set('X-Reverse-Proxy-TTL', '3600');

return $response;
}
Expand Down

0 comments on commit cfe0a4a

Please sign in to comment.