Ejemplo n.º 1
0
 /**
  * Checks if content has changed by the etag cachekey.
  *
  * HTTP_IF_NONE_MATCH feature
  *
  * @param string $cacheKey HTTP Cachekey to identify the cache
  */
 public static function sendEtag($cacheKey)
 {
     // Laut HTTP Spec muss der Etag in " sein
     $cacheKey = '"' . $cacheKey . '"';
     // Sende CacheKey als ETag
     header('ETag: ' . $cacheKey);
     // CacheKey gefunden
     // => den Browser anweisen, den Cache zu verwenden
     if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $cacheKey) {
         self::cleanOutputBuffers();
         header('HTTP/1.1 ' . self::HTTP_NOT_MODIFIED);
         exit;
     }
     self::$sentEtag = true;
 }