Sunday, December 13, 2015

Enable static caching in web.config

Why do we need static caching?


Contents like css, javascript which are static would be stored in browser memory for future processing. which would yield enormous performance improvements 

Advantages of specifying in web.config

  •  If we are on shared hosting and can't configure IIS directly
  •  want our config to carry between all environments we target.

CacheControlMaxAge : is the time interval the content would be cached. In the example below the static content would be cached for an year

<system.webServer>
    <staticContent >
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00"/>
    </staticContent>
   </system.webServer>

Performance report before caching








Peformance report after caching





Note: The primed cache size reduced to 1k from 13.8 k , Score increased by 4 points ( 94 to 97)

No comments:

Post a Comment