Skip to content

Latest commit

 

History

History
70 lines (53 loc) · 5.53 KB

File metadata and controls

70 lines (53 loc) · 5.53 KB
title IHttpServer::DoCacheOperation Method
description Learn how the IHttpServer::DoCacheOperation method performs a specific cache operation.
ms.date 10/07/2016
ms.assetid 0a0367e5-0463-3261-e359-41d2205827a4

IHttpServer::DoCacheOperation Method

Performs a specific cache operation.

Syntax

virtual HRESULT DoCacheOperation(  
   IN CACHE_OPERATION cacheOperation,  
   IN IHttpCacheKey* pCacheKey,  
   OUT IHttpCacheSpecificData** ppCacheSpecificData,  
   IN IHttpTraceContext* pHttpTraceContext = NULL  
) = 0;  

Parameters

cacheOperation
[IN] A CACHE_OPERATION enumeration value.

pCacheKey
[IN] A pointer to an IHttpCacheKey interface.

ppCacheSpecificData
[OUT] A pointer to the address of an IHttpCacheSpecificData interface.

pHttpTraceContext
[IN] A pointer to an IHttpTraceContext interface. (Optional.)

Return Value

An HRESULT. Possible values include, but are not limited to, those in the following table.

Value Description
S_OK Indicates that the operation was successful.

Remarks

The DoCacheOperation method is used in HTTP modules to perform the cache operation that is specified by the cacheOperation parameter. For example, the CACHE_OPERATION_ADD and CACHE_OPERATION_DELETE enumeration values store or remove objects, respectively, from the cache. When your module calls the DoCacheOperation method, it must pass an IHttpCacheKey interface in the pCacheKey parameter, and IIS will return an IHttpCacheSpecificData interface in the ppCacheSpecificData parameter. You can optionally specify an IHttpTraceContext interface in the pHttpTraceContext parameter to identify the request that triggered the call. (This is necessary only for tracing purposes.)

Note

Implementers should not call DoCacheOperation inside of IHttpApplicationResolveModulesProvider::RegisterModule Method because it is too early in the request pipeline.

Example

The following code example demonstrates how to use the DoCacheOperation method to create an HTTP module that tests for a CACHE_OPERATION_RETRIEVE operation and triggers a CACHE_OPERATION_ENUM operation.

[!code-cppIHttpServerDoCacheOperation#1]

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.

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

IHttpServer Interface
CACHE_OPERATION Enumeration
IHttpCacheKey Interface
IHttpCacheSpecificData Interface
IHttpTraceContext Interface