HttpRequestCachePolicy.MinFresh 属性
定义
获取从缓存返回的资源所允许的最小新鲜值。Gets the minimum freshness that is permitted for a resource returned from the cache.
public:
property TimeSpan MinFresh { TimeSpan get(); };
public TimeSpan MinFresh { get; }
member this.MinFresh : TimeSpan
Public ReadOnly Property MinFresh As TimeSpan
属性值
一个 TimeSpan 值,它指定创建此实例时指定的最小新鲜值。A TimeSpan value that specifies the minimum freshness specified when this instance was created. 如果未指定日期,此属性的值则为 MinValue。If no date was specified, this property's value is MinValue.
示例
下面的代码示例演示如何显示此属性的值。The following code example demonstrates displaying the value of this property.
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;
}
注解
此值指定内容过期之前的时间长度,在此期间,资源的缓存副本是可接受的。This value specifies the amount of time before content expiration, during which the cached copy of the resource is acceptable. 此属性的值是在构造实例时指定的。The value for this property is specified when the instance is constructed.