Stores data in the specified file in the Internet cache and associates it with the given URL.
Syntax
BOOL CommitUrlCacheEntry( IN LPCTSTR lpszUrlName, IN LPCTSTR lpszLocalFileName, IN FILETIME ExpireTime, IN FILETIME LastModifiedTime, IN DWORD CacheEntryType, IN LPHACK lpHeaderInfo, IN DWORD dwHeaderSize, IN LPCTSTR lpszFileExtension, IN LPCTSTR lpszOriginalUrl );The actual syntax of this function varies between its ANSI and Unicode implementations. For more information, see Win32 Internet Functions Syntax.
Parameters
- lpszUrlName
- Address of a string variable that contains the source name of the cache entry. The name string must be unique and should not contain any escape characters.
- lpszLocalFileName
- Address of a string variable that contains the name of the local file that is being cached. This should be the same name as that returned by CreateUrlCacheEntry.
- ExpireTime
- FILETIME structure that contains the expire date and time (in Greenwich mean time) of the file that is being cached. If the expire date and time is unknown, set this parameter to zero.
- LastModifiedTime
- FILETIME structure that contains the last modified date and time (in Greenwich mean time) of the URL that is being cached. If the last modified date and time is unknown, set this parameter to zero.
- CacheEntryType
- Unsigned long integer value that contains the cache type bitmask. This can be a combination of the following values:
- COOKIE_CACHE_ENTRY
- EDITED_CACHE_ENTRY
- NORMAL_CACHE_ENTRY
- SPARCE_CACHE_ENTRY
- STICKY_CACHE_ENTRY
- TRACK_CACHE_ENTRY
- TRACK_OFFLINE_CACHE_ENTRY
- TRACK_ONLINE_CACHE_ENTRY
- URLHISTORY_CACHE_ENTRY
The STICKY_CACHE_ENTRY type is used to make cache entries exempt from scavenging. The default exempt time for entries set using CommitUrlCacheEntry is one day. The exempt time can be changed using the SetUrlCacheEntryInfo function.
- lpHeaderInfo
- Address of the buffer containing the header information. If this parameter is not NULL, the header information is treated as extended attributes of the URL that are returned in the INTERNET_CACHE_ENTRY_INFO structure.
- dwHeaderSize
- Unsigned long integer value that contains the size of the header information in TCHAR. If lpHeaderInfo is not NULL, this value is assumed to indicate the size of the buffer that will store the header information. An application can maintain headers as part of the data and provide dwHeaderSize together with a NULL value for lpHeaderInfo.
- lpszFileExtension
- Reserved. Must be set to NULL.
- lpszOriginalUrl
- Address of a string variable that contains the original URL if redirection has occurred.
Return Value
Returns TRUE if successful, or FALSE otherwise. To get extended error information, call GetLastError. Possible error values include:
ERROR_DISK_FULL The cache storage is full. ERROR_FILE_NOT_FOUND The specified local file is not found.
Remarks
If the cache storage is full, CommitUrlCacheEntry invokes cache cleanup to make space for this new file. If the cache entry already exists, the function overwrites the entry if it is not in use. An entry is in use when it has been retrieved with either RetrieveUrlCacheEntryStream or RetrieveUrlCacheEntryFile.
Clients that add entries to the cache should set the headers to at least "HTTP/1.0 200 OK\r\n\r\n"; otherwise, Microsoft Internet Explorer and other client applications that are utilizing the Win32 Internet functions will disregard the entry.
Function Information
Windows NT Use version 4.0. Implemented as ANSI and Unicode functions. Windows Use Windows 95 and later. Implemented as ANSI and Unicode functions. Header Wininet.h Import library Wininet.lib Minimum availability Internet Explorer 3.0 (ANSI only), 5 (ANSI and Unicode)
Windows CE
Windows CE Use version 2.12 and later. Implemented as ANSI and Unicode functions. Minimum availability Internet Explorer 4.0
See Also
Microsoft Win32 Internet Functions Overview, Caching, Microsoft Win32 Internet Functions Reference, Persistent URL Cache Functions, CreateUrlCacheEntry