HttpRequestCachePolicy.MinFresh 属性

定义

获取从缓存返回的资源所允许的最小新鲜值。

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

属性值

一个 TimeSpan 值,它指定创建此实例时指定的最小新鲜值。 如果未指定日期,则此属性的值为 DateTime.MinValue

示例

下面的代码示例演示如何显示此属性的值。

static HttpRequestCachePolicy^ CreateMinFreshPolicy( TimeSpan span )
{
   HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpCacheAgeControl::MinFresh,span );
   Console::WriteLine( L"Minimum freshness {0}", policy->MinFresh );
   return policy;
}
public static HttpRequestCachePolicy CreateMinFreshPolicy(TimeSpan span)
{
    HttpRequestCachePolicy policy =
        new HttpRequestCachePolicy(HttpCacheAgeControl.MinFresh, span);
    Console.WriteLine("Minimum freshness {0}", policy.MinFresh.ToString());
    return policy;
}

注解

此值指定内容过期前的时间量,在此期间,资源的缓存副本是可接受的。 构造实例时指定此属性的值。

适用于