Skip to content

Latest commit

 

History

History
149 lines (124 loc) · 7.17 KB

File metadata and controls

149 lines (124 loc) · 7.17 KB
title IHttpCacheSpecificData::GetCacheKey Method
description Describes the IHttpCacheSpecificData::GetCacheKey method and details its syntax, parameters, return value, remarks, code example, and requirements.
ms.date 10/07/2016
ms.assetid 3e91916c-8c29-70fa-7985-acb0b2beccdc

IHttpCacheSpecificData::GetCacheKey Method

Returns the cache key associated with the cached data.

Syntax

virtual IHttpCacheKey* GetCacheKey(  
   VOID  
) const = 0;  

Parameters

This method takes no parameters.

Return Value

An IHttpCacheKey pointer.

Remarks

The behavior of the GetCacheKey method is implementation specific. You should use the following information as a guideline, but it may not be correct in all scenarios:

Caution

Before you perform any downcast operation, always verify that the cast is valid to guarantee correct program behavior.

Note

Consider using the dynamic_cast operator whenever possible when you perform a downcast operation.

Notes for Implementers

IHttpCacheSpecificData implementers are responsible for memory management with this data; therefore, IHttpCacheSpecificData implementers that use dynamic memory allocation must release or call delete on the IHttpCacheKey pointer when it is no longer needed.

Notes for Callers

IHttpCacheSpecificData implementers are responsible for memory management with this data; therefore, IHttpCacheSpecificData clients must not release or call delete on the returned IHttpCacheKey pointer when this data is no longer needed.

Example

The following code example demonstrates how to create a global module that listens for GL_CACHE_OPERATION and GL_CACHE_CLEANUP events and then writes the IHttpCacheKey information to the Event Viewer.

Caution

[!INCLUDEiisver] generates a large number of events in the Event Viewer. To avoid a log overflow error in a production environment, you should generally avoid writing cache information to the event log. For demonstration purposes, this code example writes an entry to the Event Viewer in debug mode only.

[!code-cppIHttpCacheSpecificData#2]

For more information on how to create and deploy a native DLL module, see Walkthrough: Creating a Request-Level HTTP Module By Using Native Code.

The above code writes new events to the application log of the Event Viewer, where the Data box contains XML similar to the following.

<cacheProvider>  
    <cacheSpecificData   
        flushed="false">  
        <uriKey   
            siteId="1"   
            siteName="Default Web Site"   
            url="/DEFAULT.HTM"   
            cacheName="URI"   
            hash="59390334"   
            isEqual="true"   
            isPrefix="true"/>  
    </cacheSpecificData>  
</cacheProvider>  
<cacheProvider>  
    <fileInfo   
        changed="false"   
         attributes="32"   
         eTag=""5e5e714ef4dc61:0""   
         buffer="false"   
         handle="valid"   
         path="C:\INETPUB\WWWROOT\DEFAULT.HTM"   
         cacheAllowed="true"   
         secondsToLive="-1"   
         lastModifiedString="Tue, 21 Mar 2006 17:45:56 GMT"   
         lastModifiedTime="valid"   
         size="92"   
         vrPath="C:\inetpub\wwwroot"   
         vrToken="NULL"   
         flushed="false">  
        <contextContainer>  
            <storedContext/>  
        </contextContainer>  
        <fileKey path="D:\INETPUB\WWWROOT\DEFAULT.HTM"   
            cacheName="FILE"   
            hash="206817538"   
            isEqual="true"   
            isPrefix="true"/>  
    </fileInfo>  
</cacheProvider>  
<cacheProvider>  
    <tokenEntry   
        impersonationToken="valid"   
        primaryToken="valid"   
        sid="valid"   
        flushed="false">  
        <tokenKey   
            userName="IUSR"   
            passwordHash="1234567890"   
            logon="3"   
            cacheName="TOKEN"   
            hash="0"   
            isEqual="true"   
            isPrefix="false"/>  
    </tokenEntry>  
</cacheProvider>  
<cacheProvider>  
    <cacheSpecificData   
        flushed="false">  
        <uriKey   
            siteId="1"   
            siteName="Default Web Site"   
            url="/"   
            cacheName="URI"   
            hash="46"   
            isEqual="true"   
            isPrefix="true"/>  
    </cacheSpecificData>  
</cacheProvider>  

You can optionally compile the code by using the __stdcall (/Gz) calling convention instead of explicitly declaring the calling convention for each function.

Requirements

Type Description
Client - IIS 7.0 on [!INCLUDEwinvista]
- IIS 7.5 on Windows 7
- IIS 8.0 on Windows 8
- IIS 10.0 on Windows 10
Server - IIS 7.0 on [!INCLUDEwinsrv2008]
- IIS 7.5 on Windows Server 2008 R2
- IIS 8.0 on Windows Server 2012
- IIS 8.5 on Windows Server 2012 R2
- IIS 10.0 on Windows Server 2016
Product - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
- [!INCLUDEiisexp75], [!INCLUDEiisexp80], [!INCLUDEiisexp100]
Header Httpserv.h

See Also

IHttpCacheSpecificData Interface