private function fetchCachedStat(string $reqPath, Request $request)
{
// We specifically allow users to bypass cached representations in debug mode by
// using their browser's "force refresh" functionality. This lets us avoid the
// annoyance of stale file representations being served for a few seconds after
// changes have been written to disk.
if (empty($this->debug)) {
return $this->cache[$reqPath] ?? null;
}
foreach ($request->getHeaderArray("Cache-Control") as $value) {
if (strcasecmp($value, "no-cache") === 0) {
return null;
}
}
foreach ($request->getHeaderArray("Pragma") as $value) {
if (strcasecmp($value, "no-cache") === 0) {
return null;
}
}
return $this->cache[$reqPath] ?? null;
}