5
Symfony 2でESIで検証キャッシュを使用することは可能ですか?Edge Side Symfony 2のインクルードと検証キャッシュ
あなたがHttpFoundation Responseクラスを見れば、あなたはisNotModifiedがどのように動作するかを見ることができます:
/**
* Determines if the Response validators (ETag, Last-Modified) match
* a conditional value specified in the Request.
*
* If the Response is not modified, it sets the status code to 304 and
* removes the actual content by calling the setNotModified() method.
*
* @param Request $request A Request instance
*
* @return Boolean true if the Response validators match the Request, false otherwise
*
* @api
*/
public function isNotModified(Request $request)
{
$lastModified = $request->headers->get('If-Modified-Since');
$notModified = false;
if ($etags = $request->getEtags()) {
$notModified = (in_array($this->getEtag(), $etags) || in_array('*', $etags)) && (!$lastModified || $this->headers->get('Last-Modified') == $lastModified);
} elseif ($lastModified) {
$notModified = $lastModified == $this->headers->get('Last-Modified');
}
if ($notModified) {
$this->setNotModified();
}
return $notModified;
}
問題はESI $要求 - >ヘッダなど>( '変更された場合は、-ので')を得るということです。 $ request-> getEtags()はESIに何も返さないので、キャッシュは決して新鮮ではありません!
$リクエストの解決策はありますか?
ESIで検証HTTPキャッシュが機能しない場合は、その部分をキャッシュする別の方法がありますか?
ありがとうございました!
はい、期限切れキャッシュでこれは本当に簡単ですし、動作します!しかし、それは検証キャッシュを使用すると動作していないようです...だから私はそれをデバッグしようとしたが、それは可能ではないようだ... – Sybio