WebRequest.CachePolicy プロパティ
アセンブリ: System (system.dll 内)

Dim instance As WebRequest Dim value As RequestCachePolicy value = instance.CachePolicy instance.CachePolicy = value
public: virtual property RequestCachePolicy^ CachePolicy { RequestCachePolicy^ get (); void set (RequestCachePolicy^ value); }
/** @property */ public RequestCachePolicy get_CachePolicy () /** @property */ public void set_CachePolicy (RequestCachePolicy value)
public function get CachePolicy () : RequestCachePolicy public function set CachePolicy (value : RequestCachePolicy)
キャッシュ ポリシーを定義する RequestCachePolicy オブジェクト。

現在のキャッシュ ポリシーと要求されたリソースがキャッシュ内に存在するかどうかで、キャッシュから応答が取得できるかどうかが決まります。キャッシュされた応答を使用すると、通常、アプリケーションのパフォーマンスが改善されますが、キャッシュ内の応答がサーバー上の応答と一致しない危険性があります。
既定のキャッシュ ポリシーは、Machine.config 構成ファイルで指定するか、ハイパーテキスト転送プロトコル (HTTP: Hypertext Transfer Protocol) や HTTPS (Secure Hypertext Transfer Protocol) の URI スキームを使用している要求に対して DefaultCachePolicy プロパティを設定して指定できます。

Web 要求のキャッシュ ポリシーを設定するコード例を次に示します。
// The following method demonstrates overriding the // caching policy for a request. public static WebResponse GetResponseNoCache(Uri uri) { // Set a default policy level for the "http:" and "https" schemes. HttpRequestCachePolicy policy = new HttpRequestCachePolicy(HttpRequestCacheLevel.Default); HttpWebRequest.DefaultCachePolicy = policy; // Create the request. WebRequest request = WebRequest.Create(uri); // Define a cache policy for this request only. HttpRequestCachePolicy noCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore); request.CachePolicy = noCachePolicy; WebResponse response = request.GetResponse(); Console.WriteLine("IsFromCache? {0}", response.IsFromCache); return response; }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からWebRequest.CachePolicy プロパティを検索する場合は、下記のリンクをクリックしてください。

- WebRequest.CachePolicy プロパティのページへのリンク