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

この UserControl のキャッシュ パラメータを定義するプロパティを格納している ControlCachePolicy。

CachePolicy プロパティは、UserControl クラスのインスタンスのキャッシュ パラメータを定義します。CachePolicy プロパティは読み取り専用です。ただし、このプロパティが返す ControlCachePolicy オブジェクトのプロパティを設定することはできます。
CachePolicy プロパティを宣言によって設定することはできません。これはプログラムによって設定する必要があります。

SupportsCaching プロパティを使用してユーザー コントロールをキャッシュできるかどうかを確認し、キャッシュできる場合はコントロールの内容を 10 秒間キャッシュするように Duration プロパティを設定するコード例を次に示します。
<%@ page language="VB"%> <%@ register src="SimpleControlvb.ascx" tagname="SimpleControl" tagprefix="uc1"%> <script runat="server"> Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) If SimpleControl1 IsNot Nothing Then Page.DataBind() If SimpleControl1.CachePolicy.SupportsCaching Then ' Set the cache duration to 10 seconds. SimpleControl1.CachePolicy.Duration = New TimeSpan(0, 0, 10) End If End If End Sub </script>
<%@ page language="C#"%> <%@ register src="SimpleControlcs.ascx" tagname="SimpleControl" tagprefix="uc1"%> <script runat="server"> void Page_Init(object sender, EventArgs e) { // If the control is already in the cache, calling properties // will throw an exception. Make sure the control is available. if (SimpleControl1 != null) { Page.DataBind(); if (SimpleControl1.CachePolicy.SupportsCaching) { // Set the cache duration to 10 seconds. SimpleControl1.CachePolicy.Duration = new TimeSpan(0, 0, 10); } } } </script>

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


UserControl クラス
UserControl メンバ
System.Web.UI 名前空間
BasePartialCachingControl クラス
その他の技術情報
ASP.NET ページの一部だけのキャッシュ
@ OutputCache
Weblioに収録されているすべての辞書からUserControl.CachePolicy プロパティを検索する場合は、下記のリンクをクリックしてください。

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