HttpCacheAgeControl Enumeration
Collapse the table of content
Expand the table of content

HttpCacheAgeControl Enumeration

 

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

Namespace:   System.Net.Cache
Assembly:  System (in System.dll)

public enum HttpCacheAgeControl

Member nameDescription
MaxAge

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

MaxAgeAndMaxStale
MaxAgeAndMinFresh
MaxStale

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

MinFresh

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.

None

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

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

The following code example creates a policy based on MaxAgeAndMinFresh.

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

.NET Framework
Available since 2.0
Return to top
Show:
© 2016 Microsoft