OutputCacheProfile.Duration 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置缓存页或缓存控件过程的持续时间。
public:
property int Duration { int get(); void set(int value); };
[System.Configuration.ConfigurationProperty("duration", DefaultValue=-1)]
public int Duration { get; set; }
[<System.Configuration.ConfigurationProperty("duration", DefaultValue=-1)>]
member this.Duration : int with get, set
Public Property Duration As Integer
属性值
以秒为单位的持续时间。
- 属性
示例
下面的代码示例说明如何使用 Duration 属性。
// Get the current Duration.
Int32 durationValue =
outputCacheProfile.Duration;
// Set the Duration property to 0.
outputCacheProfile.Duration = 0;
' Get the current Duration.
Dim durationValue As Int32 = _
outputCacheProfile.Duration
' Set the Duration.
outputCacheProfile.Duration = 0
注解
表示 Duration 缓存页面或用户控件的时间(以秒为单位)。 设置此属性将为应用该属性的页或控件中的 HTTP 响应建立过期策略,并自动导致其输出的缓存。
备注
Duration必须使用配置文件在配置文件或@ OutputCache
页面指令中定义该配置文件。