Stratego
-
5/27/2011 4:19:39 AM
RE:Caching CSS and html files by the client browser
Thank you for the reply Boris.
I had already read that blog and all the Kentico documentation.
The site is on Kentico CMS 5.5 R2.
I already had full page caching set to 60 mins using CMS Desk -> Content -> Properties -> General -> Cache.
I also already had CMS Site Manager -> Settings at a Global level with inheritance in the web site - Cache content = 60 mins - Cache images = 60 mins - Cache page info = 60 mins
and had the radio buttons checked in Site Manager -> Settings -> Files for the three check boxes Store files in file system, Store files in database and Generate thumbnails.
Despite all those settings, according to Firebug every time I request a page the html and CSS files get reloaded.
As an experiment I put all the above settings back to empty and got exactly the same result. (Tomorrow I will check using Site24x7.com as to whether the site is running slower as a result.)
I am certain that all the caching settings make no difference as to whether the HTML and CSS files are read from cache. No matter whether I have cache settings or not, these two files are reloaded each time and never come from cache. And no matter whether I have cache settings or not, all other files requests except Google Analytics come from cache after the first page load.
This is the header with all caching turned off….
Cache-Control private, no-store, must-revalidate Content-Type text/html; charset=utf-8 Server Microsoft-IIS/7.0 X-AspNet-Version 4.0.30319 X-Powered-By ASP.NET Date Fri, 27 May 2011 08:27:43 GMT Content-Length 22216 Request Headersview source Host www.sinclairblack.co.nz User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17 ( .NET CLR 3.5.30729; .NET4.0E) Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language en-us,en;q=0.5 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 115 Referer http://www.sinclairblack.co.nz/Home Cookie CMSPreferredCulture=en-NZ; CMSPreferredUICulture=en-nz; __utma=102601219.2040435124.1305774152.1306481866.1306484598.15; __utmz=102601219.1306112822.8.5.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=media%20law%20auckland; VisitorStatus=2; ViewMode=0; PropertyTab=0; ASP.NET_SessionId=4gfz4vmgijxlqxbwfvslrwqm; CurrentVisitStatus=2; CurrentTheme=SinclairBlackV3CrossV2; __utmc=102601219; .ASPXFORMSAUTH=DC12FC3E8B65F06BC88D987830E399DC97DF2DC6DB9767BE3BA4DBB84DC6E9EEE67676E01E747BCDA5716E048C6C3F10666D166402D9028F61BA3A5D4368C71DC4F1AC58D48AC458F2BD92C4F00B0F9E2A35F1127D5B719846777A454703FCEA; __utmb=102601219.9.10.1306484598 DNT 1 Connection keep-alive
This is the header with caching set at 60 mins in CMS > Content > Properties > General at the master page level with inheritance at the Home page level (and all the other cache settings empty) …….
Cache-Control private, no-store, must-revalidate Content-Type text/html; charset=utf-8 Server Microsoft-IIS/7.0 X-AspNet-Version 4.0.30319 X-Powered-By ASP.NET Date Fri, 27 May 2011 08:33:44 GMT Content-Length 22216 Request Headersview source Host www.sinclairblack.co.nz User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17 ( .NET CLR 3.5.30729; .NET4.0E) Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language en-us,en;q=0.5 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 115 Referer http://www.sinclairblack.co.nz/Home.aspx Cookie CMSPreferredCulture=en-NZ; CMSPreferredUICulture=en-nz; __utma=102601219.2040435124.1305774152.1306481866.1306484598.15; __utmz=102601219.1306112822.8.5.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=media%20law%20auckland; VisitorStatus=2; ViewMode=0; PropertyTab=0; ASP.NET_SessionId=4gfz4vmgijxlqxbwfvslrwqm; CurrentVisitStatus=2; CurrentTheme=SinclairBlackV3CrossV2; __utmc=102601219; .ASPXFORMSAUTH=DC12FC3E8B65F06BC88D987830E399DC97DF2DC6DB9767BE3BA4DBB84DC6E9EEE67676E01E747BCDA5716E048C6C3F10666D166402D9028F61BA3A5D4368C71DC4F1AC58D48AC458F2BD92C4F00B0F9E2A35F1127D5B719846777A454703FCEA; __utmb=102601219.13.10.1306484598 DNT 1 Connection keep-alive
This is the header with caching set at 60 mins in CMS > Content > Properties > General at the Home page level (and all the other cache settings empty) …….
Cache-Control no-cache, must-revalidate Pragma no-cache Expires -1 Server Microsoft-IIS/7.0 X-Powered-By ASP.NET Date Fri, 27 May 2011 08:43:49 GMT Content-Length 22216 X-Antivirus avast! 4 X-Antivirus-Status Clean Request Headersview source Host www.sinclairblack.co.nz User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17 ( .NET CLR 3.5.30729; .NET4.0E) Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language en-us,en;q=0.5 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 115 Referer http://www.sinclairblack.co.nz/Home Cookie CMSPreferredCulture=en-NZ; CMSPreferredUICulture=en-nz; __utma=102601219.2040435124.1305774152.1306481866.1306484598.15; __utmz=102601219.1306112822.8.5.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=media%20law%20auckland; VisitorStatus=2; ViewMode=0; PropertyTab=0; ASP.NET_SessionId=4gfz4vmgijxlqxbwfvslrwqm; CurrentVisitStatus=2; CurrentTheme=SinclairBlackV3CrossV2; __utmc=102601219; .ASPXFORMSAUTH=DC12FC3E8B65F06BC88D987830E399DC97DF2DC6DB9767BE3BA4DBB84DC6E9EEE67676E01E747BCDA5716E048C6C3F10666D166402D9028F61BA3A5D4368C71DC4F1AC58D48AC458F2BD92C4F00B0F9E2A35F1127D5B719846777A454703FCEA; __utmb=102601219.15.10.1306484598 DNT 1 Connection keep-alive
Web.config has these appSettings…. <appSettings> <add key="CMSProgrammingLanguage" value="C#" /> <add key="WS.webservice" value="http://localhost/WebService/webservice.asmx" /> <add key="CMSTrialKey" value="CU05-20110507-fCbv8J" /> <add key="CMSDebugCache" value="true"/>
<add key="CMSDebugCacheLive" value="true"/>
<add key="CMSDebugCacheLogLength" value="10"/>
<add key="CMSLogCache" value="true" />
<!-- <add key="CMSFullClientCache" value="true"/> -->
</appSettings>
The behaviour reported by Firebug is no different with or without the CMSFullClientCache entry.
It seems to me that setting the caching has the advantage that the page is not regenerated by the server within the defined cache period (and is instead served from the server cache) but it makes no difference as to whether the browser reloads the HTML and CSS from the server or its local cache. These two files have never been retrieved from the local cache for me in the testing I have done - according to Firebug.
Thank you once again
|