简体   繁体   中英

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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM