WEB application cache acceleration method and system, computer equipment and storage medium
By comparing the update time and storage time of WEB applications on the client, determining whether page data needs to be updated, the problem of difficult to balance resource utilization and data update timeliness in the prior art is solved, and efficient WEB application access and data update are achieved.
Patent Information
- Application Number
- CN202411760654.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-03-07
AI Technical Summary
Existing WEB applications control data update frequency by caching time, resulting in difficult to balance resource utilization and data update timeliness.
By obtaining WEB application information in the application publishing platform on the client and storing the update time in the local cache, when the user opens the target WEB application, the consistency of the update time and storage time is compared. If it is consistent, the page data in the local cache is rendered, and if it is inconsistent, the old data is deleted and the latest data is obtained for rendering and storage.
Accurately determine whether page data needs to be updated, reduce network requests, improve access speed of WEB applications, ensure timely update of data, and solve the problem of difficult to balance resource utilization and data update timeliness caused by cache timeliness settings.
Smart Images

Figure CN119577269A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a WEB application cache speed-up method, system, computer equipment and storage medium. Background Art
[0002] With the development of mobile Internet, users are responding faster and faster to WEB applications. In the specific implementation process of WEB application access, when opening a WEB application, the client will initiate a request to the server to obtain the page data corresponding to the WEB application. Only after all the page data is loaded can the rendering be started. In this process, the acquisition of the page data corresponding to the WEB application depends largely on factors such as network bandwidth. Once the amount of data is large, the time required to load network resources will increase significantly, which will lead to a decline in the overall user experience.
[0003] The existing technical solutions mainly rely on the cache time limit set by the mobile application to control the frequency of data updates, so as to improve the access speed. However, in this way, if the cache time limit is set to a short time, the data will be updated frequently, resulting in a waste of resources; if the cache time limit is set to a long time, the data will not be updated in time, and users will not be able to access the latest content in real time. Summary of the invention
[0004] The embodiments of the present invention provide a WEB application cache speed-up method, system, computer device and storage medium to solve the problem that the existing WEB application controls the data update frequency through cache timeliness, resulting in difficulty in balancing resource utilization and data update timeliness.
[0005] In a first aspect, a method for accelerating a WEB application cache is provided, which is applied to a client, and the method comprises: Obtaining web application information of mobile applications in the application publishing platform, and storing the web application information in a local cache, wherein the web application information includes an update time corresponding to each web application in the mobile application; When it is detected that a user opens a target WEB application, the update time and storage time corresponding to the target WEB application are obtained from the local cache, wherein the storage time is the time when the target WEB application was last updated and stored in the local cache; Comparing whether the update time and storage time of the target WEB application are consistent; If they are consistent, the page data corresponding to the target WEB application is obtained from the local cache and rendered; If they are inconsistent, the page data corresponding to the target WEB application in the local cache is deleted, and the latest page data corresponding to the target WEB application is obtained from the application publishing platform; the latest page data is rendered, and the latest page data is stored in the local cache.
[0006] In a second aspect, a method for accelerating the cache speed of a web application is provided, which is applied to an application publishing platform, and the method comprises: Receive a first request sent by a client; According to the first request, the WEB application information of the mobile application is sent to the client, so that the client stores the WEB application information in the local cache, wherein the WEB application information includes the update time corresponding to each WEB application in the mobile application; when the client detects that the user opens the target WEB application, the client obtains the update time and storage time corresponding to the target WEB application from the local cache, wherein the storage time is the time when the target WEB application was last updated and stored in the local cache; the client compares whether the update time and storage time of the target WEB application are consistent; if they are consistent, the client obtains the page data corresponding to the target WEB application from the local cache and renders it; if they are inconsistent, the client deletes the corresponding page data in the local cache and sends a second request to the application publishing platform; receiving a second request sent by the client; According to the second request, the latest page data corresponding to the target WEB application is sent to the client, so that the client renders the latest page data and stores the latest page data in the local cache.
[0007] In a third aspect, a web application cache speed-up system is provided, wherein the web application cache speed-up system comprises a client, and the client comprises: A first acquisition module is used to acquire the web application information of the mobile application in the application publishing platform and store the web application information in a local cache, wherein the web application information includes the update time corresponding to each web application in the mobile application; The detection module, when detecting that a user opens a target WEB application, obtains the update time and storage time corresponding to the target WEB application from the local cache, wherein the storage time is the time when the target WEB application was last stored in the local cache; A comparison module, used to compare whether the update time and storage time of the target WEB application are consistent; A first rendering module, configured to obtain the page data corresponding to the target WEB application from the local cache and render the page data if they are consistent; The second rendering module is used to delete the page data corresponding to the target WEB application in the local cache if there is inconsistency, and obtain the latest page data corresponding to the target WEB application from the application publishing platform; render the latest page data, and store the latest page data in the local cache.
[0008] In a fourth aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the WEB application cache speed-up method described in the first aspect is implemented; or, when the processor executes the computer program, the WEB application cache speed-up method described in the second aspect is implemented.
[0009] In a fifth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the WEB application cache speed-up method described in the first aspect is implemented, or when the computer program is executed by a processor, the WEB application cache speed-up method described in the second aspect is implemented.
[0010] In one scheme implemented by the above-mentioned WEB application cache speed-up method, system, computer device and storage medium, it includes: obtaining the WEB application information of the mobile application in the application publishing platform, and storing the WEB application information in the local cache, wherein the WEB application information includes the update time corresponding to each WEB application in the mobile application; when it is detected that the user opens the target WEB application, obtaining the update time and storage time corresponding to the target WEB application from the local cache, wherein the storage time is the time when the target WEB application was last updated and stored in the local cache; comparing whether the update time and storage time of the target WEB application are consistent; if they are consistent, obtaining the page data corresponding to the target WEB application from the local cache and rendering; if they are inconsistent, deleting the page data corresponding to the target WEB application in the local cache, and obtaining the latest page data corresponding to the target WEB application from the application publishing platform; rendering the latest page data, and storing the latest page data in the local cache. In this embodiment, by comparing the update time and storage time of the target WEB application in the local cache, it is possible to accurately determine whether the page data needs to be updated. When the page data is not updated, the page data in the local cache is used to reduce network requests, improve the access speed of the WEB application, and improve the user experience caused by the large amount of data and limited network bandwidth. The long loading time caused by the large amount of data and the limited network bandwidth. When the page data is updated, the old page data is deleted in time and the latest page data is obtained and stored in the local cache, ensuring that users can access the latest content in real time, overcoming the defect of the traditional method of untimely page data update caused by the long cache time. In this way, while improving the access speed of the WEB application, the timeliness of data update is ensured, solving the problem of the existing WEB application that the frequency of data update is controlled by the cache time limit, resulting in a difficult balance between resource utilization and data update timeliness, and improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0011] Figure 1 This is a schematic diagram of an application environment of a WEB application cache speed-up method in one embodiment of the present invention; Figure 2 This is a flow chart of a method for accelerating the cache of a WEB application in one embodiment of the present invention; Figure 3 is another flow chart of a method for accelerating the cache speed of a WEB application according to an embodiment of the present invention; Figure 4 is another flow chart of a method for accelerating the cache speed of a WEB application according to an embodiment of the present invention; Figure 5 is another flow chart of a method for accelerating the cache speed of a WEB application according to an embodiment of the present invention; Figure 6 is another flow chart of a method for accelerating the cache speed of a WEB application according to an embodiment of the present invention; Figure 7 This is a schematic diagram of a WEB application cache speed-up system according to an embodiment of the present invention; Figure 8 is a schematic diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0012] The following will be combined with the drawings in 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 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 creative work are within the scope of protection of the present invention.
[0013] The WEB application cache speed-up method provided by the embodiment of the present invention can be applied as follows: Figure 1 Specifically, the WEB application cache speed-up method is applied in a WEB application cache speed-up system, and the WEB application cache speed-up system includes: Figure 1 The client, application publishing platform and construction platform shown in the figure, the client communicates with the application publishing platform through a network, and the application publishing platform communicates with the construction platform through a network to implement the WEB application cache speed-up method. Among them, the client includes but is not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The application publishing platform can be implemented with an independent server or a server cluster composed of multiple servers.
[0014] Specifically, the WEB application cache speed-up method provided by the embodiment of the present invention can be applied to a variety of application scenarios, including but not limited to mobile Internet, Internet of Things and other application scenarios. As an example, in the mobile Internet application scenario, users of mobile devices such as smart phones and tablets often visit various WEB pages, such as financial pages, news pages and social pages. Through the cache speed-up method provided by the embodiment of the present invention, the client can cache commonly used page data to the local cache. When the user accesses the same content, the client can directly read the data from the local cache, reducing frequent network requests, effectively improving the loading speed, and enhancing the user experience.
[0015] The WEB application cache speed-up method provided by the present invention will be described in detail with specific embodiments below.
[0016] First, as Figure 2 As shown, a WEB application cache speed-up method is provided, and the method is applied in Figure 1 The client in the example is used to illustrate the process, including the following steps: S101. Acquire WEB application information of mobile applications in an application publishing platform, and store the WEB application information in a local cache, wherein the WEB application information includes an update time corresponding to each WEB application in the mobile application.
[0017] In this embodiment, mobile applications refer to software programs running on mobile devices (such as smartphones and tablets), including but not limited to Android applications, IOS applications, Hongmeng applications, and applications on other mobile operating systems.
[0018] WEB application information includes but is not limited to the name, update time, path information and other information of each WEB application in the mobile application. WEB application can also be called web application, WEB page, network page or WEB module, which is not limited here. The related concepts in the following text all express the same meaning and can be flexibly selected according to different application scenarios, which is not limited here.
[0019] Local cache refers to a storage mechanism used to temporarily store data on a user's local device (such as a computer, smartphone, tablet, etc.).
[0020] In some embodiments, when a user opens a mobile application, for example, a financial application, the client will send a first request to the application publishing platform. After receiving the first request, the application publishing platform will return the web application information of the mobile application to the client, so that the client can obtain the web application information of the mobile application. Then, the obtained web application information is stored in the local cache. For example, the name, path and update time of each web module in the financial application, such as the update time of the "account management module" is "2024-10-01 10:00:00", and the update time of the "transaction record module" is "2024-10-01 09:50:00".
[0021] Through this process, the client can directly determine whether the page data needs to be updated based on the update time and storage time in the local cache when the user subsequently visits a WEB application, avoiding frequent requests to the server, thereby improving the system's response speed and optimizing the user experience.
[0022] It should be understood that the WEB application information obtained in the embodiment of the present application can also be stored in the local memory, which is not limited here.
[0023] S102: When it is detected that a user opens a target WEB application, an update time and a storage time corresponding to the target WEB application are obtained from the local cache, wherein the storage time is the time when the target WEB application was last updated and stored in the local cache.
[0024] In this embodiment, the update time refers to the timestamp recorded by the application publishing platform when the latest data is published, and the storage time is the timestamp when the client last stored the latest page data corresponding to the target WEB application into the local cache.
[0025] In some implementations, when a user opens a target WEB application, the client may extract the update time and storage time corresponding to the target WEB application from the local cache through a unique identifier (such as a URL, name, or path) of the target WEB application.
[0026] Specifically, after a user opens a mobile application, the shouldInterceptRequest method in the WebView client class can be used to monitor whether the user has opened the target WEB application in the mobile application. For example, in a financial application, it includes a financial module for displaying detailed financial news content. When the user clicks to enter the financial module, the shouldInterceptRequest method in the WebView client class will obtain the unique identifier of the financial module, and then determine whether the user has opened the corresponding financial module. Then, according to the unique identifier of the financial module, the corresponding update time and storage time can be obtained from the local cache. It should be understood that the above is only an example and does not constitute a limitation of the present invention.
[0027] S103: Compare whether the update time and storage time of the target WEB application are consistent.
[0028] In some implementations, the client may use a preset comparison algorithm to compare the update time and the storage time to determine the subsequent execution process, wherein the comparison algorithm includes a character comparison algorithm based on the date and time format, a hash algorithm, or other algorithms, which are not limited here.
[0029] Specifically, the character comparison algorithm based on the date and time format can be to express the update time and storage time in a specific date and time format, and then compare the year, month, day, hour, minute, second and other parts in character order to see if they are the same; the hash algorithm can be to perform a hash operation on the data of the update time and storage time to obtain the corresponding hash value, and then compare whether the two hash values are equal to determine the consistency of time. The above comparison algorithm provides an effective means to accurately determine whether the update time and storage time of the target WEB application are consistent.
[0030] If they are consistent, execute step S104; if they are inconsistent, execute step S105.
[0031] S104, if they are consistent, obtaining the page data corresponding to the target WEB application from the local cache and rendering; In some embodiments, if the update time and storage time of the target WEB application are consistent, it means that the page data corresponding to the target WEB application stored in the local cache is the latest page data, and there is no need to obtain the same page data from the application publishing platform again, thereby saving network bandwidth resources and achieving fast rendering of page data, greatly improving the response speed of the target WEB application and improving the user experience.
[0032] As an example, if the update time and storage time of the target WEB application are consistent, the client can retrieve the corresponding page data from the local cache through the unique identifier of the target WEB application. The page data may include but is not limited to HTML structure, CSS style, JavaScript scripts and other resource files (such as pictures, icons, etc.).
[0033] Next, the client calls the read method of the cache management module (such as "CacheManager.get()") to extract the page data into the memory. Then, the "WebView" component in the mobile application is used to load this data. For example, the HTML data is bound to the associated resource file through the "WebView.loadDataWithBaseURL()" method. After parsing by the rendering engine, the final page is displayed in the user interface, which optimizes the user experience.
[0034] It should be understood that the above is only an example and does not constitute a limitation of the present invention.
[0035] S105. If there is inconsistency, delete the page data corresponding to the target WEB application in the local cache, and obtain the latest page data corresponding to the target WEB application from the application publishing platform; render the latest page data, and store the latest page data in the local cache.
[0036] In some implementations, if the update time and storage time of the target WEB application are inconsistent, it indicates that the page data corresponding to the target WEB application stored in the local cache is not the latest page data. At this time, the client will delete the page data corresponding to the target WEB application in the local cache and send a second request to the application publishing platform.
[0037] When the application publishing platform receives the second request sent by the client, it will return the latest page data corresponding to the target WEB page to the client. After receiving the latest page data, the client first renders the user interface according to the received latest page data, so as to reduce the waiting time of the user. The specific rendering method can refer to the description of the embodiment of step S104. In order to avoid repetition, it will not be repeated here. At the same time, the latest page data obtained is stored in the local cache, so as to realize the timely update of the local cache.
[0038] Among them, in the process of rendering and storing the latest page data in the local cache, multi-threaded parallel processing can be used, that is, one task is to save the latest page data to the local cache, and the other task is to directly render the latest page data obtained, thereby reducing the user's waiting time.
[0039] It should be understood that if it is a single-threaded task, it will have to wait until the latest page data is saved in the local cache before rendering. If the cache data action is provided to another thread, it will not affect the rendering process based on the latest page data.
[0040] As an example, the client can first locate the corresponding page data location in the local cache through the unique identifier of the target WEB application (such as the path " / stock / market"), and after detecting that the update time is inconsistent with the storage time, call the deletion method of the cache management module (such as "CacheManager.remove()") to clear the expired page data of the target WEB application in the cache. Subsequently, the client sends a request to the application publishing platform (such as using an HTTP GET request) to obtain the latest page data of the target WEB application, including the latest HTML structure, CSS style files, JavaScript scripts and other resources. After obtaining the latest data, the client calls the page rendering engine (such as the "WebView" component in Android) to load and render the latest page data. For example, through the "WebView.loadDataWithBaseURL()" method, the HTML data is bound to the resource file to dynamically present the latest page content. While rendering, the client calls the storage method of the cache management module (such as "CacheManager.put()") to store the latest page data in the local cache for subsequent use. Take the "Real-time Stock Quotes" application in financial applications as an example. Assume that the user opens the real-time stock quotes application, and its path is " / stock / market". The client finds that the update time of the real-time stock quotes application is "2024-10-0114:45:00", while the storage time in the local cache is "2024-10-01 14:30:00", which is inconsistent. The client first calls the "CacheManager.remove(" / stock / market")" method to delete the expired data of the module in the cache, and then initiates an HTTP request to the application publishing platform (such as GET https: / / www.xxxxxx.com / stock / market) to obtain the latest stock quotes page data, including the latest stock name, price, increase or decrease, etc. The client uses the "WebView.loadDataWithBaseURL()" method to load and render the latest data to the page, and the user can immediately see the updated stock quotes. At the same time, the client calls the "CacheManager.put(" / stock / market", latestData)" method to store the newly acquired data in the local cache, ensuring that the cached data can be used directly the next time it is accessed, improving system efficiency and optimizing user experience.
[0041] It should be noted that the above is only an example and does not constitute a limitation of the present invention.
[0042] In summary, a solution provided by an embodiment of the present invention can accurately determine whether page data needs to be updated by comparing the update time and storage time of the target WEB application in the local cache. When the page data is not updated, the page data in the local cache is used to reduce network requests, improve the access speed of the WEB application, and improve the user experience degradation problem caused by the large amount of data and the long loading time caused by the limited network bandwidth. When the page data is updated, the old page data is deleted in time and the latest page data is obtained and stored in the local cache, which ensures that the user can access the latest content in real time, and overcomes the defect of untimely page data update caused by the long cache time in the traditional method. Thereby, while improving the access speed of the WEB application, the timeliness of data update is ensured, and the problem of the existing WEB application controlling the data update frequency by the cache time limit, which makes it difficult to balance resource utilization and data update timeliness, is solved, thereby improving the user experience. In one embodiment, if Figure 3 As shown, in step S102, that is, when it is detected that the user opens the target WEB application, the update time and storage time corresponding to the target WEB application are obtained from the local cache, including the following steps: S1021, when it is detected that the user opens the target WEB application, determining whether the target WEB application is a speed-up WEB application; S1022: If yes, obtain the update time and storage time corresponding to the target WEB application from the local cache; S1023: If not, obtain the latest page data corresponding to the target WEB application from the application publishing platform, and render the latest page data.
[0043] In this embodiment, the accelerated WEB application may be a WEB application that is frequently accessed and has a high real-time requirement or a predefined application that needs to be accelerated, such as a "real-time stock quote module" or an "exchange rate query module". In some implementations, when a user opens a target web application, the client can determine whether the web application is a speed-up web application according to predefined rules. For example, the client can determine by analyzing the URL path or according to a module (such as stock quotes, real-time exchange rates) pre-defined in the configuration.
[0044] If the WEB application is marked as a speed-up WEB application, the client extracts the update time and storage time of the target WEB application from the local cache. If the WEB application is not a speed-up WEB application, the client directly sends a request to the application publishing platform to obtain the corresponding page data. For example, the client accesses the "transaction record module", which is updated less frequently and is not marked as a speed-up WEB application. At this time, the client directly obtains the corresponding transaction record data from the application publishing platform, and renders it through the "WebView" component to display the updated information to the user. In this way, the response speed can be guaranteed and the cache space occupied by the client can be reduced.
[0045] In one embodiment, if Figure 4 As shown, step S1021, i.e., determining whether the target WEB application belongs to the speed-up WEB application, includes the following steps: S10211. Obtain the URL of the target WEB application.
[0046] In this embodiment, the client first obtains the URL of the target WEB application. For example, the user accesses WEB application A, whose URL is "https: / / www.xxxxxx.com / cacheapp / application-a / index.html." The client extracts the URL from the request and performs the next step of judgment, that is, executing step S10212.
[0047] S10212. Determine whether the URL includes a predefined domain name, where the domain name is a unified domain name of the WEB application that needs to be accelerated.
[0048] In this embodiment, the client matches the acquired URL with a predefined unified domain name. For example, all WEB applications of the application use the domain name "https: / / www.xxxxxx.com / cacheapp", and the client checks whether the URL contains this domain name.
[0049] S10213: If included, determine whether the WEB application is a speed-up WEB application based on the path information in the URL.
[0050] In this embodiment, if the URL contains a predefined domain name, the client will further analyze the path information of the URL. For example, the URL path "application-a" indicates a module related to stock quotes. The client will determine whether the web application A belongs to the speed-up web application based on the path information.
[0051] S10214: If not included, mark the target WEB application as a non-speed-up WEB application.
[0052] In this embodiment, if the URL does not contain a predefined domain name, or the path information indicates that the module is not a high-frequency access module (such as some pages with low update frequency), the client marks the WEB application as a non-speed-up WEB application. For non-speed-up WEB applications, the client directly obtains the corresponding page data from the application publishing platform for rendering.
[0053] As an example, suppose the user opens the stock quotation module, and the client obtains the URL "https: / / www.xxxxxx.com / cacheapp / stock / market". First, the client determines whether the URL contains the predefined domain name "https: / / www.xxxxxx.com / cacheapp". It is found that it does, so it proceeds to the next step. Then, the client analyzes the path " / stock / market" in the URL. The stock quotation module corresponding to this path is considered to be a data module that is frequently accessed and needs to be accelerated. Therefore, the client marks the WEB application as a speed-up WEB application. On the contrary, if the module path accessed by the user is " / user / settings", this module is a low-frequency access settings page and does not belong to a speed-up WEB application. The client marks the WEB application as a non-speed-up WEB application. It should be noted that the above is only an example and does not constitute a limitation of the present invention.
[0054] In one embodiment, if Figure 5 As shown, in step S102, the WEB application information also includes the name corresponding to each WEB application in the mobile application; That is, when it is detected that a user opens a target WEB application, the update time and storage time corresponding to the target WEB application are obtained from the local cache, including the following steps: S1024, when it is detected that the user opens the target WEB application, obtaining the name corresponding to the target WEB application; S1025. According to the name, obtain the update time and storage time corresponding to the target WEB application from the local cache.
[0055] In some embodiments, when the client detects that a user opens a target WEB application, for example, the user opens a stock quote module, the client first obtains the name of the target WEB application (for example, stock quotes). Next, the client searches and extracts the update time and storage time corresponding to the target WEB application from the local cache based on the obtained target WEB application name.
[0056] Through this process, the client can quickly obtain relevant data from the local cache according to the name of the target WEB application, optimize the data access process, and improve the user experience.
[0057] In one embodiment, step S101, that is, obtaining the web application information of the mobile application in the application publishing platform, includes the following steps: S1011. When the mobile application is started, a first request is initiated to the application publishing platform, so that the application publishing platform queries and obtains the WEB application information of the mobile application according to the first request, and returns it to the client.
[0058] In this embodiment, when the mobile application is started, a first request is initiated to the application publishing platform, so that the application publishing platform queries and obtains the WEB application information of the mobile application according to the first request, and returns it to the client, wherein the WEB application information includes the name, update time and other information of each WEB application in the mobile application.
[0059] For example: [ { "name": "WEBAPPA", "time": "2024-10-01 14:30:00" }, { "name": "WEBAPPB", "time": "2024-10-02 14:30:00" }, ....... ] Through this process, the mobile application can uniformly obtain information about all WEB applications in the mobile application when it is started. Compared with the previous method of obtaining information from the application publishing platform each time a WEB application is visited, this approach greatly reduces the workload of the application publishing platform, significantly improves the response speed, and optimizes the user experience during use.
[0060] That is, if a mobile application APP contains multiple WEB applications, for example, there are 6 WEB applications such as ABCDEF. When WEB application A is opened, it needs to determine whether it has been updated, which means initiating a request to the publishing platform to inquire about the corresponding name and time information. Similarly, when WEB application B is opened, it faces the same requirements. However, when the mobile application APP is started, it will uniformly inquire the publishing platform for all WEB applications included in the mobile application, and save the query results to the local cache, so there is no need to inquire each WEB application separately, which further improves the response speed.
[0061] In fact, the number of WEB applications involved in a mobile application APP is far more than these 6, there may be more than 60. Obviously, only one access to the network is required to obtain the update information of all WEB applications. Compared with accessing the network for more than 60 applications one by one, the speed will be significantly improved.
[0062] It should be understood that the above is merely an example of explanation of the technical effect achieved by the present invention and does not constitute a limitation of the present invention.
[0063] It should be noted that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0064] Second, as Figure 2 As shown, a cache speed-up method is provided, and the method is applied in Figure 1 The following steps are used to illustrate the application publishing platform in the example: S201, receiving a first request sent by a client; S202. According to the first request, the web application information of the mobile application is sent to the client, so that the client stores the web application information in the local cache, wherein the web application information includes the update time corresponding to each web application in the mobile application; when the client detects that the user opens the target web application, the client obtains the update time and storage time corresponding to the target web application from the local cache, wherein the storage time is the time when the target web application was last updated and stored in the local cache; the client compares whether the update time and storage time of the target web application are consistent; if they are consistent, the client obtains the page data corresponding to the target web application from the local cache and renders it; if they are inconsistent, the client deletes the corresponding page data in the local cache and sends a second request to the application publishing platform; S203, receiving a second request sent by the client; S204. According to the second request, the latest page data corresponding to the target WEB application is sent to the client, so that the client renders the latest page data and stores the latest page data in the local cache.
[0065] In some implementations, after receiving the first request sent by the client, the application publishing platform will query the web application information of the mobile application according to the first request and return it to the client. The web application information includes the update time corresponding to each web application in the mobile application; Furthermore, after the client receives the WEB application information of the mobile application, it detects whether the user opens the target WEB application in the mobile application. When it is detected that the user opens the target WEB application, the client obtains the update time and storage time corresponding to the target WEB application from the local cache and compares them. If they are consistent, the client obtains the page data corresponding to the target WEB application from the local cache and renders it; if they are inconsistent, the client deletes the corresponding page data in the local cache and sends a second request to the application publishing platform.
[0066] After receiving the second request sent by the client, the application publishing platform will return the latest page data corresponding to the target WEB application according to the second request. After receiving the latest page data corresponding to the target WEB application, the client first renders the page according to the latest page data, and stores the latest page data in the local cache for next use. In this way, the timeliness and accuracy of the data are guaranteed, and the cache mechanism ensures that frequent requests to the application publishing platform are reduced, effectively reducing the data transmission between the client and the application publishing platform, improving the efficiency of data access, and improving the user experience.
[0067] It should be understood that the implementation details of the above steps S201 to S204 can refer to the description of the embodiment of steps S101 to S105, and will not be repeated here to avoid repetition.
[0068] In one embodiment, if Figure 6 As shown, the method further comprises the following steps: S205, receiving a target notification sent by the build platform, wherein the target notification is sent after the build platform pulls code from the GIT repository and executes a build program to build an updated WEB application; S206: Update the update time of the corresponding WEB application in the mobile application according to the target notification.
[0069] In some embodiments, when the development team submits new code in the GIT repository and triggers the build program, the build platform will pull the latest code from the GIT repository and perform a build operation to generate an updated WEB application. After the build is completed, the build platform will send a target notification to inform the application publishing platform that the WEB application has been updated. The target notification may include, but is not limited to, the updated WEB application name, path, and new update timestamp. This target notification conveys to the application publishing platform that the newly built WEB application is ready and can be updated.
[0070] After receiving the target notification from the construction platform, the application publishing platform will update the update time of the WEB application according to the WEB application name and path provided in the target notification. For example, after receiving the update notification of WEB application A, the application publishing platform updates the update time field of WEB application A to a new timestamp, for example, updating "2024-10-01 15:00:00" to "2024-11-25 14:00:00", which is only used as an example here.
[0071] Through this process, it is ensured that relevant information can be synchronized to the client in time every time the WEB application is updated. The client determines whether the cached data is expired by obtaining the latest update time, ensuring the real-time nature of the data. Effective collaboration between the construction platform and the application publishing platform enables the WEB application to efficiently and seamlessly push the latest data to the client when it is updated, and optimizes data loading speed and user experience. At the same time, unnecessary network requests are reduced, ensuring that end users can access the latest functions and data in real time.
[0072] It should be understood that when the construction platform sends the target notification to the application publishing platform, the corresponding latest page data will also be sent to the application publishing platform, so as to achieve the update of the corresponding WEB application.
[0073] It should be noted that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0074] In one embodiment, a WEB application cache speed-up system is provided, and the WEB application cache speed-up system corresponds to the WEB application cache speed-up method in the above embodiment. Figure 7 As shown, the WEB application cache speed-up system includes a first acquisition module 101, a detection module 102, a comparison module 103, a first rendering module 104, a second rendering module 105, a first sending module 201, a second sending module 202, a receiving module 203 and an updating module 204. The functional modules are described in detail as follows: The WEB application cache acceleration system includes a client and an application publishing platform; The client includes: The first acquisition module 101 is used to acquire the web application information of the mobile application in the application publishing platform and store the web application information in a local cache, wherein the web application information includes the update time corresponding to each web application in the mobile application; The detection module 102, when detecting that a user opens a target WEB application, obtains the update time and storage time corresponding to the target WEB application from the local cache, wherein the storage time is the time when the target WEB application was last stored in the local cache; Comparison module 103, used to compare whether the update time and storage time of the target WEB application are consistent; A first rendering module 104, configured to obtain the page data corresponding to the target WEB application from the local cache and render the page data if they are consistent; The second rendering module 105 is used to delete the page data corresponding to the target WEB application in the local cache if there is inconsistency, and obtain the latest page data corresponding to the target WEB application from the application publishing platform; render the latest page data, and store the latest page data in the local cache.
[0075] In one embodiment, the detection module 102 is specifically configured to: When it is detected that a user opens a target WEB application, it is determined whether the target WEB application is a speed-up WEB application; If yes, then obtaining the update time and storage time corresponding to the target WEB application from the local cache; If not, the latest page data corresponding to the target WEB application is obtained from the application publishing platform, and the latest page data is rendered.
[0076] In one embodiment, the detection module 102 is further configured to: Obtain the URL of the target WEB application; Determine whether the URL includes a predefined domain name, where the domain name is a unified domain name of the WEB application that needs to be accelerated; If included, judging whether the WEB application is a speed-up WEB application according to the path information in the URL; If not included, the target WEB application is marked as a non-speed-up WEB application.
[0077] In one embodiment, the web application information further includes a name corresponding to each web application in the mobile application; the detection module 102 is further configured to: When it is detected that the user opens the target WEB application, the name corresponding to the target WEB application is obtained; According to the name, the update time and storage time corresponding to the target WEB application are obtained from the local cache.
[0078] In one embodiment, the first acquisition module 101 is specifically configured to: When the mobile application is started, a first request is initiated to the application publishing platform, so that the application publishing platform queries and obtains the WEB application information of the mobile application according to the first request, and returns it to the client.
[0079] Application publishing platforms include: The first sending module 201 is used to receive a first request sent by a client; according to the first request, the WEB application information of the mobile application is sent to the client, so that the client stores the WEB application information in the local cache, and the WEB application information includes the update time corresponding to each WEB application in the mobile application; when the client detects that the user opens the target WEB application, the client obtains the update time and storage time corresponding to the target WEB application from the local cache, wherein the storage time is the time when the target WEB application was last updated and stored in the local cache; the client compares whether the update time and storage time of the target WEB application are consistent; if they are consistent, the client obtains the page data corresponding to the target WEB application from the local cache and renders it; if they are inconsistent, the client deletes the corresponding page data in the local cache and sends a second request to the application publishing platform; The second sending module 202 is used to receive a second request sent by the client; according to the second request, send the latest page data corresponding to the target WEB application to the client, so that the client renders the latest page data and stores the latest page data in the local cache.
[0080] In one embodiment, the application publishing platform further includes: The receiving module 203 is used to receive a target notification sent by the building platform, wherein the target notification is sent after the building platform pulls the code from the GIT repository and executes the building program to build an updated WEB application; The updating module 204 is used to update the update time of the corresponding WEB application in the mobile application according to the target notification.
[0081] For the specific limitations of the WEB application cache speed-up system, please refer to the limitations of the WEB application cache speed-up method above, which will not be repeated here. Each module in the above-mentioned WEB application cache speed-up system can be implemented in whole or in part through software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0082] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 8 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data required for running WEB application cache acceleration. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a WEB application cache acceleration method is implemented.
[0083] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program: Obtaining web application information of mobile applications in the application publishing platform, and storing the web application information in a local cache, wherein the web application information includes an update time corresponding to each web application in the mobile application; When it is detected that a user opens a target WEB application, the update time and storage time corresponding to the target WEB application are obtained from the local cache, wherein the storage time is the time when the target WEB application was last updated and stored in the local cache; Comparing whether the update time and storage time of the target WEB application are consistent; If they are consistent, the page data corresponding to the target WEB application is obtained from the local cache and rendered; If they are inconsistent, the page data corresponding to the target WEB application in the local cache is deleted, and the latest page data corresponding to the target WEB application is obtained from the application publishing platform; the latest page data is rendered, and the latest page data is stored in the local cache.
[0084] or, Receive a first request sent by a client; According to the first request, the WEB application information of the mobile application is sent to the client, so that the client stores the WEB application information in the local cache, wherein the WEB application information includes the update time corresponding to each WEB application in the mobile application; when the client detects that the user opens the target WEB application, the client obtains the update time and storage time corresponding to the target WEB application from the local cache, wherein the storage time is the time when the target WEB application was last updated and stored in the local cache; the client compares whether the update time and storage time of the target WEB application are consistent; if they are consistent, the client obtains the page data corresponding to the target WEB application from the local cache and renders it; if they are inconsistent, the client deletes the corresponding page data in the local cache and sends a second request to the application publishing platform; receiving a second request sent by the client; According to the second request, the latest page data corresponding to the target WEB application is sent to the client, so that the client renders the latest page data and stores the latest page data in the local cache.
[0085] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: Obtaining web application information of mobile applications in the application publishing platform, and storing the web application information in a local cache, wherein the web application information includes an update time corresponding to each web application in the mobile application; When it is detected that a user opens a target WEB application, the update time and storage time corresponding to the target WEB application are obtained from the local cache, wherein the storage time is the time when the target WEB application was last updated and stored in the local cache; Comparing whether the update time and storage time of the target WEB application are consistent; If they are consistent, the page data corresponding to the target WEB application is obtained from the local cache and rendered; If they are inconsistent, the page data corresponding to the target WEB application in the local cache is deleted, and the latest page data corresponding to the target WEB application is obtained from the application publishing platform; the latest page data is rendered, and the latest page data is stored in the local cache.
[0086] or, Receive a first request sent by a client; According to the first request, the WEB application information of the mobile application is sent to the client, so that the client stores the WEB application information in the local cache, wherein the WEB application information includes the update time corresponding to each WEB application in the mobile application; when the client detects that the user opens the target WEB application, the client obtains the update time and storage time corresponding to the target WEB application from the local cache, wherein the storage time is the time when the target WEB application was last updated and stored in the local cache; the client compares whether the update time and storage time of the target WEB application are consistent; if they are consistent, the client obtains the page data corresponding to the target WEB application from the local cache and renders it; if they are inconsistent, the client deletes the corresponding page data in the local cache and sends a second request to the application publishing platform; receiving a second request sent by the client; According to the second request, the latest page data corresponding to the target WEB application is sent to the client, so that the client renders the latest page data and stores the latest page data in the local cache.
[0087] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0088] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0089] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A method for accelerating the cache of a web application, characterized in that: Applied to a client, the method comprises: Obtaining web application information of mobile applications in the application publishing platform, and storing the web application information in a local cache, wherein the web application information includes an update time corresponding to each web application in the mobile application; When it is detected that a user opens a target WEB application, the update time and storage time corresponding to the target WEB application are obtained from the local cache, wherein the storage time is the time when the target WEB application was last updated and stored in the local cache; Comparing whether the update time and storage time of the target WEB application are consistent; If they are consistent, the page data corresponding to the target WEB application is obtained from the local cache and rendered; If they are inconsistent, the page data corresponding to the target WEB application in the local cache is deleted, and the latest page data corresponding to the target WEB application is obtained from the application publishing platform; the latest page data is rendered, and the latest page data is stored in the local cache.
2. The WEB application cache speed-up method according to claim 1, characterized in that: When it is detected that a user opens a target WEB application, acquiring the update time and storage time corresponding to the target WEB application from the local cache includes: When it is detected that a user opens a target WEB application, it is determined whether the target WEB application is a speed-up WEB application; If yes, then obtaining the update time and storage time corresponding to the target WEB application from the local cache; If not, the latest page data corresponding to the target WEB application is obtained from the application publishing platform, and the latest page data is rendered.
3. The WEB application cache speed-up method according to claim 2, characterized in that: The determining whether the target WEB application is a speed-up WEB application includes: Obtain the URL of the target WEB application; Determine whether the URL includes a predefined domain name, where the domain name is a unified domain name of the WEB application that needs to be accelerated; If included, judging whether the WEB application is a speed-up WEB application according to the path information in the URL; If not included, the target WEB application is marked as a non-speed-up WEB application.
4. The WEB application cache speed-up method according to claim 1, characterized in that: The WEB application information also includes the name corresponding to each WEB application in the mobile application; When it is detected that a user opens a target WEB application, acquiring the update time and storage time corresponding to the target WEB application from the local cache includes: When it is detected that the user opens the target WEB application, the name corresponding to the target WEB application is obtained; According to the name, the update time and storage time corresponding to the target WEB application are obtained from the local cache.
5. The WEB application cache speed-up method according to claim 1, characterized in that: The step of obtaining the web application information of the mobile application in the application publishing platform includes: When the mobile application is started, a first request is initiated to the application publishing platform, so that the application publishing platform queries and obtains the WEB application information of the mobile application according to the first request, and returns it to the client.
6. A method for accelerating the cache of a web application, characterized in that: Applied to an application publishing platform, the method includes: Receive a first request sent by a client; According to the first request, the WEB application information of the mobile application is sent to the client, so that the client stores the WEB application information in the local cache, wherein the WEB application information includes the update time corresponding to each WEB application in the mobile application; when the client detects that the user opens the target WEB application, the client obtains the update time and storage time corresponding to the target WEB application from the local cache, wherein the storage time is the time when the target WEB application was last updated and stored in the local cache; the client compares whether the update time and storage time of the target WEB application are consistent; if they are consistent, the client obtains the page data corresponding to the target WEB application from the local cache and renders it; if they are inconsistent, the client deletes the corresponding page data in the local cache and sends a second request to the application publishing platform; receiving a second request sent by the client; According to the second request, the latest page data corresponding to the target WEB application is sent to the client, so that the client renders the latest page data and stores the latest page data in the local cache.
7. The WEB application cache speed-up method according to claim 6, characterized in that: The method further comprises: Receiving a target notification sent by a build platform, wherein the target notification is sent after the build platform pulls code from a GIT repository and executes a build program to build an updated WEB application; According to the target notification, the update time of the corresponding WEB application in the mobile application is updated.
8. A WEB application cache speed-up system, characterized in that: The WEB application cache speed-up system includes a client, and the client includes: A first acquisition module is used to acquire the web application information of the mobile application in the application publishing platform and store the web application information in a local cache, wherein the web application information includes the update time corresponding to each web application in the mobile application; The detection module, when detecting that a user opens a target WEB application, obtains the update time and storage time corresponding to the target WEB application from the local cache, wherein the storage time is the time when the target WEB application was last stored in the local cache; A comparison module, used to compare whether the update time and storage time of the target WEB application are consistent; A first rendering module, configured to obtain the page data corresponding to the target WEB application from the local cache and render the page data if they are consistent; The second rendering module is used to delete the page data corresponding to the target WEB application in the local cache if there is inconsistency, and obtain the latest page data corresponding to the target WEB application from the application publishing platform; render the latest page data, and store the latest page data in the local cache.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the WEB application cache speed-up method as described in any one of claims 1 to 5 is implemented, or when the processor executes the computer program, the WEB application cache speed-up method as described in claim 6 or 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by the processor, the WEB application cache speed-up method as described in any one of claims 1 to 5 is implemented, or when the computer program is executed by the processor, the WEB application cache speed-up method as described in claim 6 or 7 is implemented.