HttpCacheAgeControl 列舉

定義

指定時間值的意義,該值控制使用 HttpWebRequest 物件取得之資源的快取行為。

public enum class HttpCacheAgeControl
public enum HttpCacheAgeControl
type HttpCacheAgeControl = 
Public Enum HttpCacheAgeControl
繼承
HttpCacheAgeControl

欄位

MaxAge 2

可以從快取獲得內容,直到它超過這個值指定的保留期限為止。

MaxAgeAndMaxStale 6

MaxAgeMaxStale

MaxAgeAndMinFresh 3

MaxAgeMinFresh

MaxStale 4

內容到期後仍可從快取獲得,直到超過使用這個值指定的時間為止。

MinFresh 1

如果到期前剩餘的時間大於或等於使用這個值指定的時間,則可以從快取獲得內容。

None 0

僅供內部使用。 如果您使用這個成員,Framework 將會擲回 ArgumentException

範例

下列程式碼範例會根據 MaxAgeAndMinFresh 建立原則。

static HttpRequestCachePolicy^ CreateFreshAndAgePolicy( TimeSpan freshMinimum, TimeSpan ageMaximum )
{
   HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpCacheAgeControl::MaxAgeAndMinFresh,
       ageMaximum, freshMinimum );
   Console::WriteLine( policy );
   return policy;
}
public static HttpRequestCachePolicy CreateFreshAndAgePolicy(TimeSpan freshMinimum, TimeSpan ageMaximum)
{
    HttpRequestCachePolicy policy =
        new HttpRequestCachePolicy(HttpCacheAgeControl.MaxAgeAndMinFresh, ageMaximum, freshMinimum);
    Console.WriteLine(policy.ToString());
    return policy;
}

備註

類別的成員 HttpRequestCachePolicy 會使用此列舉來設定快取原則的時間值。

適用於

另請參閱