| title | IFileKey Interface |
|---|---|
| description | Describes the IFileKey interface and details its syntax, methods, derived classes, remarks, code example, inheritance hierarchy, and requirements. |
| ms.date | 10/07/2016 |
| ms.assetid | f99a547e-97e3-0298-09df-297719c95c20 |
Represents key information for accessing associated data in the global file cache.
class IFileKey : public IHttpCacheKey The following table lists the methods exposed by the IFileKey interface.
| Name | Description |
|---|---|
| Enum | (Inherited from IHttpCacheKey.) |
| GetCacheName | Overridden. Returns the name of the global file cache. |
| GetHash | (Inherited from IHttpCacheKey.) |
| GetIsEqual | (Inherited from IHttpCacheKey.) |
| GetIsPrefix | (Inherited from IHttpCacheKey.) |
| GetPath | Returns the absolute physical path of a file. |
This interface contains no derived classes.
The IFileKey interface extends the IHttpCacheKey interface by adding support for returning the absolute physical path of a file through the IFileKey::GetPath method. IFileKey also overrides the IHttpCacheKey::GetCacheName method by providing the default implementation through the IFileKey::GetCacheName method.
For each non-abstract class that implements the IFileKey interface, you must provide a hash code in the GetHash method to map the IFileKey pointer data to a unique DWORD value for that data.
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 IFileKey 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-cppIFileKey#1]
The above code writes a new event to the Event Viewer, where the Data box contains XML similar to the following.
<cacheProvider>
<fileKey
path="C:\INETPUB\WWWROOT\DEFAULT.HTM"
cacheName="FILE"
hash="123456789"
isEqual="true"
isPrefix="true"/>
</cacheProvider>
Your module must export the RegisterModule function. You can export this function by creating a module definition (.def) file for your project, or you can compile the module by using the /EXPORT:RegisterModule switch. For more information, see Walkthrough: Creating a Request-Level HTTP Module By Using Native Code.
You can optionally compile the code by using the __stdcall (/Gz) calling convention instead of explicitly declaring the calling convention for each function.
IFileKey
| 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 | Httpcach.h |