แก้ไข

แชร์ผ่าน


HttpRequestCachePolicy.MaxStale Property

Definition

Gets the maximum staleness value that is permitted for a resource returned from the cache.

public:
 property TimeSpan MaxStale { TimeSpan get(); };
public TimeSpan MaxStale { get; }
member this.MaxStale : TimeSpan
Public ReadOnly Property MaxStale As TimeSpan

Property Value

A TimeSpan value that is set to the maximum staleness value specified when this instance was created. If no date was specified, this property's value is DateTime.MinValue.

Examples

The following code example demonstrates displaying the value of this property.

static HttpRequestCachePolicy^ CreateMaxStalePolicy( TimeSpan span )
{
   HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpCacheAgeControl::MaxStale,span );
   Console::WriteLine( L"Max stale is {0}", policy->MaxStale );
   return policy;
}
public static HttpRequestCachePolicy CreateMaxStalePolicy(TimeSpan span)
{
    HttpRequestCachePolicy policy =
        new HttpRequestCachePolicy(HttpCacheAgeControl.MaxStale, span);

   Console.WriteLine("Max stale is {0}", policy.MaxStale);
    return policy;
}

Remarks

This property specifies the amount of time after content expiration during which the cached copy of the resource is acceptable. The value for this property is specified when the instance is constructed.

Applies to