キャッシュの存続期間、GET および POST の値、コントロール名、およびキャッシュを変更するために使用するカスタム出力キャッシュ要件を指定して、PartialCachingAttribute クラスの新しいインスタンスを初期化します。
名前空間: System.Web.UI
アセンブリ: System.Web (system.web.dll 内)
構文
'宣言
Public Sub New ( _
duration As Integer, _
varyByParams As String, _
varyByControls As String, _
varyByCustom As String _
)
'使用
Dim duration As Integer
Dim varyByParams As String
Dim varyByControls As String
Dim varyByCustom As String
Dim instance As New PartialCachingAttribute(duration, varyByParams, varyByControls, varyByCustom)
public PartialCachingAttribute (
int duration,
string varyByParams,
string varyByControls,
string varyByCustom
)
public:
PartialCachingAttribute (
int duration,
String^ varyByParams,
String^ varyByControls,
String^ varyByCustom
)
public PartialCachingAttribute (
int duration,
String varyByParams,
String varyByControls,
String varyByCustom
)
public function PartialCachingAttribute (
duration : int,
varyByParams : String,
varyByControls : String,
varyByCustom : String
)
適用できません。
パラメータ
- duration
ユーザー コントロールがキャッシュされる時間 (秒数)。
- varyByParams
出力キャッシュの変更に使用される文字列のセミコロン区切りのリスト。既定では、これらの文字列は、GET メソッド属性を設定して送信されたクエリ文字列値、または POST メソッドを使用して送信されたパラメータに対応しています。この属性を複数のパラメータに設定すると、出力キャッシュにはそれぞれの指定したパラメータに対して要求されたドキュメントの異なったバージョンが含まれます。指定できる値は、"none"、"*"、有効なクエリ文字列、または POST パラメータ名です。
- varyByControls
出力キャッシュの変更に使用される文字列のセミコロン区切りのリスト。これらの文字列は、ユーザー コントロールのプロパティの完全修飾名を表します。ユーザー コントロールでこのパラメータを使用すると、指定された各ユーザー コントロール プロパティのキャッシュに合わせてユーザー コントロール出力が変化します。
- varyByCustom
カスタム出力キャッシュ要件を表すテキスト。このパラメータに "browser" の値が指定された場合は、キャッシュがブラウザ名およびメジャー バージョン情報に応じて変化します。カスタム文字列を入力する場合は、アプリケーションの Global.asax ファイルの System.Web.HttpApplication.GetVaryByCustomString(System.Web.HttpContext,System.String) メソッドをオーバーライドする必要があります。
使用例
PartialCachingAttribute(Int32,String,String,String) コンストラクタをユーザー コントロールに適用する方法を次のコード例に示します。この例では、このコンストラクタを使用して、ユーザー コントロールをキャッシュできることを示し、キャッシュの存続期間を 20 秒に指定して、ユーザー コントロールの出力の変化の対象となる state
という名前のコントロールを指定しています。
' Set the PartialCachingAttribute.Duration property to
' 20 seconds and the PartialCachingAttribute.VaryByControls
' property to the ID of the server control to vary the output by.
' In this case, it is state, the ID assigned to a DropDownList
' server control.
<PartialCaching(20, Nothing, "state", Nothing)> _
Public Class ctlSelect
Inherits UserControl
// Set the PartialCachingAttribute.Duration property to
// 20 seconds and the PartialCachingAttribute.VaryByControls
// property to the ID of the server control to vary the output by.
// In this case, it is state, the ID assigned to a DropDownList
// server control.
[PartialCaching(20, null, "state", null)]
// Set the PartialCachingAttribute.Duration property to
// 20 seconds and the PartialCachingAttribute.VaryByControls
// property to the ID of the server control to vary the output by.
// In this case, it is state, the ID assigned to a DropDownList
// server control.
/** @attribute PartialCaching(20, null, "state", null)
*/
プラットフォーム
Windows 98,Windows Server 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
Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。
バージョン情報
.NET Framework
サポート対象 : 3.0,2.0,1.1,1.0
参照
関連項目
PartialCachingAttribute クラス
PartialCachingAttribute メンバ
System.Web.UI 名前空間