Skip to content

Latest commit

 

History

History
58 lines (41 loc) · 4.33 KB

File metadata and controls

58 lines (41 loc) · 4.33 KB
title IHttpCachePolicy::IsUserCacheEnabled Method
ms.date 10/07/2016
description Learn how to return a value that indicates whether user caching is enabled for the cache policy.
ms.assetid ff83d13d-ba1d-2075-8231-df9d7877e96a

IHttpCachePolicy::IsUserCacheEnabled Method

Returns a value that indicates whether user caching is enabled for the cache policy.

Syntax

virtual BOOL IsUserCacheEnabled(  
   VOID  
) const = 0;  

Parameters

This method takes no parameters.

Return Value

true if user caching is enabled for the cache policy; otherwise, false.

Remarks

CHttpModule derived classes that register for request or response events receive an IHttpContext pointer as a parameter on the corresponding virtual method. Call the IHttpContext::GetResponse method, then the IHttpResponse::GetCachePolicy method, and finally the IsUserCacheEnabled method to determine if user caching is enabled for the cache policy.

IsUserCacheEnabled behavior depends on implementation. You should use the following information as a guideline, but it may not be correct in all scenarios:

  • The current default implementer of the IHttpCachePolicy interface declares a private Boolean that determines whether caching is enabled for a user. During the construction of an implementer, this Boolean is initialized to true. When the DisableUserCache method is called, this Boolean is set to false. Once caching is disabled for a user, there is no method to reset this Boolean to true.

  • IsUserCacheEnabled returns the value of this Boolean.

Example

The following code example demonstrates how to create a global module that listens for RQ_BEGIN_REQUEST and RQ_SEND_RESPONSE events. The module then retrieves an IHttpCachePolicy pointer and writes user cache information to the response stream.

[!code-cppIHttpCachePolicy#11]

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 data that is similar to the following to the response stream:

User Cache Enabled: true  

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

IHttpCachePolicy Interface