OutputCacheProfile.Duration 属性

定义

获取或设置缓存页或缓存控件过程的持续时间。

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

属性值

Int32

以秒为单位的持续时间。

属性

示例

下面的代码示例说明如何使用 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页面指令中定义该配置文件。

适用于

另请参阅