Microsoft Internet Security and Acceleration Server 2004 SDK |
The FetchUrl method causes the ISA Server Web proxy to retrieve an object and store it in the cache.
The ISA Server Web proxy normally fetches objects from the Internet and caches them automatically as clients request them (passive caching). In addition, the Web proxy automatically keeps certain popular objects fresh within its cache by fetching them (active caching). However, there are occasions when an application needs a mechanism to override these automatic operations. The override lets the application exercise greater control either over the source of objects that are placed into the cache or the time they are to remain there. The FetchUrl method allows you this greater degree of control.
To delete an object from the cache, set FetchUrl to an empty string, and set CacheUrl to the URL of the object to remove from the cache. When you delete an object by using FetchUrl, you can perform the operation synchronously or asynchronously, and the Time to Live (TTL) must be set to 0.
HRESULT FetchUrl( BSTR FetchUrl, BSTR CacheUrl, long TtlInMinutes, FpcFetchUrlFlags Flags );
This parameter is ignored unless the Flags parameter includes either the fpcFetchTtlIfNone or fpcFetchTtlOverride flag. If neither flag is specified, the Web proxy's normal TTL computation mechanism is used for the object.
If you have set neither of these flags, the Web proxy uses its normal TTL computation mechanism for the object, which uses an "Expires" or "Cache-Control: max-age" HTTP header if available. Otherwise, the Web proxy estimates a good TTL value based on the time that has elapsed since the object was last modified.
In addition to the preceding flags, you can set one or more of the following flags:
To retrieve an HTTP object in response to a FetchUrl call, the Web proxy uses the normal HTTP GET method to the URL specified by FetchUrl. If there is already a cached copy (which was either loaded into the proxy server previously by normal operations or by an earlier call to FetchUrl) of the URL specified by CacheUrl, the Web proxy will include an If-Modified-Since header in the request (such a request is known as a conditional GET request). The response to a conditional GET may be either a new copy of the data, which will be stored in the cache, or a 304 (Not Modified) response, which will cause the Web proxy to extend the TTL of the object without changing the contents of the data in the cache.
To delete an object from the cache, set FetchUrl to an empty string, and set CacheUrl to the URL of the object to remove from the cache. When you delete an object using FetchUrl, you can perform the operation synchronously or asynchronously, and the TTL must be set to 0.
The DeleteURL VBScript provided with ISA Server in the folder SDK\samples\admin\scripts demonstrates how to delete a cached object.
Note ERROR_INTERNET_UNABLE_TO_CACHE_FILE (decimal value 12158, hex value 2F7E) is a new value that is not present in all versions of the WinINet API include files. This error code is returned if the HTTP headers in the object or other factors prohibited the Web proxy from caching the object. The caller may still be able to force the object into the cache using the fpcFetchForceCache flag.
The FetchUrl method causes the ISA Server Web proxy to retrieve an object and store it in the cache.
The ISA Server Web proxy normally fetches objects from the Internet and caches them automatically as clients request them (passive caching). In addition, the Web proxy automatically keeps certain popular objects fresh within its cache by fetching them (active caching). However, there are occasions when an application needs a mechanism to override these automatic operations. The override lets the application exercise greater control either over the source of objects that are placed into the cache or the time they are to remain there. The FetchUrl method allows you this greater degree of control.
To delete an object from the cache, set FetchUrl to an empty string, and set CacheUrl to the URL of the object to remove from the cache. When you delete an object by using FetchUrl, you can perform the operation synchronously or asynchronously, and the Time to Live (TTL) must be set to 0.
Sub FetchUrl( _ ByVal FetchUrl As String, _ ByVal CacheUrl As String, _ ByVal TtlInMinutes As Long, _ ByVal Flags As FpcFetchUrlFlags _ )
This parameter is ignored unless the Flags parameter includes either the fpcFetchTtlIfNone or fpcFetchTtlOverride flag. If neither flag is specified, the Web proxy's normal TTL computation mechanism is used for the object.
If you have set neither of these flags, the Web proxy uses its normal TTL computation mechanism for the object, which uses an "Expires" or "Cache-Control: max-age" HTTP header if available. Otherwise, the Web proxy estimates a good TTL value based on the time that has elapsed since the object was last modified.
In addition to the preceding flags, you can set one or more of the following flags:
This method has no return values. If the call is unsuccessful, an error is raised that can be intercepted by using an error handler.
To retrieve an HTTP object in response to a FetchUrl call, the Web proxy uses the normal HTTP GET method to the URL specified by FetchUrl. If there is already a cached copy (which was either loaded into the proxy server previously by normal operations or by an earlier call to FetchUrl) of the URL specified by CacheUrl, the Web proxy will include an If-Modified-Since header in the request (such a request is known as a conditional GET request). The response to a conditional GET may be either a new copy of the data, which will be stored in the cache, or a 304 (Not Modified) response, which will cause the Web proxy to extend the TTL of the object without changing the contents of the data in the cache.
To delete an object from the cache, set FetchUrl to an empty string, and set CacheUrl to the URL of the object to remove from the cache. When you delete an object using FetchUrl, you can perform the operation synchronously or asynchronously, and the TTL must be set to 0.
The DeleteURL VBScript provided with ISA Server in the folder SDK\samples\admin\scripts demonstrates how to delete a cached object.
Note ERROR_INTERNET_UNABLE_TO_CACHE_FILE (decimal value 12158, hex value 2F7E) is a new value that is not present in all versions of the WinINet API include files. This error code is returned if the HTTP headers in the object or other factors prohibited the Web proxy from caching the object. The caller may still be able to force the object into the cache using the fpcFetchForceCache flag.
Server: Requires Windows Server 2003 or
Windows 2000.
Version: Requires Internet Security and Acceleration
Server 2004.
Header: Declared in Msfpccom.idl.
Library: Use Microsoft Internet Security and Acceleration
Server 2004 Administration Library.