| title | IHttpCacheSpecificData::ResetTTL Method |
|---|---|
| description | Describes the IHttpCacheSpecificData::ResetTTL method and details its syntax, parameters, thread safety, remarks, code example, and requirements. |
| ms.date | 10/07/2016 |
| ms.assetid | 6b8b7fce-32a3-c503-2c99-dc66de77d9ce |
Resets the Time-to-Live (TTL) setting of the cached data.
virtual VOID ResetTTL(
VOID
) = 0; This method takes no parameters.
Classes that implement the IHttpCacheSpecificData interface are thread safe for the DecrementTTL and ResetTTL methods.
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
IHttpCacheSpecificDataor IHttpTokenEntry interfaces initialize the internal count to 2 at construction, and decrement that count by 1 on each call toDecrementTTL. -
Classes that implement the IHttpFileInfo interface are varied. Some classes implement the scheme defined above, while others perform empty operations on both
ResetTTLandDecrementTTL.
The DecrementTTL and ResetTTL method implementations must be thread safe for an IHttpCacheSpecificData pointer.
Most callers may disregard the ResetTTL method because this method is meant to be used internally.
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;
};
| 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 |