How to choose a variety of caching mechanisms for WebView?

there are many caching mechanisms in WebView. How to choose these caching mechanisms? After the selection, there is no need to do further operations, the cache mechanism will help us to do the relevant caching and read cache operations?

I have learned about the caching mechanism of WebView. One of them is the browser caching mechanism, which is included in the Chrom kernel WebView. It already has a default caching mechanism, so there is no need to do caching processing. I think some of the code has all the caching mechanisms turned on (the following code). Is this appropriate?

related codes

/ enable DOM storage API function
webSettings.setDomStorageEnabled (true);
/ / enable database storage API function
webSettings.setDatabaseEnabled (true);
String cacheDirPath = getFilesDir (). GetAbsolutePath () + APP_CACAHE_DIRNAME;
/ / set database cache path
webSettings.setDatabasePath (cacheDirPath);
/ / set Application Caches cache directory
webSettings.setAppCachePath (cacheDirPath);
/ / enable Application Caches function
webSettings.setAppCacheEnabled (true);
webSettings.setLoadWithOverviewMode (true);
/ / set WebView to support JavaScript
webSettings.setJavaScriptEnabled (true);
/ / Settings can access files
webSettings.setAllowFileAccess (true);
/ / Settings support scaling
webSettings.setBuiltInZoomControls (true);
webSettings.setDefaultTextEncodingName ("UTF-8");

whether to choose one caching mechanism for WebView or to enable all of them. WebView will determine which caching mechanism will be used for itself.

Mar.30,2021

Web cache can be understood as the copy of Web resource on Web server and client (browser). Its function is to reduce network bandwidth consumption, server pressure and network delay, and speed up page opening.

WebView is a component packaged in SDK with a high-performance webkit kernel browser built into the phone. Instead of providing an address bar and navigation bar, WebView simply shows a web interface. It can be understood simply as an abbreviated version of the browser and supports the html caching mechanism

advantage of webview: speed-cached resources are local resources, so they load faster and provide user experience. Less server load-browsers only download resources from servers that have changed. Offline browsing-users can browse your complete web page while offline

reference:
Android WebView caching mechanism
H5 and mobile WebView caching mechanism parsing and implementation
webView offline caching mechanism

Menu