NetCache keeps an object in its cache based on the object's maximum age, or Time-To-Live (TTL). How the TTL is calculated depends on whether or not the request is accelerated.
An object's TTL is determined by the following criteria, in order of precedence:
Note that you can configure NetCache to override the TTL specified by an object's cache control headers through settings on the HTTP - Header and Caching Behavior page.
In addition, you can enter If-Modified_Since (IMS) rules in the IMS rules tab on the HTTP - Header and Caching Behavior page that can specify IMS queries that result in an object being refreshed before its TTL is expired.
An object's TTL is determined by the following criteria, in order of precedence:
When a user requests an object that is in the cache and that object has expired, that is, it has exceeded its TTL, NetCache verifies the freshness of the object with its originating Web server. NetCache verifies the freshness of the object by sending a request to the Web server inquiring whether the object has been modified. This query is called an If-Modified-Since, or IMS, query.
If the response to the IMS query indicates that the object has not been modified, NetCache delivers the object from its cache and recalculates the object TTL. If the object has been modified, NetCache ejects the older object, caches the updated object, and sends it to the user.
If an object cannot be verified because NetCache fails to connect to the Web server, NetCache returns the last-verified object.
When a Web server sends an object to the NetCache appliance, it includes in its headers the object's expiration time and last-modification time. If the object contains an explicit expiration time, NetCache uses it regardless of any entries in the TTL Patterns option.
If the object has a specified last-modified time, NetCache calculates the default TTL differently than if the object has no last-modified time.
To determine when NetCache calculates the default TTL, see About object Time-To-Live.
If no last-modified time has been specified for the object, NetCache uses the age specified in the Default Maximum Age option on the HTTP - Header and Caching Behavior page as the initial TTL.
If a last-modified time has been specified for the object, NetCache sets the object's initial TTL to a value equal to half the length of time between the object's last modification time and the current time.
Using this adaptive algorithm, objects that have not been changed for a long time tend to have very high default TTLs, and objects that change frequently tend to have very low default TTLs. This approach enables NetCache to maximize bandwidth savings by not refetching objects that have not been modified and by not verifying objects that are unlikely to have been modified. At the same time, this approach helps keep cache content current, or fresh, with the state of the object on the originating Web server.
If an object is cached for the first time with a last-modified date of one day before, NetCache sets the object's expiration time to 12 hours. After the object has been in the cache for 12 hours, the next user request for the object causes NetCache to verify the object with the Web server. If the object has not changed, NetCache recalculates the expiration time based on the original last modification time, 36 hours ago. NetCache sets the new expiration time for the object to 18 hours.
With this process, if the object continues to be unmodified, the object's expiration time continues to increase with each verification by NetCache. However, if NetCache determines that the object has been modified, NetCache resets the TTL to a relatively low value until the object in its cache has been unmodified for a longer period of time.
Using the TTL Patterns option on the HTTP - Header and Caching Behavior page in the Appliance Manager, you can modify the TTL that NetCache uses for objects.
TTL pattern rules are invoked if the URL matches the regular expression specified in the TTL Patterns box. Regular expressions are checked in order; the first expression that matches the URL is used to determine the object's TTL. If the URL does not match any pattern, no TTL pattern rule is invoked.
However, if the Web server included an explicit expiration time in the object, NetCache uses the expiration time regardless of any entries in the TTL Patterns option.
You can create TTL pattern rules using a regular expression of object URLs. Use the following syntax to create TTL pattern rules:
regular_expression absolute_TTL <percentage_TTL> <maximum_TTL>
In the preceding syntax example, regular_expression is the URL string; absolute_TTL is the absolute TTL in minutes; percentage_TTL is a percentage of the object's age; and maximum_TTL is the maximum number of minutes an object can reside in the cache before reverification. The relationship between these syntax elements is explained in the following sections.
A regular expression of the URL. For example:
^http://
The preceding example matches all HTTP objects, that is, all objects with strings that begin with http://. For more information about regular expressions, see the chapter on access control in the Security Guide.
The absolute number of minutes an object can reside in the cache before reverification. The absolute TTL value is used to calculate an object's TTL when no last-modified time is specified for the object or if the percentage_TTL is unspecified or set to zero.
For example:
^http:// 1440
In the preceding example, HTTP objects (strings that begin with http://) are cached for 1,440 minutes.
An absolute TTL of zero causes NetCache to send an IMS query request to the Web server to verify the freshness of the object.
NetCache uses the percentage_TTL variable in conjunction with the maximum_TTL variable to calculate an object's TTL as follows:
(current time - last modified time) x (percentage_TTL / 100)
NetCache calculates the percentage_TTL, compares it to the value specified for the maximum_TTL, and uses the lesser of the two values.
Assume that the following rule is entered:
^http:// 0 20% 4320
If the object is cached at 9:00 a.m. and the object was last modified 7:00 p.m., NetCache calculates 20 percent of 14 hours (9:00 a.m. minus 7:00 p.m.), to arrive at a total of 168 minutes. NetCache then compares the total found in the percentage_TTL calculation (168 minutes) to the maximum_TTL (4320 minutes) and uses the lesser value. Therefore, NetCache sets the object TTL to 168 minutes.
The following stipulations apply to the percentage_TTL and maximum_TTL variables:
Copyright © 1994-2002, Network Appliance, Inc. All rights
reserved.
Part No. 210-00369
File: webcach8.htm
Last updated: 11/12/02 12:13:42