HttpRequestCachePolicy Constructor (HttpRequestCacheLevel)

 

Initializes a new instance of the HttpRequestCachePolicy class using the specified cache policy.

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

public:
HttpRequestCachePolicy(
	HttpRequestCacheLevel level
)

This constructor initializes the Level property to level.

The HttpRequestCacheLevel value controls whether caching is enabled, and when the cache can be used. For additional information, see the HttpRequestCacheLevel documentation.

The following code example demonstrates creating a cache policy that allows resources found in the cache to be used from the cache.

static HttpRequestCachePolicy^ CreateCacheIfAvailablePolicy()
{
   HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpRequestCacheLevel::CacheIfAvailable );
   Console::WriteLine( policy );
   return policy;
}

.NET Framework
Available since 2.0
Return to top
Show: