how can use server side caching in mvc ?

Total Post:46

Points:324

 328  View(s)
Ratings:
Rate this:

example is required 

  1. Re: how can use server side caching in mvc ?

    If we want to use cache for static contents, then we have to define a few configurations in our application's Web.Config file as below. Here you can see, we have defined the file extension with mime type which needs to be cache. To defining age of caching time, we use "cacheControlMaxAge" attribute from "clientCache" and define the time here. For this demonstration, we have used 1 minute.

    <system.webServer>
    
        <staticContent>
          <clear/>
          <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="00:01:00" />
          <mimeMap fileExtension=".jpg" mimeType="image/jpg"/>
          <mimeMap fileExtension=".png" mimeType="image/jpg"/>
          <mimeMap fileExtension=".css" mimeType="text/css"/>
          <mimeMap fileExtension=".js" mimeType="text/javascript"/>
        </staticContent>
        <validation validateIntegratedModeConfiguration="false" />
        <modules>
          <remove name="ApplicationInsightsWebTracking" />
          <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
        </modules>
    </system.webServer>

    For more information, please follow the given below links :

    https://www.mindstick.com/articles/126234/caching-concept-in-asp-dot-net-mvc

      Modified On Jul-06-2019 03:56:37 AM

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.