We help IT Professionals succeed at work.

mvc cache

ITsolutionWizard
on
I have the following codes in layout page in MVC project.
And I want to use mvc cache. e.g. within 8 hours using the cache. Is it possible?


<li>
                                            <span><a href="#"><i class="icon-bus"></i> Class A</a></span>
                                            <ul>
                                                @foreach (Domain.Fleet fHostAdmin in rv.FleetActiveList(locationName))
                                                {
                                                    if (fHostAdmin.FleetClassType.Substring(0, 1) == classAString)
                                                    {
                                                        <li><a href="@DomainHelper.Generic.GethttpType(Request.ServerVariables["HTTPS"], HttpContext.Current.Request.Url.Authority)/Home/Detail/@fHostAdmin.QuickFindKeyWord?fleetID=@fHostAdmin.Oid"><i class="icon-check"></i> <b>@fHostAdmin.FleetClassType</b>: @fHostAdmin.FleetName <label style="color:red;">(@fHostAdmin.FleetBaseRatePricingLabel)</label> </a></li>
                                                    }
                                                }
                                            </ul>

                                        </li>

Open in new window

Comment
Watch Question

Author

Commented:
any one helps?
Architect - Coder - Mentor
Commented:

Hi,

What exactly do you want to cache?

In ASP.NET MVC you can use the OutputCacheAttribute applied at controller or action level

[OutputCache(Duration = 28800)]


https://docs.microsoft.com/en-us/dotnet/api/system.web.mvc.outputcacheattribute?view=aspnet-mvc-5.2