Compartilhar via


swapCache method

Swaps an old cache for a newer one.

 

Syntax

HRESULT retVal = object.swapCache();

Parameters

This method has no parameters.

Return value

Type: HRESULT

This method can return one of these values.

Return code/value Description
S_OK
DOMException.INVALID_STATE_ERR 11

This exception is thrown if the IHTMLApplicationCache::status of the cache is invalid.

 

Exceptions

Exception Condition
InvalidStateError

TThis exception is thrown if the IHTMLApplicationCache::status of the cache is invalid. For versions earlier than Internet Explorer 10, INVALID_STATE_ERR is returned.

 

Remarks

In order to swap an old cache out for a new one, call IHTMLApplicationCache::update first. When the status is in the UPDATEREADY state, calling IHTMLApplicationCache::swapCache will make the swap.

Calling IHTMLApplicationCache::swapCache will not update any content on your page. It will simply allow your webpage to be able to access any further dynamic content from the new cache instead of the old one. After the page is refreshed, the newly created cache will be used for all in-page and dynamic requests.

The IHTMLApplicationCache::swapCache method is provided for convenience but is not necessary for basic functionality. Loading or refreshing the page is sufficient. For example, refreshing the page after an UpdateReady event will reload the page from the new cache without a call to IHTMLApplicationCache::swapCache.

IHTMLApplicationCache::swapCache does not cause previously-loaded resources to be reloaded; for example, images do not suddenly get reloaded, and style sheets and scripts do not get reparsed or reevaluated. The only change is that subsequent requests for cached resources will obtain the newer copies.