A webview cache optimization method based on heat algorithm

Through the cache optimization method based on the popularity algorithm, the weight is calculated using user tags and historical click data, the problems of large memory usage and slow loading speed caused by the cache demand of webviews of super-large applications are solved, and efficient caching and optimized user experience is achieved.

CN113536176BActive Publication Date: 2024-11-29ZHEJIANG HAIXINZHIHUI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110855839.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-28
Publication Date
2024-11-29
Estimated Expiration
2041-07-28

AI Technical Summary

Technical Problem

In mobile terminal applications, the webview cache requirements of super-large applications lead to problems such as large memory usage, waste of traffic and slow loading speed. The existing offline caching mechanism cannot be effectively optimized, resulting in poor user experience.

Method used

The cache optimization method based on the popularity algorithm is adopted to calculate the weight through user tags and historical click data, and only high-weight resources are loaded to achieve refined cache control and extend cache time, avoid infinite expansion, and improve startup speed and page performance.

Benefits of technology

The number of cache applications is effectively controlled, ensuring the 100ms-level webview startup speed of 99.9% of users, optimizing page performance, improving user experience, and achieving efficient cache management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure SMS_1
    Figure SMS_1
  • Figure SMS_2
    Figure SMS_2
  • Figure SMS_3
    Figure SMS_3
Patent Text Reader

Abstract

The present invention discloses a webview cache optimization method based on a heat algorithm in the technical field of a webview cache optimization method based on a heat algorithm. According to the heat algorithm, different weights are set according to user tags (including geographic location, network connection method, device type, user age, user gender, user cancer type and disease stage), screen position tags (8 positions at the center of the screen and around the screen), and historical click tags. The weighted total is used as the ranking rank value of the webview application. The applications are sorted from large to small according to the values, and only the top ten are loaded. The number of applications loaded into the cache is effectively controlled, avoiding unlimited expansion of the application volume and memory occupied. Under limited cache, the heat algorithm is used to effectively ensure that 99.9% of users still have a webview startup of 100ms.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of webview cache optimization methods, and in particular to a webview cache optimization method based on a heat algorithm. Background Art

[0002] With the rapid development of the mobile terminal field and the high requirements of enterprises on the speed of app product development and iteration, when the app enters the homepage, at least 40 web page entrances will appear at the same time. The average size of these web pages is 7m. Because the web pages are large, they need to be cached in advance to ensure the opening speed. Preloading all of them is not allowed in actual situations, and users generally cannot click on all the entrances when opening, so only the HTML code of some entrances can be preloaded. The existing offline cache mechanism requires a lot of memory space. For small applications or applications with a small number of webviews, there will be no memory crisis, but for super-large applications, the cache demand of webview will be A very large order of magnitude. Simply downloading the cache in advance requires a lot of traffic. Many pages or internal applications may never be opened by users. Such downloads will cause a waste of resources. A large number of caches downloaded in advance will have the problem of concurrent loss. The loss of some large files will cause a significant increase in the loading speed, thus losing the meaning of caching. Each time, the network address image needs to be loaded. In this way, a large number of network image requests each time can easily cause the page to be overloaded, resulting in poor page loading performance. In addition, when the number of images is large and the network speed is slow, it is easy to cause the page images to be loaded incompletely, resulting in a very poor user experience. For this reason, we propose a webview cache optimization method based on a heat algorithm. Summary of the invention

[0003] The purpose of the present invention is to provide a webview cache optimization method based on a heat algorithm to solve the problems raised in the above background technology.

[0004] To achieve the above object, the present invention provides the following technical solution: a webview cache optimization method based on a heat algorithm, and the specific steps of cache optimization are:

[0005] S1: The user sends a request to load the corresponding HTML page through the webview on the mobile terminal APP. At the same time, different regional entrances are divided on the APP display page, and the different regional entrances are divided into primary and secondary ones and labeled with locations. At the same time, the location labels of the regions are used as the basis for setting weights for cache optimization;

[0006] S2: When the APP application is started, it is determined whether the local cache file is consistent with the latest resource file on the server. When the local cache file is inconsistent with the latest resource file on the server, the incremental package between the local cache file and the latest resource file on the server is downloaded to update the local cache file by downloading the incremental package, thereby increasing the cache capacity;

[0007] S3: The application determines whether a request for a webview webpage resource is detected. When a request for a webview webpage resource is detected, the application loads a resource file corresponding to the request for the webview webpage resource from a local cache file.

[0008] S4: The business logic unit of the loading page obtains the data information in the loading request, and loads the corresponding network resource information address through the img tag and establishes the corresponding user tag on the webview, and uses the user tag as the basis for setting the weight for cache optimization;

[0009] S5: Obtain the network resource information address intercepted in the loading request, and generate a resource information file name with an algorithm value obtained based on a preset heat algorithm according to the obtained network resource information address;

[0010] S6: The webview of the mobile terminal refers to the obtained resource information file name with the algorithm value, searches the local resource cache file of the mobile terminal, determines whether there is a file package with the same resource information file name with the algorithm value, and then caches the requested resource information data in the webview resource information cache area directory in the mobile terminal for display;

[0011] S7: The system application counts historical request click tags according to the loading request of the corresponding HTML page loaded by the webview, and divides the request click tags into six levels as the basis for setting weights for cache optimization;

[0012] S8: All HTML entries can find corresponding tags in Table A (regional location), Table B (user information), and Table C (device type). The basic weight of the position in the historical click count table, i.e. Dx, can be obtained through the corresponding table. This is used as the basic data for the weight calculation method. All click events will clear the data before one month. At the same time, D1=A1*10+B1a*5+C1a*5;

[0013] S9: Before implementing the heat algorithm, prepare the parameters, including the division of screen positions on the webview, classification of user information, and device type. Then multiply the historical click count by 15 as the historical click heat weight. Finally, use the sum of the basic weight and the historical click heat weight as the final basis for the event intelligent sorting algorithm. Sort the final results from large to small according to size, and only take the top ten values ​​for HTML loading processing.

[0014] Preferably, the user tags in step S4 are divided into (regional location) A, (user information) B, and (device type) C.

[0015] Preferably, (area position) A is divided into display areas with different weights, and recorded as A1-A9, specifically: A1 weight is 4, A2 weight is 7, A3 weight is 4, A4 weight is 7, A5 weight is 10, A6 weight is 7, A7 weight is 4, A8 weight is 7, and A9 weight is 4.

[0016] Preferably, (user information) B includes user age B1, user gender B2, user cancer type B3, and disease stage B4.

[0017] Preferably, (device type) C includes geographic location C1, network connection mode C2, and device type C3.

[0018] Preferably, the six levels in step S7 are divided into: more than 100 times, 50-100 times, 20-50 times, 10-20 times, 1-10 times, and 0 times.

[0019] Compared with the prior art, the present invention has the following beneficial effects:

[0020] 1. The present invention sets different weights according to the heat algorithm, user tags (including geographic location, network connection mode, device type, user age, user gender, user cancer type and disease stage), screen position tags (screen center and 8 positions around the screen), and historical click tags (more than 100 times, 50-100 times, 20-50 times, 10-20 times, 1-10 times, 0 times). The weighted total is used as the rank value of the webview application. The rank is sorted from large to small according to the value, and only the top ten are loaded. The number of applications loaded into the cache is effectively controlled, avoiding the unlimited expansion of the application volume and the memory occupied. Under limited cache, the heat algorithm effectively ensures that 99.9% of users still have a 100ms-level webview startup;

[0021] 2. On the one hand, the present invention caches the data to be cached by weight, and achieves caching of high-weight data for a longer time through weight setting. On the other hand, it also takes into account the heat algorithm, and when the cached data is accessed again, it will be cached for a longer time, thereby achieving refined control of the cache, achieving efficient caching, and helping to speed up the response time of other requests issued by the user at the same time, which is beneficial to optimizing page performance and improving user satisfaction. DETAILED DESCRIPTION

[0022] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0023] Embodiment: A webview cache optimization method based on a heat algorithm, the specific steps of cache optimization are:

[0024] S1: The user sends a request to load the corresponding HTML page through the webview on the mobile terminal APP. At the same time, different regional entrances are divided on the APP display page, and the different regional entrances are divided into primary and secondary ones and labeled with locations. At the same time, the location labels of the regions are used as the basis for setting weights for cache optimization;

[0025] S2: When the APP application is started, it is determined whether the local cache file is consistent with the latest resource file on the server. When the local cache file is inconsistent with the latest resource file on the server, the incremental package between the local cache file and the latest resource file on the server is downloaded to update the local cache file by downloading the incremental package, thereby increasing the cache capacity;

[0026] S3: The application determines whether a request for a webview webpage resource is detected. When a request for a webview webpage resource is detected, the application loads a resource file corresponding to the request for the webview webpage resource from a local cache file.

[0027] S4: The business logic unit of the loading page obtains the data information in the loading request, and loads the corresponding network resource information address through the img tag and establishes the corresponding user tag on the webview, and uses the user tag as the basis for setting the weight for cache optimization;

[0028] S5: Obtain the network resource information address intercepted in the loading request, and generate a resource information file name with an algorithm value obtained based on a preset heat algorithm according to the obtained network resource information address;

[0029] S6: The webview of the mobile terminal refers to the obtained resource information file name with the algorithm value, searches the local resource cache file of the mobile terminal, determines whether there is a file package with the same resource information file name with the algorithm value, and then caches the requested resource information data in the webview resource information cache area directory in the mobile terminal for display;

[0030] S7: The system application counts historical request click tags according to the loading request of the corresponding HTML page loaded by the webview, and divides the request click tags into six levels as the basis for setting weights for cache optimization;

[0031] S8: All HTML entries can find corresponding tags in Table A (regional location), Table B (user information), and Table C (device type). The basic weight of the position in the historical click count table, i.e. Dx, can be obtained through the corresponding table. This is used as the basic data for the weight calculation method. All click events will clear the data before one month. At the same time, D1=A1*10+B1a*5+C1a*5;

[0032] S9: Before implementing the heat algorithm, prepare parameters, including the division of screen positions on the webview, classification of user information, and device type. Then multiply the number of historical clicks by 15 as the historical click heat weight. Finally, use the sum of the basic weight and the historical click heat weight as the final basis for the event intelligent sorting algorithm. Sort the final results from large to small according to size, and only take the top ten values ​​for HTML loading processing.

[0033] The user tags in step S4 are divided into (regional location) A, (user information) B, and (device type) C;

[0034] (Regional Position) A is divided into display areas of different weights and recorded as A1-A9. Specifically, A1 has a weight of 4, A2 has a weight of 7, A3 has a weight of 4, A4 has a weight of 7, A5 has a weight of 10, A6 has a weight of 7, A7 has a weight of 4, A8 has a weight of 7, and A9 has a weight of 4. Please refer to the table below for details:

[0035]

[0036] (User information) B includes user age B1, user gender B2, user cancer type B3, and disease stage B4. Please refer to the following table for details:

[0037]

[0038] (Device type) C includes geographic location C1, network connection method C2, and device type C3. Please refer to the following table for details:

[0039]

[0040] Please refer to the following table for the breakdown of the types of basic weight Dx:

[0041]

[0042] The six levels in step S7 are: more than 100 times, 50-100 times, 20-50 times, 10-20 times, 1-10 times, and 0 times;

[0043] The present invention sets different weights according to the heat algorithm, user tags (including geographic location, network connection mode, device type, user age, user gender, user cancer type and disease stage), screen position tags (screen center and 8 positions around the screen), and historical click tags (more than 100 times, 50-100 times, 20-50 times, 10-20 times, 1-10 times, 0 times), and the weighted total is used as the ranking rank value of the webview application. The rank is sorted from large to small according to the value, and only the top ten are loaded. The number of applications loaded into the cache is effectively controlled, avoiding the application volume. and the infinite expansion of memory occupied. Under limited cache, the heat algorithm effectively ensures that 99.9% of users still have a 100ms-level webview startup. On the one hand, the data to be cached is cached by weight, and the weight setting is used to cache the data with high weight for a longer time. On the other hand, the heat algorithm is also taken into account. When the cached data is accessed again, it will be cached for a longer time, realizing refined control of the cache, realizing efficient caching, and helping to speed up the response time of other requests issued by users at the same time, which is beneficial to optimize page performance and improve user satisfaction.

[0044] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A webview cache optimization method based on a heat algorithm, characterized in that: The specific steps of cache optimization are: S1: The user sends a request to load the corresponding HTML page through the webview on the mobile terminal APP. At the same time, different regional entrances are divided on the APP display page, and the different regional entrances are divided into primary and secondary ones and labeled with locations. At the same time, the location labels of the regions are used as the basis for setting weights for cache optimization; S2: When the APP application is started, it is determined whether the local cache file is consistent with the latest resource file on the server. When the local cache file is inconsistent with the latest resource file on the server, the incremental package between the local cache file and the latest resource file on the server is downloaded to update the local cache file by downloading the incremental package, thereby increasing the cache capacity; S3: The application determines whether a request for a webview webpage resource is detected. When a request for a webview webpage resource is detected, the application loads a resource file corresponding to the request for the webview webpage resource from a local cache file. S4: The business logic unit of the loading page obtains the data information in the loading request, and loads the corresponding network resource information address through the img tag and establishes the corresponding user tag on the webview, and uses the user tag as the basis for setting the weight for cache optimization; S5: Obtain the network resource information address intercepted in the loading request, and generate a resource information file name with an algorithm value obtained based on a preset heat algorithm according to the obtained network resource information address; S6: The webview of the mobile terminal refers to the obtained resource information file name with the algorithm value, searches the local resource cache file of the mobile terminal, determines whether there is a file package with the same resource information file name with the algorithm value, and then caches the requested resource information data in the webview resource information cache area directory in the mobile terminal for display; S7: The system application counts historical request click tags according to the loading request of the corresponding HTML page loaded by the webview, and divides the request click tags into six levels as the basis for setting weights for cache optimization; S8: All HTML entries find corresponding tags in the regional position table A, user information table B, and device type table C. The basic weight of the position in the historical click count table is obtained through the corresponding table, that is, Dx, which is used as the basic data for the weight calculation method. All click events will clear the data before one month, and D1=A1*10+B1a*5+C1a*5; S9: Before implementing the heat algorithm, prepare the parameters, including the division of screen positions on the webview, classification of user information, and device type. Then multiply the historical click count by 15 as the historical click heat weight. Finally, use the sum of the basic weight and the historical click heat weight as the final basis for the event intelligent sorting algorithm. Sort the final results from large to small according to size, and only take the top ten values ​​for HTML loading processing.

2. According to a webview cache optimization method based on a heat algorithm according to claim 1, it is characterized in that: The user tags in step S4 are divided into regional location A, user information B, and device type C.

3. According to a webview cache optimization method based on a heat algorithm according to claim 2, it is characterized in that: Area position A is divided into display areas with different weights and recorded as A1-A9, specifically: A1 weight is 4, A2 weight is 7, A3 weight is 4, A4 weight is 7, A5 weight is 10, A6 weight is 7, A7 weight is 4, A8 weight is 7, and A9 weight is 4.

4. According to a webview cache optimization method based on a heat algorithm according to claim 2, it is characterized in that: The user information B includes the user's age B1, the user's gender B2, the user's cancer type B3, and the disease stage B4.

5. According to a webview cache optimization method based on a heat algorithm according to claim 2, it is characterized in that: The device type C includes the geographical location C1, the network connection mode C2, and the device type C3.

6. According to a webview cache optimization method based on a heat algorithm according to claim 1, it is characterized in that: The six levels in step S7 are divided into: more than 100 times, 50-100 times, 20-50 times, 10-20 times, 1-10 times, and 0 times.

Citation Information

Patent Citations

  • Cross-platform image caching implementation method based on webview of mobile terminal

    CN107291519A

  • Domain name processing method and device, readable storage medium and electronic device

    CN110149423A