Share via


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 指示詞中定義 。

適用於

另請參閱