WebCache.Set(String, Object, Int32, Boolean) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
插入項目至 WebCache 物件。
public static void Set (string key, object value, int minutesToCache = 20, bool slidingExpiration = true);
static member Set : string * obj * int * bool -> unit
Public Shared Sub Set (key As String, value As Object, Optional minutesToCache As Integer = 20, Optional slidingExpiration As Boolean = true)
參數
- key
- String
快取項目的識別項。
- value
- Object
要插入至快取的資料。
- minutesToCache
- Int32
選擇性。 將項目保留在快取中的分鐘數。 預設值為 20。
- slidingExpiration
- Boolean
選擇性。 true 表示每次存取專案時都會重設快取專案到期,否則為 false,表示到期是以專案新增至快取以來的絕對時間為基礎。 預設值是 true。 在此情況下,如果您也使用 參數的 minutesToCache
預設值,快取的專案會在上次存取後 20 分鐘到期。
例外狀況
滑動到期已啟用,且 的值 minutesToCache
大於一年。