Table of Contents

Class DefaultViewLocationCache

Namespace
System.Web.Mvc
Assembly
System.Web.Mvc.dll

Represents a memory cache for view locations.

public class DefaultViewLocationCache : IViewLocationCache
Inheritance
DefaultViewLocationCache
Implements
Inherited Members

Constructors

DefaultViewLocationCache()

Initializes a new instance of the DefaultViewLocationCache class.

public DefaultViewLocationCache()

DefaultViewLocationCache(TimeSpan)

Initializes a new instance of the DefaultViewLocationCache class by using the specified cache time span.

public DefaultViewLocationCache(TimeSpan timeSpan)

Parameters

timeSpan TimeSpan

The cache time span.

Exceptions

InvalidOperationException

The Ticks attribute of the timeSpan parameter is set to a negative number.

Fields

Null

Creates an empty view location cache.

public static readonly IViewLocationCache Null

Field Value

IViewLocationCache

Properties

TimeSpan

Gets or sets the cache time span.

public TimeSpan TimeSpan { get; }

Property Value

TimeSpan

The cache time span.

Methods

GetViewLocation(HttpContextBase, string)

Retrieves the default view location by using the specified HTTP context and cache key.

public string GetViewLocation(HttpContextBase httpContext, string key)

Parameters

httpContext HttpContextBase

The HTTP context.

key string

The cache key

Returns

string

The default view location.

Exceptions

ArgumentNullException

The httpContext parameter is null.

InsertViewLocation(HttpContextBase, string, string)

Inserts the view in the specified virtual path by using the specified HTTP context, cache key, and virtual path.

public void InsertViewLocation(HttpContextBase httpContext, string key, string virtualPath)

Parameters

httpContext HttpContextBase

The HTTP context.

key string

The cache key.

virtualPath string

The virtual path

Exceptions

ArgumentNullException

The httpContext parameter is null.