Search code examples
csscachinghttp-caching

Are entire websites automatically cached (Google using <style>)?


I've heard of stylesheets being cached, but are regular pages (like the one we're on) cached? I noticed on the more recent websites Google has made, they are not even using stylesheets, just a <style> tag with a single, compressed line of CSS. This led me to believe that the entire page (including the <style>) is cached, and not just stylesheets. Am I correct on this? Why would Google not use stylesheets and want their CSS to be cached when their sites are viewed billions of times a month.

From my understanding, everything that appears in the "Network Panel" of Chrome's inspect element is cached?

I researched "PHP Caching" but that seems to be for include's, so I'm guessing pages are already cached automatically.


Solution

  • Check this post: CACHING TUTORIAL.

    Use <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> tag in your <head/> section. Use headers in your PHP code:

    <?php
     Header("Cache-Control: must-revalidate");
     $offset = 60 * 60 * 24 * 3;
     $ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
     Header($ExpStr);
    ?>