Sunday, January 19, 2014

How long the view location will be cached in MVC?

The default cache is 15min.

we can extend this using follwing code in Global.asax


var viewEngine = new RazorViewEngine
                         {ViewLocationCache = new DefaultViewLocationCache(TimeSpan.FromHours(24))};
    ViewEngines.Engines.Clear();
    ViewEngines.Engines.Add(viewEngine);