IHttpCacheSpecificData::ResetTTL Method

 

Resets the Time-to-Live (TTL) setting of the cached data.

Syntax

virtual VOID ResetTTL(  
   VOID  
) = 0;  

Parameters

This method takes no parameters.

Thread Safety

Classes that implement the IHttpCacheSpecificData interface are thread safe for the DecrementTTL and ResetTTL methods.

Remarks

The TTL is used to determine when cached data is no longer valid and, therefore, when that data should be reloaded. Most IHttpCacheSpecificData implementations set an initial internal count to a positive value, and then allow that count to be reduced through successive calls to the DecrementTTL method. If the TTL value becomes 0, the data should be reloaded.

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

  • Classes that implement the IHttpCacheSpecificData or IHttpTokenEntry interfaces initialize the internal count to 2 at construction, and decrement that count by 1 on each call to DecrementTTL.

  • Classes that implement the IHttpFileInfo interface are varied. Some classes implement the scheme defined above, while others perform empty operations on both ResetTTL and DecrementTTL.

Notes for Implementers

The DecrementTTL and ResetTTL method implementations must be thread safe for an IHttpCacheSpecificData pointer.

Notes for Callers

Most callers may disregard the ResetTTL method because this method is meant to be used internally.

Example

The following code example demonstrates a class called MySpecificData that implements the IHttpCacheSpecificData methods.

class MySpecificData : public IHttpCacheSpecificData  
{  
public:  
    MySpecificData()  
    {  
        m_ttl = 2;  
    }  
  
    virtual ~MySpecificData()  
    {  
        m_ttl = 0;  
    }  
  
    virtual VOID ResetTTL(VOID)  
    {  
        m_ttl = 2;  
    }  
  
    virtual VOID DecrementTTL(BOOL* pfTTLExpired)  
    {  
        *pfTTLExpired = (InterlockedDecrement(&m_ttl) == 0);  
    }  
  
private:  
    LONG m_ttl;  
};  

Requirements

Type Description
Client - IIS 7.0 on Windows Vista
- IIS 7.5 on Windows 7
- IIS 8.0 on Windows 8
- IIS 10.0 on Windows 10
Server - IIS 7.0 on Windows Server 2008
- 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 Technical Preview
Product - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
- IIS Express 7.5, IIS Express 8.0, IIS Express 10.0
Header Httpserv.h

See Also

IHttpCacheSpecificData Interface