protected function validateCache($lastModified, $etag)
    {
        $request = Yii::getApp()->getRequest();
        if ($request->hasHeader('if-none-match')) {
            // 'if-none-match' takes precedence over 'if-modified-since'
            // http://tools.ietf.org/html/rfc7232#section-3.3
            return $etag !== null && in_array($etag, Yii::getApp()->request->getETags(), true);
        } elseif ($request->hasHeader('if-modified-since')) {
            return $lastModified !== null && @strtotime($request->getHeaderLine('if-modified-since')) >= $lastModified;
        }

        return false;
    }
protected function validateCache($lastModified, $etag)
    {
        $request = Yii::getApp()->getRequest();
        if ($request->hasHeader('if-none-match')) {
            // 'if-none-match' takes precedence over 'if-modified-since'
            // http://tools.ietf.org/html/rfc7232#section-3.3
            return $etag !== null && in_array($etag, Yii::getApp()->request->getETags(), true);
        } elseif ($request->hasHeader('if-modified-since')) {
            return $lastModified !== null && @strtotime($request->getHeaderLine('if-modified-since')) >= $lastModified;
        }

        return false;
    }
protected function validateCache ( $ lastModified , $ etag ) { $ request = Yii :: getApp ( ) -> getRequest ( ) ; if ( $ request -> hasHeader ( 'if-none-match' ) ) { // 'if-none-match' takes precedence over 'if-modified-since' // http://tools.ietf.org/html/rfc7232#section-3.3 return $ etag !== null && in_array ( $ etag , Yii :: getApp ( ) -> request -> getETags ( ) , true ) ; } elseif ( $ request -> hasHeader ( 'if-modified-since' ) ) { return $ lastModified !== null && @ strtotime ( $ request -> getHeaderLine ( 'if-modified-since' ) ) >= $ lastModified ; } return false ; }
Validates if the HTTP cache contains valid content.
If both Last-Modified and ETag are null, returns false.
@param int $lastModified the calculated Last-Modified value in terms of a UNIX timestamp.
If null, the Last-Modified header will not be validated.
@param string $etag the calculated ETag value. If null, the ETag header will not be validated.
@return bool whether the HTTP cache is still valid.
Validates if the HTTP cache contains valid content . If both Last - Modified and ETag are null returns false .