Muokkaa

Jaa


HttpCacheAgeControl Enum

Definition

Specifies the meaning of time values that control caching behavior for resources obtained using HttpWebRequest objects.

public enum class HttpCacheAgeControl
public enum HttpCacheAgeControl
type HttpCacheAgeControl = 
Public Enum HttpCacheAgeControl
Inheritance
HttpCacheAgeControl

Fields

Name Value Description
None 0

For internal use only. The Framework will throw an ArgumentException if you try to use this member.

MinFresh 1

Content can be taken from the cache if the time remaining before expiration is greater than or equal to the time specified with this value.

MaxAge 2

Content can be taken from the cache until it is older than the age specified with this value.

MaxAgeAndMinFresh 3

MaxAge and MinFresh.

MaxStale 4

Content can be taken from the cache after it has expired, until the time specified with this value elapses.

MaxAgeAndMaxStale 6

MaxAge and MaxStale.

Examples

The following code example creates a policy based on 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;
}

Remarks

This enumeration is used by members of the HttpRequestCachePolicy class to configure the time values for cache policies.

Applies to

See also