Homepage cold start method and device of application program, electronic equipment and storage medium
By pre-built-in homepage business data in the application installation package, and combining the comparison and update mechanism between local disk cache and network cache, the serious white screen phenomenon during cold startup of the application homepage is solved, achieving a fast response and smooth user experience.
Patent Information
- Application Number
- CN202411533693.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-02-25
AI Technical Summary
The existing technology cannot effectively shorten the white screen time during cold start of the application homepage. Especially in the case of poor network conditions, the white screen phenomenon is serious and affects the user experience.
By pre-built-in homepage business data in the application installation package, the data is read directly from the installation package during the first cold start for page rendering; during subsequent cold starts, it is detected whether the homepage data exists in the local disk cache, and if it exists, it is read and rendered; at the same time, the latest homepage data version is obtained from the network cache, compared with the local cache version, update the local cache and re-render the page.
It effectively shortens the white screen time and improves the user experience. Especially in the poor network environment, it can still ensure the application's rapid response and seamless start-up.
Smart Images

Figure CN119512644A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for cold starting a home page of an application. Background Art
[0002] During the cold start process of an application, the white screen phenomenon on the home page is a major pain point that affects the user experience. The white screen phenomenon means that after the application is started, the screen that the user sees is temporarily blank and cannot display any content immediately. Especially when the network conditions are poor or the data is loading slowly, the user needs to face a long period of waiting for the blank screen.
[0003] At present, the industry has mainly adopted the following two optimization strategies to reduce the white screen time:
[0004] Data caching technology: By introducing data caching technology at the back-end interface layer, data processing and response speed can be accelerated, network request time can be shortened, and user waiting time can be reduced.
[0005] On-demand loading strategy: By modularizing page content or loading property files, only necessary content is loaded, reducing dependence on network resources and thus reducing the time for the first page rendering.
[0006] Although these existing technologies have reduced the white screen phenomenon during the cold start process to a certain extent, they have not completely solved the problem. Even when the network conditions are good, users still need to experience a short loading wait. In environments with poor network conditions (such as elevators or new buildings), the white screen time is more significant, and the effects of existing optimization methods are limited. When an application is cold started, in order to obtain home page data, it usually takes 500 milliseconds to 2 seconds of network request time, and even longer in a weak network environment. This not only increases the user's waiting time, but also seriously affects the user's first-time experience, which may lead to user loss and affect the application's traffic and economic benefits. Summary of the invention
[0007] In view of this, the embodiments of the present application provide a method, device, electronic device and storage medium for cold starting the home page of an application to solve the problem that the prior art cannot effectively shorten the white screen time, the white screen phenomenon is serious, and the user experience is reduced.
[0008] According to a first aspect of an embodiment of the present application, a method for cold starting the home page of an application is provided, comprising: when the application is cold started for the first time, reading resources for page rendering from home page business data pre-built into the application installation package, and performing initial rendering of the home page based on the resources; during subsequent cold starts, detecting whether there is home page data stored in the local disk cache, and if so, reading the home page data from the local disk cache, and rendering the page based on the home page data; during the cold start process, obtaining the latest home page data version from the network cache, and comparing the latest home page data version with the home page data version in the local disk cache; when it is detected that the home page data version in the local disk cache is inconsistent with the home page data version in the network cache, updating the home page data in the local disk cache to the latest home page data in the network cache, and re-rendering the page based on the updated home page data.
[0009] According to a second aspect of an embodiment of the present application, a homepage cold start device for an application is provided, comprising: a reading module, configured to read resources for page rendering from homepage business data pre-built into an application installation package when the application is cold started for the first time, and to perform initial rendering of the homepage based on the resources; a detection module, configured to detect whether there is homepage data stored in a local disk cache during a subsequent cold start, and if so, read the homepage data from the local disk cache, and perform page rendering based on the homepage data; a comparison module, configured to obtain the latest homepage data version from the network cache during the cold start process, and compare the latest homepage data version with the homepage data version in the local disk cache; an update module, configured to update the homepage data in the local disk cache to the latest homepage data in the network cache when it is detected that the homepage data version in the local disk cache is inconsistent with the homepage data version in the network cache, and re-render the page based on the updated homepage data.
[0010] According to a third aspect of an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the steps of the above method are implemented when the processor executes the computer program.
[0011] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0012] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0013] When the application is cold started for the first time, the resources used for page rendering are read from the homepage business data pre-built into the application installation package, and the initial rendering of the homepage is performed based on the resources; when the application is cold started for the first time, the homepage data stored in the local disk cache is detected, and if so, the homepage data is read from the local disk cache, and the page is rendered based on the homepage data; during the cold start process, the latest homepage data version is obtained from the network cache, and the latest homepage data version is compared with the homepage data version in the local disk cache; when it is detected that the homepage data version in the local disk cache is inconsistent with the homepage data version in the network cache, the homepage data in the local disk cache is updated to the latest homepage data in the network cache, and the page is re-rendered based on the updated homepage data. This application can effectively shorten the white screen time, reduce the white screen phenomenon when the application is cold started, and improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0015] Figure 1 This is a schematic diagram of the implementation process of the application homepage cold start zero white screen technology provided in the embodiment of the present application;
[0016] Figure 2 It is a flowchart of a method for cold starting the home page of an application provided in an embodiment of the present application;
[0017] Figure 3 It is a structural diagram of a homepage cold start device of an application provided in an embodiment of the present application;
[0018] Figure 4 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0019] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0020] It should be understood that the various steps described in the method implementation of the present application can be performed in different orders and / or performed in parallel. In addition, the method implementation may include additional steps and / or omit the steps shown. The scope of the present application is not limited in this respect.
[0021] During the cold start process of mobile applications, users often face a troubling problem - the white screen phenomenon on the home page. The so-called white screen means that when the user opens the application, there is nothing on the screen, only a blank space. This usually happens after the application is started but before the data is loaded. This white screen phenomenon becomes more obvious when the network condition is poor or the data loading speed is slow.
[0022] With the development of smart phones and mobile Internet, users have higher and higher requirements for the response speed and user experience of applications. When users see a white screen for a long time when opening an application, they are likely to feel anxious and impatient, and even interrupt the use of the application. Therefore, reducing the cold start white screen time is one of the key issues to improve user experience.
[0023] To address this problem, the industry has explored two main white screen optimization strategies:
[0024] 1. Data caching strategy:
[0025] By introducing data caching technology at the backend interface layer, data processing and response are accelerated, and network request time is reduced. The role of caching is that when the application starts, it can use previously saved data without having to request it from the server every time, thereby shortening network latency and reducing user waiting time. The disadvantage of this method is that the cached data may not be the latest content, and the caching mechanism has limited optimization effect in weak network conditions.
[0026] 2. On-demand loading strategy:
[0027] Through the modular page content or property file loading strategy, the application only loads the necessary basic pages during cold start, and the rest of the content is loaded gradually as needed later. This method reduces the reliance on network resources during the first load, which helps improve loading efficiency. The disadvantage of this method is that the on-demand loading strategy may cause users to experience delayed loading when scrolling or clicking, and some key data still needs to be obtained through network requests, so there is still a white screen phenomenon.
[0028] Although the above two optimization strategies reduce the white screen time to a certain extent, they do not completely solve the white screen problem when the application is cold started. The following technical problems still exist in the prior art:
[0029] 1. The white screen phenomenon still exists:
[0030] Even under good network conditions, users still need to wait for a short period of time before they can see the content of the application interface. This is because the application still needs to perform background network requests and data processing during cold start.
[0031] 2. Poor performance in weak network environment:
[0032] In environments with poor network conditions, such as in elevators or new buildings, network request speeds are significantly slowed down, and the white screen phenomenon is more serious. Existing optimization strategies are powerless in this situation and cannot effectively shorten the white screen time.
[0033] 3. User experience is affected:
[0034] Since the white screen phenomenon is common when an application is cold started, this greatly affects the user's initial use experience and may cause user loss, which in turn affects the application's usage traffic and economic benefits.
[0035] In general, the existing technology has improved the cold start white screen problem to a certain extent, but it has not fundamentally solved it, especially in a weak network environment, this white screen phenomenon is still a difficult pain point to overcome. Developing a technical solution that can completely eliminate or significantly reduce the cold start white screen time has become an urgent problem to be solved.
[0036] In view of the problems existing in the above-mentioned prior art, this application proposes a revolutionary solution - zero white screen technology for cold start of the application home page. This technology stores the home page data in the disk cache or installation package in advance, so that the business data can be directly loaded and displayed from the local without waiting for network requests during the cold start phase, truly realizing zero white screen startup. At the same time, the technology also integrates the network cache data reading and data version comparison mechanism to ensure that users can see the latest and most accurate business information in real time while enjoying a seamless experience. This innovation not only completely solves the problem of white screen on the cold start of the application home page, but also brings unprecedented smoothness and convenience to users.
[0037] In order to completely change this situation, this application innovatively proposes a comprehensive solution for cold start of the application homepage with zero white screen. The technical solution of this application integrates data preloading, disk caching, and intelligent update mechanism. Specifically, by pre-building the necessary homepage business data into the application and combining it with efficient disk caching technology, the application can immediately load data from the local computer and render the page when it is cold started, achieving a seamless user experience, and users hardly feel any waiting time.
[0038] Furthermore, in order to maintain the timeliness and accuracy of the home page data, the technical solution of this application also introduces a data version comparison and dynamic update mechanism. By intelligently judging the version difference between the local cached data and the latest server data, the system can automatically trigger the data update process to ensure that users can obtain the latest and most accurate information in a timely manner while enjoying a smooth experience. This comprehensive solution not only greatly improves the user experience, but also effectively reduces the risk of user churn, bringing a more stable user base and sustainable economic growth to application developers.
[0039] First, the implementation process and principle of the application homepage cold start zero white screen technology provided by the technical solution of this application are explained in combination with the accompanying drawings and specific embodiments. Figure 1 This is a schematic diagram of the implementation process of the application homepage cold start zero white screen technology provided in the embodiment of the present application. Figure 1 As shown in the figure, the application homepage cold start zero white screen technology can specifically include the following contents:
[0040] The zero white screen technology for cold start of the application homepage proposed in this application solves the white screen problem when the application homepage is cold started through the collaborative work of three core parts, namely, data built-in zero white screen, disk cache zero white screen, and data dynamic update mechanism, to achieve a smooth user experience.
[0041] 1. Data built-in zero white screen
[0042] The core idea of data built-in zero white screen is to pre-build the necessary data of the home page into the application installation package to ensure that the application can immediately display the home page content even when there is no network request or network delay, avoiding the white screen. The specific implementation steps are as follows:
[0043] Data preloading: During the packaging phase of the application, the developer embeds the complete business data required for the homepage (including text, images, videos and other rendering resources) directly into the installation package. These resources will be used as default data to ensure that the application can be used immediately when it is cold started.
[0044] First cold start: When a user cold starts an application for the first time, the system first checks whether there is valid home page data in the local disk cache. Figure 1 When it is determined that the home page data does not exist in the local disk cache, the system will automatically read the home page data from the built-in resources (preloaded data in the installation package).
[0045] Page rendering: After reading the built-in resources, the system will immediately load the data into the memory cache and quickly render the home page to show the user the complete business content and ensure that there is no white screen at startup.
[0046] 2. Disk cache zero white screen
[0047] The core of disk cache zero white screen is to make full use of the cache data stored locally to speed up the loading and display of the home page during subsequent cold starts. The workflow of this technology is as follows:
[0048] Check disk cache: During the subsequent cold start of the application, the system will first check whether the local disk cache stores valid home page data. If there is valid data in the disk cache, the process will follow Figure 1 As shown in , the system reads the home page data directly from the disk cache.
[0049] Update memory cache and render: The read data will be loaded into the memory cache and used to render the home page immediately, ensuring that users do not have to rely on network requests during cold start, reducing loading time and avoiding white screens.
[0050] Memory cache update: At the same time, the data in the memory cache will also be updated based on the data read from the disk cache to improve subsequent loading and rendering speeds.
[0051] 3. Dynamic data update mechanism
[0052] In order to ensure that users always see the latest business data, this application introduces a dynamic data update mechanism, combined with network cache and version verification technology, to achieve automatic update of home page data. The specific implementation steps are as follows:
[0053] Get network cache data: During a cold start, the system will initiate a network request and try to get the latest version of the home page data from the network cache. Figure 1 As shown in "Get Network Cache".
[0054] Version comparison: Once the data version in the network cache is obtained, the system will compare it with the data version in the local disk cache. If it is detected that the version in the local cache is consistent with the version in the network cache, the process ends and the application continues to use the local cache data to avoid unnecessary network data loading.
[0055] Version update and cache storage: If the local cache and network cache are detected to be inconsistent, the system will update the home page data from the network cache, store the latest data in the memory cache, and then re-render the page. At the same time, the updated data will also be stored in the disk cache so that it can be used directly during the next cold start.
[0056] Re-render the page: When the versions are inconsistent and the data is updated, the system will re-render the homepage to ensure that users can see the latest business content, further improving the timeliness and accuracy of the data.
[0057] Combination Figure 1 As shown, the homepage cold start zero white screen technology of this application completes the following key steps in sequence:
[0058] First cold start: The system checks whether there is home page data in the local disk cache. If there is no cached data, the data is read from the built-in resources in the application installation package. The built-in data is loaded into the memory cache and used for home page rendering to ensure zero white screen startup without network requests.
[0059] Subsequent cold start: The system first checks the local disk cache. If there is valid cached data, it will be read and rendered directly to reduce the white screen time. At the same time, the latest homepage data version is obtained from the network and compared. If the network data version is found to be updated, the system will update the local cache and re-render the page.
[0060] Dynamic update mechanism: The system ensures the consistency of local and network cache data through a version verification mechanism. If there is inconsistency, the system automatically updates and stores the latest data to the local disk cache to ensure that users see the latest content.
[0061] Through the collaborative work of the above three parts, the technical solution of this application not only effectively reduces the white screen phenomenon during cold start, but also ensures the timeliness of the home page data, bringing a significant improvement in user experience, especially in poor network environment, it can still ensure the application's fast response and seamless startup.
[0062] The contents of the technical solution of the present application are described in detail below with reference to the accompanying drawings and specific embodiments.
[0063] Figure 2 1 is a flow chart of a method for cold starting the home page of an application provided in an embodiment of the present application. Figure 2 As shown, the cold start method of the home page of the application may specifically include:
[0064] S201, when the application is cold started for the first time, reading resources for page rendering from homepage business data pre-built into the application installation package, and performing initial rendering of the homepage based on the resources;
[0065] S202, during a subsequent cold start, detecting whether there is home page data stored in the local disk cache, and if so, reading the home page data from the local disk cache, and rendering the page based on the home page data;
[0066] S203, during the cold start process, obtaining the latest home page data version from the network cache, and comparing the latest home page data version with the home page data version in the local disk cache;
[0067] S204, when it is detected that the home page data version in the local disk cache is inconsistent with the home page data version in the network cache, the home page data in the local disk cache is updated to the latest home page data in the network cache, and the page is re-rendered based on the updated home page data.
[0068] In some embodiments, resources for page rendering are read from homepage business data pre-built into the application installation package, and initial rendering of the homepage is performed based on the resources, including:
[0069] When packaging the application, the complete business data required for the current homepage is embedded in the application installation package, wherein the complete business data includes resources for page rendering;
[0070] When the application is cold started for the first time, check whether there is valid home page data in the local disk cache. If there is no valid home page data, read the pre-built-in home page business data from the application installation package;
[0071] The memory cache is updated with the home page business data, and the home page is rendered based on the updated home page data in the memory cache to display the preloaded business content.
[0072] Specifically, the present application provides a method for implementing a cold start of an application home page, by reading resources for page rendering from home page business data pre-built into the application installation package, thereby achieving a zero white screen experience during the cold start process.
[0073] In this embodiment, when the application is cold started for the first time, it preferentially reads the pre-built-in home page business data from the installation package without waiting for the network to load, thereby quickly displaying the home page content and avoiding the user from facing a white screen for a long time.
[0074] First, during the packaging phase of the application, the developer embeds the complete business data required for the homepage of the current version into the installation package. The business data includes a variety of resources required for page rendering, such as text, images, videos, animations, and other elements. The purpose of this is to ensure that when the application is cold-started for the first time, it does not need to rely on network loading, but can directly extract the resources required for rendering from the installation package.
[0075] Furthermore, when the user starts the application for the first time, the system first detects whether there is valid home page data in the local disk cache. If there is no valid cache data (i.e., the application is started for the first time, or the previous cache data is invalid), the system will skip loading the disk cache data.
[0076] Furthermore, since there is no valid home page data in the local disk cache, the system will read the pre-built-in home page business data from the application installation package. These built-in data are embedded when the application is packaged, ensuring that the application can immediately obtain the required page rendering resources from the local without waiting for network requests.
[0077] Furthermore, the home page data read by the system will be loaded into the memory cache, and the data in the memory cache will then be used to quickly render the home page. Based on these built-in resources, the system can immediately display the home page content of the application, ensuring that users have almost no waiting time during the cold start process and achieve a zero white screen experience.
[0078] For example, after the application is started, the user can immediately see the text, pictures and other multimedia content on the homepage. These contents are extracted from the built-in resource library and loaded into the memory for fast rendering, avoiding the white screen problem caused by network request delays in traditional methods.
[0079] This embodiment embeds the home page business data when packaging the application, so that there is no need to rely on network loading during the first cold start, and the resources required for rendering are directly read from the installation package, which greatly reduces the white screen time. This method not only improves the user experience, but also ensures the display consistency of the home page data at the first startup, especially in the case of poor network or slow network requests, smooth page loading can still be achieved. This embodiment is particularly suitable for scenarios when users use an application for the first time, reducing the negative experience caused by the white screen, while ensuring efficient startup of the application.
[0080] In some embodiments, detecting whether there is home page data stored in the local disk cache, and if so, reading the home page data from the local disk cache, and rendering the page based on the home page data includes:
[0081] Check the home page data in the local disk cache to determine whether there is valid home page data in the local disk cache;
[0082] When it is determined that there is valid home page data in the local disk cache, the valid home page data is read from the local disk cache;
[0083] The memory cache is updated with the home page business data, and the home page is rendered based on the updated home page data in the memory cache to display the preloaded business content.
[0084] Specifically, the application homepage cold start technology of this application uses the local disk cache to store and read the homepage data, ensuring that even in poor network conditions, fast page rendering can be achieved during subsequent cold starts to avoid white screen phenomena. By detecting the validity of data in the local disk cache, the system can effectively use cached data to improve application startup efficiency.
[0085] This embodiment describes in detail how to detect and read the home page data in the local disk cache to achieve instant page rendering when the application is cold started later, avoiding reliance on network requests. The specific steps are as follows:
[0086] First, when the application is cold-started, the system first detects whether there is home page data stored in the local disk cache. This step is judged by accessing the cache file in the local disk storage, and the system checks whether the home page data file is complete and valid.
[0087] Valid data refers to the existence of cached data files and not expired, while invalid data refers to the non-existence of data files or the expiration of data files.
[0088] Furthermore, if it is confirmed during the detection process that there is valid home page data in the local disk cache, the system will directly read the cached data from the local disk. The read home page data includes various resources required for page rendering (such as text, pictures, videos, etc.), which are stored in the local disk when the user last started the application.
[0089] Furthermore, the local cache data read will be immediately loaded into the memory cache. The memory cache is used to improve the efficiency of subsequent page rendering because memory access speed is faster than disk reading. After updating the memory cache, the system quickly completes the page rendering of the home page based on these cached data.
[0090] For example, after reading the cached data, the system will quickly load the text, pictures and other rendered content of the home page, so that users can immediately see the home page interface of the application within a short period of cold start, avoiding the delay caused by network loading.
[0091] Furthermore, by utilizing local disk cache technology, this embodiment ensures that even in poor network conditions, the application can still display data instantly by reading data from the cache without waiting for the network request to complete. This approach greatly reduces the white screen time and provides users with a smoother experience.
[0092] This embodiment uses the local disk cache to store the loaded home page data, and detects the validity of this data during the subsequent cold start. If there is valid cached data, the application does not need to make a network request, and directly reads the data from the local disk cache for page rendering, thereby achieving fast startup and zero white screen experience. This method is particularly suitable for environments with poor network or no network, and effectively improves the startup efficiency of the application through caching technology.
[0093] According to the method of the present embodiment described above, the present embodiment significantly reduces the waiting time for network loading during cold start by rationally utilizing local cached data, and can still ensure instant display of the home page, especially in a weak network environment, thereby improving the user experience.
[0094] In some embodiments, after detecting whether there is home page data stored in the local disk cache, the method further includes:
[0095] When it is determined that there is no valid home page data in the local disk cache, the pre-built-in home page business data is read from the application installation package, the home page of the application is rendered using the home page business data, and the home page business data is updated to the memory cache.
[0096] Specifically, when the application is cold started, if the system detects that there is no valid home page data in the local disk cache, the application will read the home page business data from the pre-built-in installation package, complete the home page rendering, and update the read business data to the memory cache to ensure the efficiency of subsequent startup.
[0097] This embodiment describes in detail how to read built-in data from the installation package to ensure smooth rendering of the home page when the application cannot obtain valid home page data from the local disk cache during cold start. The specific implementation steps are as follows:
[0098] First, when the application is cold started, it will first detect whether there is valid home page data in the local disk cache. This detection step involves reading the cache file stored on the disk and verifying the validity of the file. If the system detects that the cache file does not exist or is damaged, or the cached data has expired, the system will determine that the cached data is invalid.
[0099] Furthermore, when it is determined that the home page data in the local disk cache is invalid, the system will automatically switch to reading the pre-built-in home page service data from the application installation package.
[0100] These built-in homepage data are embedded into the installation package when the application is packaged, and contain the core resources required for page rendering, such as text, pictures, videos or other visual elements.
[0101] The data in the installation package is pre-configured and is not affected by network conditions, ensuring that the system can quickly obtain rendering data even at the first startup or when the local cache fails.
[0102] Furthermore, the read built-in home page business data is used for page rendering of the home page, ensuring that the user can quickly see the home page content of the application.
[0103] At this point, the application loads rendering resources (such as text, images, etc.) read from the installation package and uses these resources to update the memory cache.
[0104] The rendering process is fast and efficient, avoiding users from seeing a white screen, thus achieving a "zero white screen" startup.
[0105] Furthermore, in order to improve the performance of subsequent cold starts, the system will update the homepage business data read from the installation package to the memory cache. The purpose of this is to ensure that after rendering is completed, the memory cache holds the latest business data, which is convenient for subsequent operations.
[0106] By updating this data to the memory cache, the system can read data from the memory for rendering more quickly during subsequent startup, further improving startup efficiency.
[0107] Furthermore, after completing page rendering and updating the memory cache, the application can ensure that during subsequent cold starts, it can quickly utilize the data in the memory for page rendering, reducing dependence on disk and network resources, thereby achieving a more efficient startup experience.
[0108] According to the method of the present embodiment described above, the present embodiment realizes fast rendering of the home page by reading the built-in data in the application installation package when the local disk cache is invalid, ensuring that the user can also get a good startup experience when starting for the first time or when the cached data is invalid. By updating the built-in data to the memory cache, the solution can significantly reduce the waiting time during subsequent cold starts and improve the smoothness of application startup.
[0109] In some embodiments, obtaining the latest home page data version from the network cache and comparing the latest home page data version with the home page data version in the local disk cache includes:
[0110] When the application is cold started, a network request is initiated to obtain the cached home page business data and corresponding version information;
[0111] Compare the home page data version obtained from the network cache with the home page data version stored in the local disk cache to determine whether the two versions are consistent;
[0112] When it is detected that the home page data version in the local disk cache is consistent with the home page data version in the network cache, the update operation is terminated and the home page data in the local disk cache is used for rendering.
[0113] Specifically, the technical solution of this application obtains the latest home page data version from the network cache and compares it with the data version in the local disk cache to ensure the real-time and accuracy of the home page data. During the cold start process, the system automatically compares the versions and determines whether the local cache needs to be updated, thereby optimizing the startup efficiency of the application.
[0114] This example describes how to obtain the home page data version from the network cache when the application is cold started, and compare it with the version in the local disk cache to ensure that the user obtains the latest business data and updates the cache when necessary. The specific implementation steps are as follows:
[0115] First, when the application is cold started, the system first initiates a network request to obtain the cached home page business data and its corresponding version information. This network request can quickly obtain the home page business data from the server-side cache without the need to load the entire data each time.
[0116] The result returned by the network request contains two parts: the actual home page business data (text, images and other rendering resources) and the version number of the home page data. The version number is used to indicate the current version status of the home page data.
[0117] Furthermore, once the home page data version in the network cache is obtained, the system will compare this version information with the home page data version in the local disk cache.
[0118] The version number in the local disk cache is stored at the time of the last cold start or data update, and represents the data version cached at that time.
[0119] The system will check whether the two version numbers are consistent to determine whether the data in the local cache needs to be updated.
[0120] Furthermore, if it is detected that the home page data version in the local disk cache is consistent with the home page data version in the network cache, the system will end the process directly without the need for an update operation. At this point, the system will continue to use the home page data in the local disk cache for page rendering.
[0121] In this case, since the data in the local cache is already the latest version, the system can avoid unnecessary network requests and data update operations, reduce startup time, and optimize resource utilization efficiency.
[0122] Furthermore, if the home page data version in the local disk cache is detected to be inconsistent with the home page data version in the network cache, it means that the data in the local cache is outdated or no longer accurate. At this time, the system will obtain the latest home page business data from the network cache and replace the old data in the local disk cache.
[0123] While replacing the local cache data, the system also updates the data in the memory cache to ensure that the rendering of this cold start can be based on the latest data.
[0124] After the update, the system will re-render the homepage based on the latest data to ensure that the business content seen by users is the latest.
[0125] According to the method of the present embodiment described above, the present embodiment effectively ensures the real-time nature of the home page data by introducing a network cache data version comparison mechanism. During the cold start process, the system first obtains version information from the network cache to determine whether the local data needs to be updated. This mechanism avoids performing a complete network request every time the application is started, thereby improving the startup efficiency of the application.
[0126] When the local cache data version is consistent with the network cache, the system does not need to update the data and directly uses the local cache data for rendering, reducing dependence on the network. Especially when the network conditions are poor, fast startup can still be guaranteed.
[0127] Through version comparison, the system can update local data in a timely manner when it is outdated, ensuring that users see the latest business content and avoiding the display of outdated information.
[0128] By intelligently determining whether data needs to be updated, the system can reduce unnecessary network requests and data transmission, optimize resource usage during cold start, and improve user experience.
[0129] This embodiment is suitable for application scenarios that require frequent updates of home page data. Through the collaborative work of the network and the local cache, it ensures that users can enjoy a fast startup experience and obtain the latest business data.
[0130] In some embodiments, when it is detected that the home page data version in the local disk cache is inconsistent with the home page data version in the network cache, the home page data in the local disk cache is updated to the latest home page data in the network cache, and the page is re-rendered based on the updated home page data, including:
[0131] When it is detected that the home page data version in the local disk cache is inconsistent with the home page data version in the network cache, the home page data in the local disk cache is updated to the latest home page data in the network cache, and the latest home page data is loaded into the memory cache to update the home page data in the memory cache. The home page of the application is re-rendered based on the updated home page data in the memory cache to obtain the latest business content.
[0132] Specifically, when the system detects that the homepage data version in the local disk cache is inconsistent with the homepage data version in the network cache, it will update the local cached data to the latest version in the network cache and re-render the homepage page based on the updated data to ensure that users see the latest business content. This process keeps the homepage content real-time and accurate through automated data update and page re-rendering mechanisms.
[0133] This embodiment describes how to update the data in the local disk cache and load the latest home page data into the memory cache when it is detected that the local cache is inconsistent with the network cache version, so as to re-render the page and display the latest business content. The specific implementation steps are as follows:
[0134] First, when the application is cold started, the system detects the home page data version in the local disk cache and compares it with the latest home page data version obtained from the network cache.
[0135] If the version numbers are inconsistent, it means that the data in the local cache has expired or is invalid, and the latest homepage content cannot be displayed.
[0136] Furthermore, when a version inconsistency is detected, the system will obtain the latest homepage business data from the network cache. This data includes various resources required for rendering the application homepage, such as text, images, videos, etc.
[0137] At this time, the latest data in the network cache not only includes the content of the business data, but also comes with the latest version number information for identifying the update status of the data.
[0138] Furthermore, after obtaining the latest home page data, the system replaces the expired data in the local disk cache with the latest data obtained from the network cache.
[0139] The update process is automated, ensuring that the data in the local cache is always synchronized with the data on the server, preventing users from seeing outdated content.
[0140] Furthermore, after updating the local disk cache, the system will load the latest home page data into the memory cache. The data in the memory cache is used to render the current page and also provides faster data access for subsequent operations.
[0141] By loading data into the memory cache, the system can further speed up page rendering and reduce waiting time during cold start.
[0142] Furthermore, once the data in the memory cache is updated, the system will immediately re-render the application's homepage based on the updated homepage data.
[0143] The system uses the latest resources in the memory cache to quickly render pages and display the latest text, images, and other business content to users, ensuring that the content users see after a cold start is up-to-date and accurate.
[0144] This re-rendering mechanism avoids the situation where users see old data for a long time, improving the real-time user experience and data accuracy.
[0145] Furthermore, after the page rendering is completed, the system can continue to run normally and can still detect the data versions of the local cache and the network cache during the next cold start, ensuring the latest content of the homepage at each startup.
[0146] According to the method of the present embodiment described above, when the local cache data is inconsistent with the network cache data, the system can automatically update the local cache to ensure that the user always sees the latest business content. By loading the latest data into the memory cache and re-rendering the page, the application can quickly display the latest homepage content, reduce the white screen wait during cold start, and improve the user experience. The system automatically detects version inconsistencies and updates the cache, avoiding manual intervention and improving the overall efficiency and stability of the application.
[0147] This embodiment can effectively manage the synchronization of local cache and network cache, ensuring timely update of home page data. At the same time, through efficient data loading and page rendering mechanism, users can quickly see the latest business content, achieving a smooth and real-time usage experience.
[0148] In some embodiments, after updating the home page data in the local disk cache to the latest home page data in the network cache, the method further includes:
[0149] The updated home page data is stored in the local disk cache, so that when the application is subsequently cold started, the updated home page data is read from the local disk cache and the home page of the application is rendered using the updated home page data.
[0150] Specifically, after the system updates the home page data in the local disk cache to the latest home page data obtained from the network cache, it will also store the updated home page data back in the local disk cache so that during the subsequent cold start process of the application, the updated data can be directly read from the local disk cache for rendering, thereby improving the cold start speed and user experience.
[0151] This embodiment describes how to save the latest home page data to the local disk cache after the system updates the home page data in the local disk cache to ensure that the data can be quickly accessed and used for page rendering during subsequent cold starts. The specific implementation steps are as follows:
[0152] First, when the system detects that the home page data in the local disk cache is inconsistent with the latest home page data version in the network cache, the system will obtain the latest home page business data from the network cache and use it to update the local disk cache.
[0153] The latest data obtained includes the resources required for rendering the home page (such as text, pictures, videos, etc.) and the corresponding version information.
[0154] The system replaces outdated data in the local disk cache with the latest data in the network cache, ensuring that the local cache data remains up to date.
[0155] Furthermore, after updating the home page data in the local cache, the system will store the latest data back into the local disk cache so that it can be quickly loaded and used during the subsequent cold start process.
[0156] This step ensures that in future cold starts, the system does not need to obtain data from the network again, but can directly read the updated home page data from the local disk cache, greatly improving the application startup speed.
[0157] The cache stores all the resources needed to render the home page and the latest version number for subsequent version verification.
[0158] Furthermore, when the user starts the application again, the system will first check whether the homepage data in the local disk cache is valid. If the data in the cache is the latest version, the system will read the data directly from the cache without initiating a network request, thereby achieving fast page rendering.
[0159] In this case, the cold start process is greatly shortened because the data in the cache has been updated and the user can see the updated page content immediately without waiting for the network to load.
[0160] At the same time, this caching mechanism can also work effectively in an unstable network or no network environment, ensuring that the application can start quickly and display the latest data.
[0161] Furthermore, during a subsequent cold start, the system reads the updated home page data from the local disk cache, loads it into the memory cache, and renders the home page based on the data.
[0162] Since the updated data is already stored locally, page rendering can be completed at a faster speed, further improving the user's startup experience.
[0163] Through the coordination of memory cache and disk cache, the system can ensure that data can be loaded and page rendering can be performed in the optimal way for each cold start, avoiding unnecessary network request delays.
[0164] By storing the latest home page data in the local disk cache, the system can ensure that there is no need to re-acquire data from the network during subsequent cold starts, thereby significantly shortening the cold start time and improving the user experience. This solution is particularly suitable for application scenarios that require frequent updates to home page data, and optimizes the startup efficiency of the application through the cache update mechanism.
[0165] This embodiment optimizes the subsequent cold start process of the application by storing the updated home page data in the local disk cache, ensuring that the system can directly read data from the cache for rendering without having to rely on the network again. Specific technical effects include:
[0166] Improve cold start speed: By using the latest cached data for rendering, the application can quickly display the home page content during subsequent cold starts, avoiding the white screen problem caused by network delays.
[0167] Reduce network requests: Since the latest home page data is stored in the cache, the system does not need to frequently obtain data from the network during subsequent cold starts, which reduces dependence on the network environment and is particularly suitable for environments with poor network conditions.
[0168] Improve data consistency: After each data update, the latest homepage data is stored in the local disk cache to ensure that the content users see during cold start is the latest and synchronized with the network, avoiding the display of outdated data.
[0169] This embodiment improves the cold start efficiency while ensuring the real-time and consistency of data. It is suitable for application scenarios that require frequent updates of home page content, ensuring a smoother user experience.
[0170] The following are device embodiments of the present application, which can be used to execute the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
[0171] Figure 3 Schematic diagram of the structure of the homepage cold start device of the application provided in the embodiment of the present application. Figure 3 As shown, the homepage cold start device of the application includes:
[0172] The reading module 301 is configured to read resources for page rendering from the homepage business data pre-built into the application installation package when the application is cold-started for the first time, and perform initial rendering of the homepage based on the resources;
[0173] The detection module 302 is configured to detect whether there is home page data stored in the local disk cache during a subsequent cold start, and if so, read the home page data from the local disk cache and render the page based on the home page data;
[0174] The comparison module 303 is configured to obtain the latest home page data version from the network cache during the cold start process, and compare the latest home page data version with the home page data version in the local disk cache;
[0175] The update module 304 is configured to update the homepage data in the local disk cache to the latest homepage data in the network cache and re-render the page based on the updated homepage data when it is detected that the homepage data version in the local disk cache is inconsistent with the homepage data version in the network cache.
[0176] In some embodiments, Figure 3 The reading module 301 embeds the complete business data required for the current home page into the application installation package when packaging the application, wherein the complete business data includes resources for page rendering; when the application is cold-started for the first time, it detects whether there is valid home page data in the local disk cache. If there is no valid home page data, the pre-built-in home page business data is read from the application installation package; the memory cache is updated with the home page business data, and the home page is rendered based on the updated home page data in the memory cache to display the pre-loaded business content.
[0177] In some embodiments, Figure 3 The detection module 302 detects the home page data in the local disk cache to determine whether there is valid home page data in the local disk cache; when it is determined that there is valid home page data in the local disk cache, the valid home page data is read from the local disk cache; the memory cache is updated with the home page business data, and the home page is rendered based on the updated home page data in the memory cache to display the preloaded business content.
[0178] In some embodiments, Figure 3 After detecting whether there is home page data stored in the local disk cache, when it is determined that there is no valid home page data in the local disk cache, the detection module 302 reads the pre-built-in home page business data from the application installation package, uses the home page business data to render the home page of the application, and updates the home page business data to the memory cache.
[0179] In some embodiments, Figure 3 When the application is cold started, the comparison module 303 initiates a network request to obtain the cached home page business data and the corresponding version information; compares the home page data version obtained from the network cache with the home page data version stored in the local disk cache to determine whether the two versions are consistent; when it is detected that the home page data version in the local disk cache is consistent with the home page data version in the network cache, the update operation is terminated, and the home page data in the local disk cache is used for rendering.
[0180] In some embodiments, Figure 3 When the update module 304 detects that the home page data version in the local disk cache is inconsistent with the home page data version in the network cache, it updates the home page data in the local disk cache to the latest home page data in the network cache, and loads the latest home page data into the memory cache to update the home page data in the memory cache, and re-renders the home page of the application based on the updated home page data in the memory cache to obtain the latest business content.
[0181] In some embodiments, Figure 3 After updating the home page data in the local disk cache to the latest home page data in the network cache, the update module 304 stores the updated home page data in the local disk cache, so that when the application is subsequently cold started, the updated home page data can be read from the local disk cache and the updated home page data can be used to render the application's home page.
[0182] Figure 4 Schematic diagram of the structure of the electronic device 4 provided in the embodiment of the present application. Figure 4 As shown, the electronic device 4 of this embodiment includes: a processor 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the processor 401. When the processor 401 executes the computer program 403, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 401 executes the computer program 403, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0183] Exemplarily, the computer program 403 may be divided into one or more modules / units, which are stored in the memory 402 and executed by the processor 401 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 403 in the electronic device 4.
[0184] The electronic device 4 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 4 may include, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will appreciate that Figure 4 It is only an example of the electronic device 4 and does not constitute a limitation of the electronic device 4. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.
[0185] The processor 401 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0186] The memory 402 may be an internal storage unit of the electronic device 4, for example, a hard disk or memory of the electronic device 4. The memory 402 may also be an external storage device of the electronic device 4, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 4. Further, the memory 402 may also include both an internal storage unit and an external storage device of the electronic device 4. The memory 402 is used to store computer programs and other programs and data required by the electronic device. The memory 402 may also be used to temporarily store data that has been output or is to be output.
[0187] The technicians in the relevant field 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 for illustration. In practical applications, the above-mentioned function allocation can be 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. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0188] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0189] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments applied for herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0190] In the embodiments provided in the present application, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. Multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0191] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0192] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0193] If the integrated module / unit is implemented in the form of 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 present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, which may be in source code form, object code form, executable file or some intermediate form. Computer-readable media may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0194] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These 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 application, and should all be included in the protection scope of the present application.
Claims
1. A method for cold starting the home page of an application, characterized in that: include: When the application is cold started for the first time, resources for page rendering are read from the homepage business data pre-built into the application installation package, and initial rendering of the homepage is performed based on the resources; During a subsequent cold start, detecting whether there is home page data stored in the local disk cache, and if so, reading the home page data from the local disk cache, and rendering the page based on the home page data; During the cold start process, the latest home page data version is obtained from the network cache, and the latest home page data version is compared with the home page data version in the local disk cache; When it is detected that the home page data version in the local disk cache is inconsistent with the home page data version in the network cache, the home page data in the local disk cache is updated to the latest home page data in the network cache, and the page is re-rendered based on the updated home page data.
2. The method according to claim 1, characterized in that: The reading of resources for page rendering from the homepage business data pre-built into the application installation package, and performing initial rendering of the homepage based on the resources, includes: When packaging the application, the complete business data required for the current homepage is embedded into the application installation package, wherein the complete business data includes resources for page rendering; When the application is cold started for the first time, detect whether there is valid home page data in the local disk cache. If there is no valid home page data, read the pre-built-in home page service data from the application installation package; The memory cache is updated using the home page business data, and the home page is rendered based on the updated home page data in the memory cache to display the preloaded business content.
3. The method according to claim 1, characterized in that The detecting whether there is home page data stored in the local disk cache, and if so, reading the home page data from the local disk cache, and performing page rendering based on the home page data, includes: Detecting the home page data in the local disk cache to determine whether there is valid home page data in the local disk cache; When it is determined that there is valid home page data in the local disk cache, reading the valid home page data from the local disk cache; The memory cache is updated using the home page business data, and the home page is rendered based on the updated home page data in the memory cache to display the preloaded business content.
4. The method according to claim 3, characterized in that After detecting whether there is home page data stored in the local disk cache, the method further includes: When it is determined that there is no valid home page data in the local disk cache, the pre-built-in home page business data is read from the application installation package, the home page of the application is rendered using the home page business data, and the home page business data is updated to the memory cache.
5. The method according to claim 1, characterized in that The step of obtaining the latest home page data version from the network cache and comparing the latest home page data version with the home page data version in the local disk cache includes: When the application is cold started, a network request is initiated to obtain the cached home page business data and corresponding version information; Compare the home page data version obtained from the network cache with the home page data version stored in the local disk cache to determine whether the two versions are consistent; When it is detected that the home page data version in the local disk cache is consistent with the home page data version in the network cache, the update operation is terminated, and the home page data in the local disk cache is used for rendering.
6. The method according to claim 5, characterized in that When it is detected that the home page data version in the local disk cache is inconsistent with the home page data version in the network cache, the home page data in the local disk cache is updated to the latest home page data in the network cache, and the page is re-rendered based on the updated home page data, including: When it is detected that the home page data version in the local disk cache is inconsistent with the home page data version in the network cache, the home page data in the local disk cache is updated to the latest home page data in the network cache, and the latest home page data is loaded into the memory cache to update the home page data in the memory cache. The home page of the application is re-rendered based on the updated home page data in the memory cache to obtain the latest business content.
7. The method according to claim 6, characterized in that After updating the home page data in the local disk cache to the latest home page data in the network cache, the method further includes: The updated home page data is stored in the local disk cache, so that when the application is subsequently cold started, the updated home page data is read from the local disk cache, and the home page of the application is rendered using the updated home page data.
8. A cold start device for the home page of an application, characterized in that: include: The reading module is configured to read resources for page rendering from the homepage business data pre-built into the application installation package when the application is cold-started for the first time, and perform initial rendering of the homepage based on the resources; The detection module is configured to detect whether there is home page data stored in the local disk cache during a subsequent cold start, and if so, read the home page data from the local disk cache and perform page rendering based on the home page data; A comparison module is configured to obtain the latest home page data version from the network cache during a cold start process, and compare the latest home page data version with the home page data version in the local disk cache; The update module is configured to update the homepage data in the local disk cache to the latest homepage data in the network cache when it is detected that the homepage data version in the local disk cache is inconsistent with the homepage data version in the network cache, and re-render the page based on the updated homepage data.
9. An electronic 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 steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.