title | description | ms.date | ms.assetid |
---|---|---|---|
ICacheProvider Interface |
The ICacheProvider interface extends the IHttpEventProvider interface by adding support for retrieving cache information from a cache provider. |
10/07/2016 |
ab6b60bf-88e1-51e1-7c34-e28000868c6a |
Extends the IHttpEventProvider interface by adding support for retrieving cache information from a cache provider.
class ICacheProvider : public IHttpEventProvider
The following table lists the methods exposed by the ICacheProvider
interface.
Name | Description |
---|---|
GetCacheKey | Returns the cache key for the cache provider. |
GetCacheOperation | Returns the cache operation for the cache provider. |
GetCacheRecord | Returns the cache record for the cache provider. |
GetTraceContext | Returns the trace context for the cache provider. |
SetCacheRecord | Sets the cache-specific data on the cache provider. |
SetErrorStatus | (Inherited from IHttpEventProvider .) |
This interface contains no derived classes.
CGlobalModule derived classes that register for GL_CACHE_OPERATION events receive an ICacheProvider pointer as a parameter on the CGlobalModule::OnGlobalCacheOperationvirtual
method.
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 ICacheProvider
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-cppICacheProvider#1]
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 a new event to the application log of the Event Viewer, where the Data box contains XML similar to the following.
<cacheProvider cacheOperation="CACHE_OPERATION_RETRIEVE">
<fileKey
path="D:\INETPUB\WWWROOT"
cacheName="FILE"
hash="-711969814"
isEqual="true"
isPrefix="true"/>
<fileInfo
changed="false"
attributes="32"
eTag="1234567890abcde:0"
buffer="true"
path="C:\INETPUB\WWWROOT\DEFAULT.HTM"
handle="INVALID_HANDLE_VALUE"
cacheAllowed="true"
secondsToLive="-1"
lastModifiedString="Tue, 13 Dec 2005 10:57:41 GMT"
lastModifiedTime="12/13/2005 02:57"
size="50"
vrPath="NULL"
vrToken="NULL">
<fileKey
path="C:\INETPUB\WWWROOT\DEFAULT.HTM"
cacheName="FILE"
hash="-711969814"
isEqual="true"
isPrefix="true" />
<contextContainer>
<storedContext />
</contextContainer>
</fileInfo>
<traceContext
activityId="{00000000-0000-0000-3400-0080000000FF}">
<traceConfiguration
providerGuid=""
areas="0"
verbosity="0"
providerEnabled="false"/>
</traceContext>
</cacheProvider>
You can optionally compile the code by using the __stdcall (/Gz)
calling convention instead of explicitly declaring the calling convention for each function.
ICacheProvider
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 |