nowiko
nowiko

Reputation: 2557

Http caching in Symfony2

I try to use standart AppCache in Symfony2 to make a gateway caching. The question is the each of theese three ways define when the proxy need to run server script because cache invalid for some reason, and I can use only single of them ?

$response->setETag($article->computeETag()); // 1
$response->setLastModified($article->getPublishedAt()); //2
$response->setMaxAge(600); //3

I read the doc, but for now it little confused me. Thnaks!

Upvotes: 0

Views: 50

Answers (1)

Johni
Johni

Reputation: 2959

Max age requires last modified.

The ETag is independent of the other two and is a unique identifiert of your page data, so the browser/proxy has a way to check if your content has changed. So it only loads the data from the server if there is a different ETag

Upvotes: 1

Related Questions