清除儲存的內容。
語法
virtual VOID CleanupStoredContext(
VOID
) = 0;
參數
此方法不會採用任何參數。
備註
這個方法的行為取決於實作。 您應該使用下列資訊作為指導方針,但在所有案例中可能都不正確:
某些實作會在
CleanupStoredContext方法期間執行空白作業。某些實作會呼叫
delete``this目前 IHttpStoredCoNtext 指標。有些實作會使用內部參考計數,並在每次呼叫
CleanupStoredContext期間遞減內部參考計數。 如果參考計數移至 0,這些實作器會立即在目前的IHttpStoredContext上呼叫delete``this。
實作者的注意事項
IHttpStoredContext 實作器應該建立 protected 或 private``virtual 解構函式,因為 IHttpStoredContext 指標不應該向下傳播至其最特定的類別以進行刪除。 相反地,刪除這些實作者應該由內部的每個指標控制,並在呼叫 CleanupStoredContext 期間進行處理。
來電者的附注
CleanupStoredContext方法應該只在指標上 IHttpStoredContext 呼叫一次,因為呼叫 時 CleanupStoredContext 會呼叫 delete``this 某些實作。 CleanupStoredContext在大部分 IHttpStoredContext 指標上呼叫一次以上,將會擲回存取違規例外狀況或記憶體中的資料損毀。
範例
下列程式碼範例示範如何建立 IHttpStoredContext 名為 的 MyStoredContext 類別,並在內部控制指標的 MyStoredContext 刪除。 MyStoredContext 只會實作解 private 構函式,並在呼叫 方法時 CleanupStoredContext 呼叫該解構函式。
// The MyStoredContext class implements the IHttpStoredContext
// interface and demonstrates one possible solution for
// implementing the CleanupStoredContext method.
class MyStoredContext : public IHttpStoredContext
{
public:
// The MyStoredContext method is the public
// constructor for the MyStoredContext class.
MyStoredContext()
{
}
// The CleanupStoredContext method must be implemented
// by non-abstract classes that implement the
// IHttpStoredContext interface. This method
// calls delete this.
virtual void CleanupStoredContext(VOID)
{
delete this;
}
private:
// The MyStoredContext method is the private virtual
// destructor for the MyStoredContext class.
virtual ~MyStoredContext()
{
}
};
規格需求
| 類型 | 描述 |
|---|---|
| Client | - Windows Vista 上的 IIS 7.0 - Windows 7 上的 IIS 7.5 - Windows 8 上的 IIS 8.0 - Windows 10上的 IIS 10.0 |
| 伺服器 | - Windows Server 2008 上的 IIS 7.0 - Windows Server 2008 R2 上的 IIS 7.5 - Windows Server 2012 上的 IIS 8.0 - Windows Server 2012 R2 上的 IIS 8.5 - Windows Server 2016上的 IIS 10.0 |
| 產品 | - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0 - IIS Express 7.5、IIS Express 8.0、IIS Express 10.0 |
| 標頭 | Httpserv.h |