AggregateCacheDependencyとは? わかりやすく解説

AggregateCacheDependency クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

ASP.NET アプリケーションCache オブジェクト格納されている項目と CacheDependency オブジェクト配列の間の複数依存関係結合します。このクラス継承できません。

名前空間: System.Web.Caching
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public NotInheritable Class
 AggregateCacheDependency
    Inherits CacheDependency
Dim instance As AggregateCacheDependency
public sealed class AggregateCacheDependency
 : CacheDependency
public ref class AggregateCacheDependency sealed
 : public CacheDependency
public final class AggregateCacheDependency
 extends CacheDependency
public final class AggregateCacheDependency
 extends CacheDependency
解説解説

AggregateCacheDependency クラス依存関係オブジェクトコレクション監視し、これらのオブジェクト変更されたときにキャッシュされた項目が自動的に削除されるようにします。配列内のオブジェクトは、CacheDependency オブジェクト、SqlCacheDependency オブジェクトCacheDependency から派生したカスタム オブジェクト、またはこれらの任意の組み合わせなります

AggregateCacheDependency クラスは、種類異な複数依存関係単一キャッシュされた項目に関連付けできる点において、CacheDependency クラス異なります。たとえば、SQL Server データベース テーブルおよび XML ファイルかデータインポートするページ作成する場合データベース テーブルとの依存関係を表す SqlCacheDependency オブジェクトと、XML ファイルとの依存関係を表す CacheDependency作成できます。つまり、依存関係ごとに Cache.Insert メソッド呼び出し作成する代わりに追加される依存関係使用して AggregateCacheDependency クラスインスタンス作成できます次に単一Insert 呼び出し使用して、このページAggregateCacheDependency インスタンス依存させます

使用例使用例

AggregateCacheDependency クラス使用してテキスト ファイルXML ファイル依存するキャッシュXMLDataSet という名前の DataSet追加するコード例次に示します

' When the page is loaded, use the 
' AggregateCacheDependency class to make 
' a cached item dependent on two files.

Sub Page_Load(sender As Object,
 e As EventArgs)
   Dim Source As DataView

   Source = Cache("XMLDataSet")

   If Source Is Nothing
          Dim DS As New
 DataSet
          Dim FS As FileStream
          Dim Reader As StreamReader
          Dim txtDep As CacheDependency
          Dim xmlDep As CacheDependency
          Dim aggDep As AggregateCacheDependency


          FS = New FileStream(Server.MapPath("authors.xml")
,FileMode.Open,FileAccess.Read)
          Reader = New StreamReader(FS)
          DS.ReadXml(Reader)
          FS.Close()

          Source = new DataView(ds.Tables(0))
         ' Create two CacheDependency objects, one to a
         ' text file and the other to an XML file. 
         ' Create a CacheDependency array with these 
         ' two objects as items in the array.
          txtDep = New CacheDependency(Server.MapPath("Storage.txt"))
          xmlDep = New CacheDependency(Server.MapPath("authors.xml"))
          Dim DepArray() As CacheDependency
 = {txtDep, xmlDep}

          ' Create an AggregateCacheDependency object and 
          ' use the Add method to add the array to it.   
          aggDep = New AggregateCacheDependency()
          aggDep.Add(DepArray)

          ' Call the GetUniqueId method to generate
          ' an ID for each dependency in the array.
          msg1.Text = aggDep.GetUniqueId()
          
          ' Add the new data set to the cache with 
          ' dependencies on both files in the array.
          Cache.Insert("XMLDataSet", Source, aggDep)
          If aggDep.HasChanged = True Then
             chngMsg.Text = "The dependency changed at: "
 & DateTime.Now

          Else
             chngMsg.Text = "The dependency changed last at: "
 & aggDep.UtcLastModified.ToString()
          End If


          cacheMsg1.Text = "Dataset created explicitly"
        Else
          cacheMsg1.Text = "Dataset retrieved from cache"
        End If


          MyLiteral.Text = Source.Table.TableName
          MyDataGrid.DataSource = Source
          MyDataGrid.DataBind()
      End Sub
  
 
      Public Sub btn_Click(sender As
 Object, e As EventArgs )

       If (MyTextBox.Text = String.Empty) Then
          msg2.Text ="You have not changed the text file."
       Else
          msg2.Text="You added " & MyTextBox.Text
 & "."

          ' Create an instance of the StreamWriter class
          ' to write text to a file.
          Dim sw As StreamWriter
          sw = File.CreateText(Server.MapPath("Storage.txt"))

          ' Add some text to the file.
          sw.Write("You entered:")
          sw.WriteLine(MyTextBox.Text)

          ' Write arbitrary objects to the file as needed.
          sw.Write("Text added at:")
          sw.WriteLine(DateTime.Now)
          sw.WriteLine("-------------------")
          sw.Close()
       End If
     End Sub
継承階層継承階層
System.Object
   System.Web.Caching.CacheDependency
    System.Web.Caching.AggregateCacheDependency
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
AggregateCacheDependency メンバ
System.Web.Caching 名前空間

AggregateCacheDependency コンストラクタ

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

AggregateCacheDependency クラス新しインスタンス初期化します。

名前空間: System.Web.Caching
アセンブリ: System.Web (system.web.dll 内)
構文構文

Dim instance As New AggregateCacheDependency
public AggregateCacheDependency ()
public:
AggregateCacheDependency ()
public AggregateCacheDependency ()
public function AggregateCacheDependency ()
解説解説

これは、AggregateCacheDependency クラス既定コンストラクタです。

使用例使用例

引数受け取らないコンストラクタ使用してAggregateCacheDependency クラスインスタンス作成するコード例次に示します2 つの CacheDependency オブジェクト作成されCacheDependency 配列 (myDepArray) に追加されます。このコンストラクタAdd メソッド組み合わせて使用しCache格納されている項目を両方CacheDependency オブジェクト依存させます

' Create two CacheDependency objects, one to a
' text file and the other to an XML file. 
' Create a CacheDependency array with these 
' two objects as items in the array.
 txtDep = New CacheDependency(Server.MapPath("Storage.txt"))
 xmlDep = New CacheDependency(Server.MapPath("authors.xml"))
 Dim DepArray() As CacheDependency = {txtDep,
 xmlDep}

 ' Create an AggregateCacheDependency object and 
 ' use the Add method to add the array to it.   
 aggDep = New AggregateCacheDependency()
 aggDep.Add(DepArray)
    
 ' Call the GetUniqueId method to generate
 ' an ID for each dependency in the array.
 msg1.Text = aggDep.GetUniqueId()
 
 ' Add the new data set to the cache with 
 ' dependencies on both files in the array.
 Cache.Insert("XMLDataSet", Source, aggDep)
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
AggregateCacheDependency クラス
AggregateCacheDependency メンバ
System.Web.Caching 名前空間

AggregateCacheDependency プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ HasChanged  CacheDependency オブジェクト変更されたかどうかを示す値を取得します。 ( CacheDependency から継承されます。)
パブリック プロパティ UtcLastModified  依存関係最後に変更され時刻取得します。 ( CacheDependency から継承されます。)
参照参照

関連項目

AggregateCacheDependency クラス
System.Web.Caching 名前空間

AggregateCacheDependency メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

AggregateCacheDependency クラス
System.Web.Caching 名前空間

AggregateCacheDependency メンバ

ASP.NET アプリケーションCache オブジェクト格納されている項目と CacheDependency オブジェクト配列の間の複数依存関係結合します。このクラス継承できません。

AggregateCacheDependency データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド AggregateCacheDependency AggregateCacheDependency クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ HasChanged  CacheDependency オブジェクト変更されたかどうかを示す値を取得します。(CacheDependency から継承されます。)
パブリック プロパティ UtcLastModified  依存関係最後に変更され時刻取得します。(CacheDependency から継承されます。)
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

AggregateCacheDependency クラス
System.Web.Caching 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からAggregateCacheDependencyを検索した結果を表示しています。
Weblioに収録されているすべての辞書からAggregateCacheDependencyを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からAggregateCacheDependency を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「AggregateCacheDependency」の関連用語

AggregateCacheDependencyのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



AggregateCacheDependencyのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS