共用方式為


Using Flags to Control Caching

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

The Windows Internet Services (WinInet) function flags enable an application to control when and how it uses the cache. These flags can be used alone or in combination with the dwFlags parameter in functions that access data or resources on the Internet. The WinInet functions store all data downloaded from the Internet by default.

The following table shows values that can be used with the WinInet functions to control caching.

Value Description

INTERNET_FLAG_DONT_CACHE

Does not cache the data, either locally or in any gateways. Identical to the preferred value, INTERNET_FLAG_NO_CACHE_WRITE.

INTERNET_FLAG_HYPERLINK

Forces the application to reload a resource if no expire time and no last-modified time was returned when the resource was stored in the cache.

INTERNET_FLAG_MUST_CACHE_REQUEST

Causes a temporary file to be created if the file cannot be cached. Identical to the preferred value, INTERNET_FLAG_NEED_FILE.

INTERNET_FLAG_NEED_FILE

Causes a temporary file to be created if the file cannot be cached.

INTERNET_FLAG_NO_CACHE_WRITE

Rejects any attempt by the function to store data downloaded from the Internet in the cache. This flag is necessary if the application does not require downloaded resources to be stored locally. If the INTERNET_FLAG_HYPERLINK flag is also specified, WinInet will create the cache file but will not commit it.

INTERNET_FLAG_OFFLINE

Prevents the application from making requests to the network. All requests are resolved using the resources stored in the cache. If the resource is not in the cache, a suitable error, such as ERROR_FILE_NOT_FOUND, is returned.

INTERNET_FLAG_RELOAD

Forces the function to retrieve the requested resource directly from the Internet. The data that is downloaded is stored in the cache.

INTERNET_FLAG_RESYNCHRONIZE

Causes an application to perform a conditional download of the resource from the Internet. If the version stored in the cache is current, the data is downloaded from the cache. Otherwise, the data is reloaded from the server.

See Also

Concepts

Caching