CacheSyncDate Property
Collapse the table of content
Expand the table of content

HttpRequestCachePolicy.CacheSyncDate Property

 

Gets the cache synchronization date for this instance.

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

public DateTime CacheSyncDate { get; }

Property Value

Type: System.DateTime

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

The cache synchronization date allows you to specify an absolute date when cached contents must be revalidated. If the cache entry was last revalidated prior to the cache synchronization date, revalidation with the server occurs. If the cache entry was revalidated after the cache synchronization date and there are no server revalidation requirements that make the cached entry invalid, the entry from the cache is used. If the cache synchronization date is set to a future date, the entry is revalidated every time it is requested, until the cache synchronization date passes.

The following code example displays the value of this property.

public static HttpRequestCachePolicy CreateLastSyncPolicy(DateTime when)
{
    HttpRequestCachePolicy policy = 
       new HttpRequestCachePolicy(when);

    Console.WriteLine("When: {0}", when);
    Console.WriteLine(policy.CacheSyncDate.ToString());
    return policy; 
}

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