A page data caching method and related device

By obtaining and verifying cache configuration information when the client starts, H5 page resources are pre-cached, which solves the problem of uncontrollable browser caching, and achieves fast loading and improved user experience.

CN115270023BActive Publication Date: 2026-05-12SHENZHEN LEXIN SOFTWARE TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN LEXIN SOFTWARE TECH CO LTD
Filing Date
2022-07-19
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

The browser's built-in WebView cache has a limited and uncontrollable size, resulting in excessively long initial load times for H5 pages and impacting user experience.

Method used

When the client starts, it obtains the target cache configuration information from the server, verifies the page identification information, and obtains the target page cache information to achieve pre-caching and reduce page loading time.

Benefits of technology

By pre-caching H5 page resources, loading time is reduced, user experience is improved, and instant loading is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115270023B_ABST
    Figure CN115270023B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a page data caching method and related device, which are used to reduce the loading time of a page and improve user experience. The method of the embodiments of the present application comprises the following steps: when an application program of a client is started, obtaining target cache configuration information from a cache interface of a server corresponding to the application program, the target cache configuration information comprising target page parameter information of a page and target page identifier information matched with the target page parameter information; when a first page is accessed, obtaining first page parameter information of the first page and first page identifier information matched with the first page parameter information; checking whether the first page identifier information is the same as any page identifier information in the target page identifier information and whether the first page identifier information is not saved in the client; and if the first page identifier information is the same as any page identifier information in the target page identifier information and the first page identifier information is not saved in the client, sending a data caching instruction to the cache interface according to the target page parameter information to obtain target page cache information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software technology, and in particular to a page data caching method and related equipment. Background Technology

[0002] With the development of mobile internet technology, applications (APPs) are becoming increasingly powerful. Meanwhile, HTML5 (H5) pages are becoming more and more commonly used in APPs due to their high flexibility, low development cost, and short production cycle.

[0003] As app functionality becomes increasingly sophisticated, the amount of resource data within these apps grows significantly. Currently, opening an H5 page within an app environment involves rendering the page using the client's system webview, leveraging the browser's built-in webview caching mechanism for static resources. However, when opening an H5 page for the first time without prior access, a request to download all necessary resource files is required before rendering the page. Since the browser's built-in webview cache is limited and uncontrollable, and the caching logic for static resources cannot be controlled, this significantly increases the initial page load time, negatively impacting the user experience and degrading overall performance. Summary of the Invention

[0004] This application provides a page data caching method to reduce page loading time and improve user experience.

[0005] The first aspect of this application provides a page data caching method applied to a client, including:

[0006] When the client application starts, it obtains the target cache configuration information from the cache interface of the server corresponding to the application. The target cache configuration information includes the target page parameter information of the page and the target page identifier information that matches the target page parameter information one by one.

[0007] When the first page is accessed, the first page parameter information of the first page and the first page identifier information that matches the first page parameter information are obtained.

[0008] Verify whether the first page identifier information is the same as any page identifier information in the target page identifier information and whether the client has not saved the first page identifier information;

[0009] If the results are identical and the first page identifier information is not saved, a data caching instruction is sent to the caching interface based on the target page parameter information to obtain the target page cache information.

[0010] Optionally, after sending a data caching instruction to the caching interface based on the target page parameter information to obtain the target page cache information, the method further includes:

[0011] The target page cache information is saved locally according to a preset format.

[0012] Optionally, saving the target page cache information locally according to a preset format includes:

[0013] The target page cache information is named according to the matching relationship between the target page parameter information and the target page identifier information to form the naming information of the target page cache information;

[0014] The target page cache information is saved to the client according to the naming information format;

[0015] The target page parameter information and the target matching relationship of the naming information are saved to the client.

[0016] Optionally, after saving the target page parameter information and the target matching relationship of the naming information to the client, the method further includes:

[0017] When accessing the second page, obtain the second page parameter information;

[0018] Determine whether to update the target matching relationship based on the parameter information on the second page;

[0019] If so, obtain the first cache configuration information corresponding to the second page from the cache interface to determine whether the first cache configuration information contains page identifier information that is the same as the target page identifier information;

[0020] If not, access the second page using the HTTPS protocol for Hypertext Transfer.

[0021] Optionally, the first cache configuration information includes second page identifier information that matches the second page parameter information, and determining whether the first cache configuration information contains page identifier information that is the same as the target page identifier information includes:

[0022] Determine whether the target page identifier information contains the second page identifier information;

[0023] If so, update the target page parameter information to the second page parameter information;

[0024] If not, proceed with the step of accessing the second page according to the Hypertext Transfer HTTPS protocol.

[0025] Optionally, after saving the target page cache information locally according to a preset format, the method further includes:

[0026] When any page in the page is accessed, the page is rendered according to the target page cache information stored locally.

[0027] Optionally, rendering any one of the pages based on the locally stored target page cache information includes:

[0028] The data caching instruction is sent to the caching interface according to the second page parameter information to obtain the target page cache information corresponding to the second page parameter information;

[0029] The second page is rendered based on the target page cache information corresponding to the second page parameter information stored locally.

[0030] Optionally, after saving the target page cache information locally according to a preset format, the method further includes:

[0031] When obtaining the target page cache information, obtain the real-time time information;

[0032] The real-time information is written into the target page cache information, and the target page cache information after the real-time information is written is saved locally.

[0033] Optionally, after writing the real-time information into the target page cache information and saving the target page cache information locally, the method further includes:

[0034] If the application is closed, obtain the current time information of when the application was closed;

[0035] The real-time time information and the current time information are used to calculate the result.

[0036] Determine whether the calculation result is greater than a preset threshold;

[0037] If so, delete the cached information of the target page.

[0038] A second aspect of this application provides a page data caching system applied to a client, comprising:

[0039] The acquisition unit is used to acquire target cache configuration information from the cache interface of the server corresponding to the application when the client application starts. The target cache configuration information includes target page parameter information of the page and target page identifier information that matches the target page parameter information one by one.

[0040] The acquisition unit is further configured to acquire, when accessing the first page, first page parameter information of the first page and first page identifier information matching the first page parameter information;

[0041] The verification unit is used to verify whether the first page identification information is the same as any page identification information in the target page identification information and whether the client has not saved the first page identification information.

[0042] The sending unit is used to send a data caching instruction to the caching interface according to the target page parameter information when the target page identifier information is the same and the first page identifier information is not saved, so as to obtain the target page cache information.

[0043] Optionally, the system further includes: a storage unit;

[0044] The storage unit is used to save the target page cache information locally according to a preset format.

[0045] Optionally, the system further includes: a naming unit;

[0046] The naming unit is used to name the target page cache information according to the matching relationship between the target page parameter information and the target page identifier information, so as to form the naming information of the target page cache information;

[0047] The storage unit is specifically used to save the target page cache information to the client according to the format of the naming information;

[0048] The storage unit is specifically used to save the target page parameter information and the target matching relationship of the naming information to the client.

[0049] Optionally, the system further includes: a judgment unit and an access unit;

[0050] The acquisition unit is further configured to acquire second page parameter information of the second page when accessing the second page;

[0051] The judgment unit is used to determine whether to update the target matching relationship based on the second page parameter information;

[0052] The acquisition unit is specifically used to acquire first cache configuration information corresponding to the second page from the cache interface when the target matching relationship is updated according to the second page parameter information, so as to determine whether the first cache configuration information has page identifier information that is the same as the target page identifier information;

[0053] The access unit is used to access the second page according to the Hypertext Transfer Protocol (HTTPS) when the target matching relationship is not updated based on the second page parameter information.

[0054] Optionally, the system further includes: an update unit and an execution unit;

[0055] The determination unit is specifically used to determine whether the target page identification information contains the second page identification information;

[0056] The updating unit is used to update the target page parameter information to the second page parameter information when the target page identifier information exists;

[0057] The execution unit is configured to perform the step of accessing the second page according to the Hypertext Transfer HTTPS protocol when the target page identification information does not contain the second page identification information.

[0058] Optionally, the system further includes: a rendering unit;

[0059] The rendering unit is used to render any page according to the target page cache information stored locally when any page is accessed.

[0060] Optionally,

[0061] The sending unit is specifically used to send the data caching instruction to the caching interface according to the second page parameter information, so as to obtain the target page caching information corresponding to the second page parameter information;

[0062] The rendering unit is specifically used to render the second page according to the target page cache information corresponding to the second page parameter information stored locally.

[0063] Optionally, the system further includes: a writing unit;

[0064] The acquisition unit is also used to acquire real-time time information when acquiring the target page cache information;

[0065] The writing unit is used to write the real-time information into the target page cache information and save the target page cache information after writing the real-time information locally.

[0066] Optionally, the system further includes: a calculation unit and a deletion unit;

[0067] The acquisition unit is further configured to acquire the current time information of closing the application when the application is closed;

[0068] The calculation unit is used to calculate the real-time time information and the current time information to obtain the calculation result;

[0069] The judgment unit is also used to determine whether the calculation result is greater than a preset threshold.

[0070] The deletion unit is used to delete the target page cache information when the calculation result is greater than a preset threshold.

[0071] The second aspect of the embodiments of this application provides a method for performing the method described in the first aspect.

[0072] A third aspect of this application provides a page data caching device, comprising:

[0073] Central processing unit, memory, input / output interfaces, wired or wireless network interfaces, and power supply;

[0074] The memory is either a short-term storage memory or a persistent storage memory;

[0075] The central processing unit is configured to communicate with the memory and execute instructions in the memory to perform the method described in the first aspect.

[0076] A fourth aspect of this application provides a computer-readable storage medium, characterized in that the computer-readable storage medium includes instructions that, when executed on a computer, cause the computer to perform the method described in the first aspect.

[0077] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:

[0078] This application discloses a method for caching page data on a client-side. When the client application starts, it obtains target cache configuration information from the caching interface of the server corresponding to the application. Upon accessing the first page, it retrieves the first page parameter information and a first page identifier information matching the first page parameter information. It then verifies whether the first page identifier information is identical to any page identifier information in the target page identifier information and whether the client has not saved the first page identifier information. If they are identical and the first page identifier information is not saved, a data caching instruction can be sent to the caching interface based on the target page parameter information to obtain the target page cache information. Therefore, when opening the page, the cached page information can be directly used to replace the request for interface data, thereby reducing page loading time and achieving a near-instantaneous opening effect, resulting in a better user experience. Attached Figure Description

[0079] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings.

[0080] Figure 1 This is a schematic diagram of a system architecture for page data caching disclosed in an embodiment of this application;

[0081] Figure 2 This is a flowchart illustrating a page data caching method disclosed in an embodiment of this application;

[0082] Figure 3 This is a flowchart illustrating another page data caching method disclosed in an embodiment of this application;

[0083] Figure 4 This is a flowchart illustrating another page data caching method disclosed in an embodiment of this application;

[0084] Figure 5 This is a schematic diagram of the structure of a page data caching system disclosed in an embodiment of this application;

[0085] Figure 6 This is a schematic diagram of the structure of a page data caching device disclosed in an embodiment of this application. Detailed Implementation

[0086] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0087] It should be noted that the use of terms such as "first" and "second" in this application is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of those features. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, such a combination of technical solutions should be considered non-existent and not within the scope of protection claimed in this application.

[0088] With the development of mobile internet technology, applications (APPs) are becoming increasingly powerful. Meanwhile, H5 pages are also becoming more and more commonly used within APPs due to their high flexibility, low development costs, and short production cycles.

[0089] As app functionality becomes increasingly sophisticated, the amount of resource data within apps grows significantly. Currently, opening an H5 page within an app environment is done through the client's system webview, utilizing the browser's built-in webview caching mechanism for static resources. It's important to note that webview is a crucial control in the Android system, used to display web pages. On the Android platform, webview is a special type of view, a control based on the WebKit engine for displaying web pages. It can be used to display a single online webpage within an app, or it can be used to develop browsers. Internally, webview uses a rendering engine to display the view's content, providing functions such as page navigation, zooming in and out, and searching. For ease of description and understanding, the specific functionalities of webview will not be described in detail below.

[0090] This can easily lead to two problems: 1. When opening an H5 page that has not been accessed before within the app for the first time, it is necessary to request and download resource files such as HTML, JS, CSS, and images once before rendering the page. 2. The browser's built-in WebView cache size is limited and uncontrollable, making it impossible to control the caching logic of static page resources.

[0091] Therefore, this application proposes a page data caching method, which downloads the resources needed for H5 page rendering in advance when the APP starts, thereby reducing the first screen loading time of the H5 page and achieving the effect of instant opening.

[0092] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0093] Please see Figure 1 , Figure 1 This is a schematic diagram of a page data caching system architecture disclosed in an embodiment of this application. It includes a server 101 and a client 102.

[0094] like Figure 1 As shown, the system architecture may include server 101 and client 102. Client 102 may include client 102a, client 102b, client 102c, ..., client 102n, etc. Server 101 may be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud databases, cloud services, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Clients (including clients 102a, 102b, 102c, ..., 102n) may be smartphones, tablets, laptops, desktop computers, PDAs, mobile internet devices (MIDs), wearable devices (such as smartwatches, smart bracelets, etc.), smart computers, smart vehicles, and other smart terminals. Server 101 can establish communication connections with each client in client 102. In other words, server 101 can establish communication connections with each of the clients 102a, 102b, 102c, ..., 102n. For example, client 102a can establish a communication connection with server 101. The communication connection method is not limited; it can be established directly or indirectly via wired communication or wireless communication, depending on the specific application scenario. This application does not impose any restrictions on this method.

[0095] It should be understood that, such as Figure 1 Each client in the client cluster shown can have an application client installed. When this application client runs on each client, it can interact with the aforementioned... Figure 1The servers 101 shown interact with each other, allowing each client to receive business data (such as image cache data sent by the server) from the servers 101. The application (APP) on client 102 can be a social application, instant messaging application, live streaming application, game application, short video application, video application, music application, karaoke application, shopping application, novel application, payment application, or any other client 102 capable of displaying text, images, audio, and video data. The specific application can be determined based on the actual application scenario requirements and is not limited here. Client 102 can be a standalone client or an embedded sub-client integrated into another client (such as an instant messaging client, social client, etc.), depending on the actual application scenario and is not limited here. Taking a shopping application as an example, when a client uses the shopping application through client 102, server 101 can pre-send the corresponding page cache information to client 102 based on the caching configuration information of the shopping application. Shopping applications on each client (client 102a, client 102b, client 102c, ..., client 102n) that have established a communication connection with server 101 can obtain the corresponding page cache information. The method provided in this embodiment can be used by, for example... Figure 1 The server 101 shown can be executed, or it can be executed by a client (such as...). Figure 1 The client 102a, client 102b, ..., client 102n shown can be executed, or it can be executed jointly by the client and the server 101. The specific execution method can be determined according to the actual application scenario, and there are no restrictions here.

[0096] For ease of understanding and description, a page data caching method proposed in this application is described in detail below. Please refer to... Figure 2 , Figure 2 This is a flowchart illustrating a page data caching method disclosed in an embodiment of this application. It includes steps 201-204.

[0097] 201. When the client application starts, it obtains the target cache configuration information from the cache interface of the server corresponding to the application.

[0098] When an app is opened on the client, WKWebView is initialized in advance. It's worth noting that WKWebView is a browser control. This means initializing the browser process environment within the app, which makes opening an H5 page the first time faster (H5 pages are opened through the app's webview).

[0099] Specifically, when the app is warm-started, the client obtains the offline caching protocol JSON configuration list from the caching interface of the app's server. It should be noted that the offline caching protocol JSON configuration list described in this embodiment is the same as the target caching configuration information described above.

[0100] Correspondingly, the target cache configuration information is pre-written configuration information through the OA management platform. It should be noted that this OA management platform not only manages configurations but is also a JSON protocol generation platform (simply input the page URL) and provides a query interface, i.e., a caching interface. Furthermore, the OA management platform has other functions, which will not be elaborated upon in this embodiment, nor will the specific functions of the OA management platform be described further. It should also be noted that every webpage on the Internet has a unique name identifier, commonly called a Uniform Resource Locator (URL). It is the Uniform Resource Locator for the WWW; simply put, a URL is a web address, commonly known as a "web address." For ease of description and understanding, URLs will not be described in detail below.

[0101] Specifically, the app on the client side sends an API request to the server to obtain the target cache configuration information, which is a JSON configuration list, sent by the server through the caching interface. This target cache configuration information includes all target page parameters. In other words, the OA management platform can pre-configure the pages within the app that need to be pre-cached; correspondingly, it needs to set the page parameters, i.e., the page URLs, for those pages.

[0102] It's worth noting that this target cache configuration information includes pre-defined target page parameters for the pages to be cached, and target page identifiers that match these parameters one-to-one. The target page parameters are the URLs of the pages to be cached, and the target page identifiers are the message digest algorithm (MD5). Furthermore, MD5 is an encryption string, a widely used cryptographic hash function that produces a 128-bit hash value to ensure the integrity and consistency of transmitted information.

[0103] Furthermore, each time the app is warm-started, it can request the server to obtain the latest JSON list. It's worth noting that warm-start refers to the process of an app being switched to the background, then reopened and allowed by the user interface.

[0104] 202. When accessing the first page, obtain the first page parameter information and the first page identifier information that matches the first page parameter information.

[0105] When a user clicks on a page in the application interface, that is, when the client accesses the first subpage, the system can obtain the first page parameter information and the first page identifier information that matches the first page parameter information. It should be noted that the first page parameter information is the URL of the first page, and the first page identifier information is the MD5 hash corresponding to the URL of the first page.

[0106] It should be noted that when opening a certain app on the client,

[0107] 203. Verify whether the first page identifier information is the same as any page identifier information in the target page identifier information and whether the client has not saved the first page identifier information.

[0108] As shown in step 201, the target cache configuration information includes target page parameter information and target page identifier information that matches the target page parameter information one by one. Specifically, each piece of target page parameter information corresponds to a piece of target page identifier information.

[0109] Correspondingly, first, the list of offline cached resources is queried or read from the protocol JSON based on the page URL. Specifically, based on the first page parameter information, that is, the first page URL (filter parameter), the target page parameter information in the target cache configuration information is queried or read. Correspondingly, this means querying or reading the list of loaded resources for the first page from the protocol JSON based on the first page URL.

[0110] It should be added that the offline cache resource list is generated by a tool service to list the resources that this H5 page will load, and then sent to the CDN for the client APP to retrieve (when the APP initializes, it requests the cache interface to obtain an array of these CDN JSON data, and then performs pre-download processing for each page resource).

[0111] Next, it checks if the MD5 file exists in the local cache. Specifically, after decrypting the JSON description file (which is AES encrypted to prevent tampering), it checks if the MD5 file for the first page exists in the local cache. If it exists, it means the target cache configuration information has been downloaded and no file caching is needed; if it does not exist, it downloads the target cache configuration information and verifies its content. It should be noted that this description file is the target cache configuration information.

[0112] Finally, verify that the MD5 hash of the first page matches any page identifier in the target page's identifier information. Specifically, verify that the MD5 hash of the downloaded first page's MD5 hash is equal to the MD5 hash of the corresponding file in the JSON description file. It's important to note that this verification is for security purposes, preventing the MD5 hash from changing if the JavaScript file content has been tampered with by a hacker. If the MD5 hash does not match the hash obtained through the API, the file is considered untrusted, and preloading will not be performed. Therefore, if they match, proceed to step 204; otherwise, the target page's cache information will not be cached.

[0113] Furthermore, when the client accesses other pages on the APP, the same action as in step 203 is performed, which will not be elaborated here.

[0114] 204. If they are the same and the first page identifier information is not saved, send a data caching instruction to the caching interface according to the target page parameter information to obtain the target page cache information.

[0115] If the MD5 file in the target configuration cache information is the same as the MD5 file of the first page, and the MD5 file of the first page is not saved locally, a data caching instruction is sent to the server's caching interface according to the target page parameter information in the target configuration cache information, thereby obtaining the target page cache information so as to render the page.

[0116] Specifically, it involves making a pre-request to the server's caching interface based on the determined target page parameter information, thereby requesting the interface's cache.

[0117] This embodiment proposes a method for caching page data on a client-side basis. When the client application starts, it obtains target cache configuration information from the server-side cache interface corresponding to the application. Upon accessing the first page, it retrieves the first page parameter information and a first page identifier information matching the first page parameter information. It then verifies whether the first page identifier information is identical to any page identifier information in the target page identifier information and whether the client has not saved the first page identifier information. If they are identical and the first page identifier information is not saved, a data caching instruction can be sent to the cache interface based on the target page parameter information to obtain the target page cache information. Therefore, when opening the page, the cached page information can be directly used to replace the request for interface data, thereby reducing page loading time and achieving a near-instantaneous opening effect, resulting in a better user experience.

[0118] Please see Figure 3 , Figure 3This is a flowchart illustrating another page data caching method disclosed in an embodiment of this application. It includes steps 301-307. It should be noted that this embodiment is mainly applied to an application program (APP) on a client side.

[0119] 301. When the client application starts, it obtains the target cache configuration information from the cache interface of the server corresponding to the application.

[0120] In this embodiment, step 301 is the same as the aforementioned Figure 2 Step 201 is similar and will not be elaborated here. However, it should be noted that one specific embodiment of the target cache configuration information, that is, the corresponding offline caching protocol JSON configuration list, can be, where the JSON data format is as follows:

[0121]

[0122]

[0123] It is easy to understand that the above is only one specific embodiment of the JSON data format, and this embodiment does not limit the specific implementation code of the JSON data format.

[0124] 302. When accessing the first page, obtain the first page parameter information and the first page identifier information that matches the first page parameter information.

[0125] Step 302 in this embodiment is the same as described above. Figure 2 Step 202 is similar and will not be elaborated here. However, it should be noted that, furthermore, before accessing the first page, the corresponding WEEX_BRIDGE or H5_BRIDGE for WEEX or H5 provides a file cache writing JSAPI, allowing the APP to provide corresponding JSAPI parameters for the H5 page to read data. Specifically, the APP adds a BRIDGE_API method for both WEEX and H5, which can write the file cache by passing the page URL. It should be noted that the file cache described above can also be understood as the page parameter information and the page identifier information matching the page parameter information. For example, when the client accesses the first page, it can obtain the page URL of the first page written by H5_BRIDGE and the corresponding MD5 hash.

[0126] It's worth noting that WEEX is a framework that can leverage web front-end development technologies to achieve native Android or iOS integration. It uses Vue as its upper-level framework and adheres to W3C standards to implement a unified JSEngine and DOMAPI. In other words, WEEX can be understood as a front-end technology stack.

[0127] It should also be added that the BRIDGE_API method is a bridge for communication between the APP and H5 or WEEX. It is a capability provided by the APP (you can understand that if H5 or WEEX wants to call, for example, a camera function, it has to tell the APP to open the camera through BRIDGE_API).

[0128] Furthermore, this step can also be performed when a user opens the first page and prepares to open the second page. In this case, the parameter information and identifier information of the first page become the parameter information and identifier information of the second page. Correspondingly, the first page at this time is the intermediate page. For ease of description, the specific meaning of the intermediate page will not be described in detail below.

[0129] It should also be noted that steps 303-308 can be understood as the steps performed when the user opens the first page and prepares to open the second page. This will not be elaborated upon further.

[0130] 303. Verify whether the first page identifier information is the same as any page identifier information in the target page identifier information and whether the client has not saved the first page identifier information. If so, proceed to step 304.

[0131] 304. Send a data caching instruction to the caching interface based on the target page parameter information to obtain the target page cache information.

[0132] In this embodiment, steps 303-304 are the same as those described above. Figure 2 Steps 203-204 are similar and will not be elaborated here. However, it should be noted that after the client obtains the page URL, it will perform an interface query and update using the JSON protocol, and then cache the page's static resources offline. If the MD5 hash already exists, caching is not necessary.

[0133] It's worth noting that this interface is provided by the OA management platform. By passing in the page URL, you can obtain a JSON file containing the collection of resource files loaded by that page, which can then be used for subsequent resource preloading operations.

[0134] It's also worth noting that each resource file can be considered granular, such as JS or CSS. The target page cache information when accessing the initial page load can be understood as a list of static resources from the CDN loaded on the first screen. The retrieval method can be understood as caching files using an offline static resource caching approach. The caching method can also be understood as reading the address of the resource list file.

[0135] 305. When obtaining target page cache information, obtain real-time time information, write the real-time time information into the target page cache information, and save the target page cache information after writing the real-time time information locally.

[0136] When the target page cache information is obtained, it needs to be saved locally in a preset format.

[0137] Specifically, one embodiment of the specific format can be:

[0138]

[0139] Each URL corresponds to one set of cached data. It's easy to understand that this embodiment does not limit the number of URLs, and this will not be elaborated upon further. Therefore, the client can save the target page's cached information to its local cache pool according to the above format.

[0140] Furthermore, after the client saves the target page's cached information, they can also provide a JSAPI parameter passing method for the page to read the data. Here, JSAPI is the bridge for communication between the APP and H5, an application programming interface (API). Correspondingly, parameter passing refers to the parameters that the H5 needs to tell the APP (the URL is the parameter). The APP returns the corresponding target page's cached information to the H5 based on these parameters; that is, the cached interface data stored at the URL.

[0141] Furthermore, the target page cache information can be named according to the matching relationship between the target page parameter information and the target page identifier information to form the target page cache information naming information. This target page cache information is then saved to the client according to the naming information format, and the target matching relationship between the target page parameter information and the naming information is also saved to the client. Specifically, resource files (page cache information corresponding to the URL, which may include js, css, png, etc.) within the JSON protocol are cached locally on the client using MD5 as the naming convention, and a URL:MD5 mapping is also cached. The naming information for the APP local file cache can be MD5_1, MD5_2, MD5_3, ..., etc. The specific number of names depends on the number of fields in the target page parameter information (URL), and this embodiment does not impose any limitations on this. Therefore, the corresponding mapping for the APP local cache is URL1:MD5_1, URL2:MD5_2, URL3:MD5_3, ..., etc. For ease of description, the specific meaning and content of the resource files will not be elaborated further.

[0142] Furthermore, when the app's local cache pool retrieves the target page's cached information—that is, when the API data is stored in memory—it obtains the real-time data of that retrieval. When storing the target page's cached information, the retrieved real-time data, i.e., the current time field, is written into the target page's cache information. Specifically, the app records a timestamp when requesting the API. Then, the target page's cached information, with the real-time data written into it, is saved locally.

[0143] Specifically, in step 305, one embodiment of obtaining the current time can be as follows: First, the business logic is divided according to the scenario ID. The scenario ID can be generated by the OA management platform. This embodiment does not restrict the management terminal that generates the scenario ID, and this will not be elaborated further. Only one management terminal needs to be configured to generate the scenario ID, such as e-commerce business, insurance business, etc. Each scenario is allocated a fixed 15MB of space. If this is exceeded, the disk files are cleaned up separately according to the time in reverse chronological order (using the Least Recently Used (LRU) algorithm), without affecting each other. Then, the most recent access time of a file is compared with the current time to determine if it exceeds a certain eviction threshold. If it does, the corresponding MD5 resource file is deleted locally. Finally, a judgment is made based on the disk space of all scenarios to see if it exceeds 150MB. If it does, the entire disk file is cleaned up according to the time in reverse chronological order, which means deleting the target page cache information.

[0144] It's worth noting that the fixed storage space allocated to each scenario can be freely configured, for example, set to 20MB, 10MB, etc. There are no specific restrictions here. Correspondingly, the LRU algorithm's basic idea is that data that hasn't been used for a long time is unlikely to be used in the future, so when new data arrives, we can prioritize replacing this data. It's also worth noting that the eviction threshold can be freely configured, for example, set to 200MB, 100MB, etc. There are no specific restrictions here. Correspondingly, the number of scenarios can also be a pre-allocated value that can be increased at any time, determined by specific business usage. For example, it can be set to 10 scenarios, or 20 scenarios, etc. There are no specific restrictions here.

[0145] It's easy to understand that when each scene is allocated a fixed 15MB of space, and there are 10 scenes, the corresponding disk space is 150MB. When each scene is allocated a fixed 20MB of space, and there are 20 scenes, the corresponding disk space is 400MB.

[0146] 306. When any page in the target page is accessed, the page is rendered according to the target page cache information stored locally.

[0147] When a user enters an activity page within an app through clicks or other actions, that is, when accessing any page within the target page, the subpage can send the URL parameter that this page needs to load to the client. The client then uses this URL parameter to find the cached data corresponding to that URL parameter in the target page's cache information and sends the required cached data to the subpage. This allows the page to render the page based on the read cached data, which is the corresponding target page cache information.

[0148] 307. Obtain the current time information of the closed application, and calculate the result by combining the real-time time information with the current time information.

[0149] When the app is closed, that is, when the app process is shut down, the client obtains the current time at which the app was closed. By calculating the current time and the real-time time, the client obtains the result.

[0150] 308. Determine whether the calculation result is greater than the preset threshold.

[0151] Once the calculation result is obtained, it is determined whether the result exceeds a preset threshold. If it does, the target page cache information is deleted. Specifically, the time when the calculated file most recently accessed the H5 page is compared with the real-time time when the target page cache information was obtained to determine if it exceeds a certain threshold. For example, it can be set to 10 seconds or 5 seconds, depending on the page's requirements for the real-time nature of cached data. The specific value of the threshold is not limited here and will not be elaborated further. When the threshold is exceeded, the resource file corresponding to the H5 page's MD5 hash in the target page cache information is deleted. The client can then execute the above steps to obtain the latest JSON file and the latest target page cache information.

[0152] Furthermore, this real-time information can be used to tell the H5 page whether to continue using the target page's cached information. Some business scenarios have high requirements for the real-time performance of cached data, so it may not be used. When the business scenario has low or no real-time requirements for cached data, the page can be left unrendered, thus providing a fallback for business needs.

[0153] This embodiment proposes a page data caching method where the client application (APP) can obtain the corresponding target page cache information from the server using pre-configured target cache settings. Simultaneously, by establishing a general H5 resource offline caching solution system, important pages within the APP can be opened instantly. Furthermore, it achieves granular resource caching within the APP by intercepting network requests and replacing disk resource access. Finally, by reading the static resource list loaded on the first screen of the page and caching files using an offline static resource caching method, the feasibility of the solution is improved.

[0154] Please see Figure 4 , Figure 4 This is a flowchart illustrating another page data caching method disclosed in this application. It includes steps 401-408. It should be noted that this embodiment is mainly applied when accessing H5 pages. It should also be noted that the various page parameter information, page configuration information, and page identifier information mentioned in this embodiment can be found in the execution steps during acquisition in steps 301-308; the specific acquisition steps will not be elaborated upon in this embodiment.

[0155] 401. When accessing the second page, obtain the second page parameter information.

[0156] App launch refers to the time when the app is opened, before accessing H5 pages. Users only enter some activity pages through clicks or other operations. This is called accessing H5 pages. App launch is a pre-processed process, so data can be cached in advance at this time. When accessing H5 pages, there is no need to request the interface; the cached data can be used directly.

[0157] Specifically, when a user enters the second page within the app through clicks or other actions, the second page sends its parameter information (page URL) to the client, allowing the client to obtain this parameter information.

[0158] Furthermore, when the first page is visited for the first time, the first page can be the same as the second page.

[0159] 402. Determine whether to update the target matching relationship based on the parameter information on the second page. If yes, proceed to step 403; otherwise, proceed to step 404.

[0160] Once the client obtains the parameters from the second page, it can determine whether to update the target matching relationships already stored in the client. For details on target matching relationships, please refer to [link to relevant documentation]. Figure 3 Proceed to step 305. If yes, proceed to step 403; otherwise, proceed to step 404.

[0161] Specifically, the mapping table determines whether to enable interception for HTML files based on the page URL (filter parameter). Interception involves whether offline caching is enabled, or in other words, whether to update. Since the mapping table contains mappings for the app's local cache, the corresponding target page parameter information can be read from the URL of the second page parameter information.

[0162] If the target page parameter information does not exist locally, proceed to step 404; otherwise, proceed to step 304.

[0163] 403. Obtain the first cache configuration information corresponding to the second page from the cache interface.

[0164] If the target page's cached information needs to be updated, the corresponding second subpage can retrieve its corresponding first cache configuration information from the server via the cache interface. Specifically, the second subpage can obtain the JSON protocol configured by the OA management platform through the cache interface; this JSON protocol is the latest JSON protocol for the page. At this point, the second subpage can query the latest JSON protocol for the page. The first cache configuration information includes the second page's parameter information and the second page identifier information that matches the second page's parameter information.

[0165] 404. Accessing the second page via HTTPS protocol for Hypertext Transfer.

[0166] If updating the target page's cached information is not required, or if the MD5 hash of the latest JSON protocol is not present in the local cache, then the Hypertext Transfer Protocol Secure (HTTPS) will be used directly to access the second page.

[0167] 405. Determine if the target page identifier information contains a second page identifier information. If yes, proceed to step 406; otherwise, proceed to step 404.

[0168] Once the latest target cache configuration information, i.e., the first cache configuration information, is obtained, it is determined whether the target page identifier information in the local cache exists as the second page identifier information in the first cache configuration information. Specifically, this involves checking whether the latest JSON protocol MD5 hash exists in the cache. If yes, proceed to step 406; otherwise, proceed to step 404.

[0169] Furthermore, the app can also determine whether static resources match the offline cache list. Specifically, the app checks whether the first cache configuration information matches the target cache configuration information. If not, step 404 is executed; if so, step 406 is executed. It should be noted that "match" refers to determining whether a resource matches the actual file loaded during access, combined with the mapping relationship.

[0170] 406. Update the target page parameter information to the second page parameter information.

[0171] When the MD5 hash of the JSON protocol exists in the local cache, the target page parameters will be updated with the second page parameters. Specifically, the page URL will be updated.

[0172] Furthermore, since the page URL corresponds to the images, videos, etc., needed for page rendering, it can also be understood as intercepting and replacing resource files (images, videos, etc.). In other words, it replaces the display images or videos on the subpage.

[0173] 407. Render any page based on the target page cache information stored locally.

[0174] If the target page is cached locally, the second page will be rendered based on the locally stored target page cache information.

[0175] Furthermore, any page is rendered based on the locally stored target page cache information.

[0176] 408. Receive the second page cache information sent by the server and render the page according to the second page cache information.

[0177] When accessing the second page via HTTPS, the second page cache information sent by the server can be received directly via HTTPS, and the second page can be rendered based on the second page cache information.

[0178] The page data caching method proposed in this embodiment determines whether to cache resource files based on the caching configuration information of the current H5 page when accessing a specific H5 page. This reduces the first-screen loading time and resource bandwidth usage, improves user experience, and enhances the feasibility of the solution.

[0179] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0180] If the plan involves sensitive information (such as user information or corporate information), it should state that the collection, use, and processing of sensitive information must comply with the laws, regulations, and standards of the relevant countries and regions, and must be carried out with the permission or consent of the relevant entities (such as users or enterprises).

[0181] Please see Figure 5 , Figure 5 This is a system architecture diagram of page data caching disclosed in an embodiment of this application. It includes:

[0182] The acquisition unit 501 is used to obtain target cache configuration information from the cache interface of the server corresponding to the application when the client application starts. The target cache configuration information includes the target page parameter information of the page and the target page identifier information that matches the target page parameter information one by one.

[0183] The acquisition unit 501 is also used to acquire the first page parameter information and the first page identifier information that matches the first page parameter information when the first page is accessed;

[0184] The verification unit 502 is used to verify whether the first page identification information is the same as any page identification information in the target page identification information and whether the client has not saved the first page identification information.

[0185] The sending unit 503 is used to send a data caching instruction to the caching interface according to the target page parameter information when the first page identifier information is the same and not saved, so as to obtain the target page cache information.

[0186] For example, the system further includes: a storage unit 504;

[0187] Storage unit 504 is used to save target page cache information locally according to a preset format.

[0188] For example, the system further includes: a naming unit 505;

[0189] The naming unit 505 is used to name the target page cache information according to the matching relationship between the target page parameter information and the target page identifier information, so as to form the naming information of the target page cache information;

[0190] The storage unit 504 is specifically used to save the target page cache information to the client according to the naming information format;

[0191] The storage unit 504 is specifically used to save the target page parameter information and the target matching relationship of the naming information to the client.

[0192] For example, the system further includes: a judgment unit 506 and an access unit 507;

[0193] The acquisition unit 501 is also used to acquire the second page parameter information when accessing the second page;

[0194] The judgment unit 506 is used to determine whether to update the target matching relationship based on the parameter information of the second page;

[0195] The acquisition unit 501 is specifically used to acquire the first cache configuration information corresponding to the second page from the cache interface when the target matching relationship is updated according to the second page parameter information, so as to determine whether the first cache configuration information has page identification information that is the same as the target page identification information;

[0196] Access unit 507 is used to access the second page according to the HTTPS protocol of Hypertext Transfer when the target matching relationship is not updated according to the parameter information of the second page.

[0197] For example, the system further includes: an update unit 508 and an execution unit 509;

[0198] The judgment unit 506 is specifically used to determine whether the target page identification information contains second page identification information;

[0199] The update unit 508 is used to update the target page parameter information to the second page parameter information when the target page identifier information contains second page identifier information;

[0200] Execution unit 509 is used to perform the step of accessing the second page according to the Hypertext Transfer HTTPS protocol when the target page identification information does not contain second page identification information.

[0201] For example, the system further includes: a rendering unit 510;

[0202] The rendering unit 510 is used to render any page based on the locally stored target page cache information when any page in the page is accessed.

[0203] For example,

[0204] The sending unit 503 is specifically used to send a data caching instruction to the caching interface according to the second page parameter information in order to obtain the target page caching information corresponding to the second page parameter information.

[0205] The rendering unit 510 is specifically used to render the second page based on the target page cache information corresponding to the second page parameter information stored locally.

[0206] For example, the system further includes: a writing unit 511;

[0207] The acquisition unit 501 is also used to acquire real-time time information when acquiring cached information of the target page;

[0208] The writing unit 511 is used to write real-time time information into the target page cache information and save the target page cache information after writing the real-time time information locally.

[0209] For example, the system further includes: a calculation unit 512 and a deletion unit 513;

[0210] The acquisition unit 501 is also used to acquire the current time information of closing the application when the application is closed;

[0211] The calculation unit 512 is used to calculate the real-time time information and the current time information to obtain the calculation result;

[0212] The judgment unit 506 is also used to determine whether the calculation result is greater than a preset threshold.

[0213] The deletion unit 513 is used to delete the target page cache information when the calculation result is greater than a preset threshold.

[0214] Please refer to the following: Figure 6 This application discloses a schematic diagram of a page data caching device, which includes:

[0215] Central processing unit 601, memory 605, input / output interface 604, wired or wireless network interface 603, and power supply 602;

[0216] Memory 605 is either a short-term storage memory or a persistent storage memory;

[0217] The central processing unit 601 is configured to communicate with the memory 605 and execute instructions stored in the memory 605 to perform the aforementioned operations. Figures 2 to 4 The method in any of the embodiments shown.

[0218] This application also provides a chip system, characterized in that the chip system includes at least one processor and a communication interface, the communication interface and the at least one processor are interconnected via a circuit, and the at least one processor is used to run computer programs or instructions to perform the aforementioned... Figures 2 to 4 The method in any of the embodiments shown.

[0219] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0220] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0221] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0222] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0223] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

Claims

1. A page data caching method, characterized in that, Applied to a client, the method includes: When the client application starts, it obtains target cache configuration information from the cache interface of the server corresponding to the application. The target cache configuration information includes target page parameter information of the page and target page identifier information that matches the target page parameter information one by one; wherein, the target page identifier information includes the message digest algorithm MD5. When the first page is accessed, the first page parameter information of the first page and the first page identifier information that matches the first page parameter information are obtained. Verify whether the first page identifier information is the same as any page identifier information in the target page identifier information and whether the client has not saved the first page identifier information; If they are the same and the first page identifier information is not saved, a data caching instruction is sent to the cache interface according to the target page parameter information to obtain the target page cache information; The method further includes: The target page cache information is saved locally according to a preset format; The step of saving the target page cache information locally according to a preset format includes: The target page cache information is named according to the matching relationship between the target page parameter information and the target page identifier information to form the naming information of the target page cache information; The target page cache information is saved to the client according to the naming information format; The target page parameter information and the target matching relationship of the naming information are saved to the client.

2. The method according to claim 1, characterized in that, After saving the target page parameter information and the target matching relationship of the naming information to the client, the method further includes: When accessing the second page, obtain the second page parameter information; Determine whether to update the target matching relationship based on the parameter information on the second page; If so, obtain the first cache configuration information corresponding to the second page from the cache interface to determine whether the first cache configuration information contains page identifier information that is the same as the target page identifier information; If not, access the second page using the HTTPS protocol for Hypertext Transfer.

3. The method according to claim 2, characterized in that, The first cache configuration information includes second page identifier information that matches the second page parameter information. Determining whether the first cache configuration information contains page identifier information identical to the target page identifier information includes: Determine whether the target page identifier information contains the second page identifier information; If so, update the target page parameter information to the second page parameter information; If not, proceed with the step of accessing the second page according to the Hypertext Transfer HTTPS protocol.

4. The method according to claim 3, characterized in that, After saving the target page cache information locally according to a preset format, the method further includes: When any page in the page is accessed, the page is rendered according to the target page cache information stored locally.

5. The method according to claim 4, characterized in that, The step of rendering any page based on the locally stored target page cache information includes: The data caching instruction is sent to the caching interface according to the second page parameter information to obtain the target page cache information corresponding to the second page parameter information; The second page is rendered based on the target page cache information corresponding to the second page parameter information stored locally.

6. The method according to claim 1, characterized in that, After saving the target page cache information locally according to a preset format, the method further includes: When obtaining the target page cache information, obtain the real-time time information; The real-time information is written into the target page cache information, and the target page cache information after the real-time information is written is saved locally.

7. The method for caching page data according to claim 6, characterized in that, After writing the real-time information into the target page cache information and saving the target page cache information locally, the method further includes: If the application is closed, obtain the current time information of when the application was closed; The real-time time information and the current time information are used to calculate the result. Determine whether the calculation result is greater than a preset threshold; If so, delete the cached information of the target page.

8. A page data caching system, characterized in that, The system, applied to a client, includes: The acquisition unit is used to acquire target cache configuration information from the cache interface of the server corresponding to the application when the client application starts. The target cache configuration information includes target page parameter information of the page and target page identifier information that matches the target page parameter information one by one; wherein, the target page identifier information includes the message digest algorithm MD5. The acquisition unit is further configured to acquire, when accessing the first page, first page parameter information of the first page and first page identifier information matching the first page parameter information; The verification unit is used to verify whether the first page identification information is the same as any page identification information in the target page identification information and whether the client has not saved the first page identification information. The sending unit is used to send a data caching instruction to the caching interface according to the target page parameter information when the first page identifier information is the same and not saved, so as to obtain the target page cache information. The system also includes: a storage unit; The storage unit is used to save the target page cache information locally according to a preset format; The system also includes: a naming unit; The naming unit is used to name the target page cache information according to the matching relationship between the target page parameter information and the target page identifier information, so as to form the naming information of the target page cache information; The storage unit is specifically used to save the target page cache information to the client according to the format of the naming information; The storage unit is specifically used to save the target page parameter information and the target matching relationship of the naming information to the client.

9. A page data caching device, characterized in that, The device includes: Central processing unit, memory, input / output interfaces, wired or wireless network interfaces, and power supply; The memory is either a short-term storage memory or a persistent storage memory; The central processing unit is configured to communicate with the memory and execute instructions in the memory to perform the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1 to 7.