Class (BackForwardCacheOptions)

Implements a BackForwardCacheOptions object to set back-forward cache options of the Web component.

NOTE

  • The initial APIs of this module are supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version.

  • The initial APIs of this class are supported since API version 12.

  • The sample effect is subject to the actual device.

System capability: SystemCapability.Web.Webview.Core

Attributes

Name Type Read-Only Optional Description
size12+ number No No The maximum number of pages that can be cached in a Web component.
The default value is 1, and the maximum value is 50.
If this parameter is set to 0 or a negative value, the back-forward cache is disabled.
The Web component reclaims the cache for memory pressure.
timeToLive12+ number No No The time that a Web component allows a page to stay in the back-forward cache.
If this parameter is set to 0 or a negative value, the back-forward cache is disabled.
Default value: 600
Unit: second

constructor12+

constructor()

Constructs a BackForwardCacheOptions object.

System capability: SystemCapability.Web.Webview.Core