Caching


Web.config

Adding server cache profiles for image. Probably add a lot higher number than 1 day! Images often do not change.

<system.webserver>
<caching>
      <profiles>
        <add extension=".gif" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="1.00:00:00" location="Any" />
        <add extension=".png" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="1.00:00:00" location="Any" />
        <add extension=".js" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="1.00:00:00" location="Any" />
        <add extension=".css" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="1.00:00:00" location="Any" />
        <add extension=".jpg" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="1.00:00:00" location="Any" />
        <add extension=".jpeg" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="1.00:00:00" location="Any" />
      </profiles>
    </caching>
</system.webserver>

 

Adding output cache for gzip: 

<caching>
     <outputCache enableOutputCache="true" />
      <outputCacheSettings>
        <outputCacheProfiles>
          <add name="ClientResourceCache" enabled="true" duration="3600" varyByParam="*" varyByContentEncoding="gzip;deflate" />
        </outputCacheProfiles>
      </outputCacheSettings>
</caching>

 


Published: 2016-08-24