CacheDependency.GetUniqueID 메서드

정의

CacheDependency 개체의 고유 식별자를 검색합니다.

public:
 virtual System::String ^ GetUniqueID();
public virtual string GetUniqueID ();
abstract member GetUniqueID : unit -> string
override this.GetUniqueID : unit -> string
Public Overridable Function GetUniqueID () As String

반환

String

CacheDependency 개체의 고유 식별자입니다.

예제

다음 코드 예제에서는 배열에 AggregateCacheDependency 두 개의 CacheDependency 개체를 사용하여 명명된 aggDep개체를 만듭니다. 인스턴스화되면 aggDep 코드는 메서드를 호출 GetUniqueID 하여 포함 페이지에 식별자를 포함하고 표시하는 두 종속성 aggDep 모두에 대한 고유 식별자를 생성합니다. 그런 다음 종속성으로 메서드 aggDepInsert 사용하여 항목이 추가Cache됩니다.

         ' 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)

설명

이 메서드는 여러 인스턴스의 추적에 대 한 특히 유용할 수 있습니다는 CacheDependency 항목 또는 애플리케이션을 사용 하 여 연결 된 클래스입니다.

식별자는 파일 이름(파일 종속성) 또는 키 이름(캐시 키 종속성)과 이 메서드가 종속성에 할당하는 문자열의 조합입니다. 클래스에서 파생되는 클래스에서 이 메서드를 재정의 CacheDependency 하여 고유 식별자를 생성하는 방법을 사용자 지정할 수 있습니다.

적용 대상

추가 정보