Delayed loading detection method, device, electronic device, storage medium and product
By detecting the delayed load call and using the mapping relationship of the data structure to determine whether there is new data, the problem of delayed loading in the prior art obtaining data only when the first trigger is triggered, and data integrity and performance optimization are achieved.
Patent Information
- Application Number
- CN202110129270.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-29
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2041-01-29
AI Technical Summary
The existing delayed loading mode only obtains data when it is triggered for the first time, and new data updated subsequently cannot be re-delayed, resulting in data incompleteness and system performance degradation.
By detecting the call operation that triggers delayed loading, obtain the class name that needs to delayed loading, and obtain the corresponding parameter data based on the mapping relationship of the data structure, determine whether delayed loading needs to be re-triggered to obtain new data, ensuring the integrity and performance of the data optimization.
It realizes that only one delay load is performed without new data, avoids multiple invalid calls, ensures that delay load can be performed repeatedly when new data is available, ensures data integrity and reduces local cache pressure, and improves system performance.
Smart Images

Figure CN112765512B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a delayed loading detection method, device, electronic device, computer-readable storage medium, and computer program product. Background Art
[0002] In the related art, after obtaining data from the Java framework, the acquisition relationship of the data will be saved in a certain class (a fixed class, such as Class A, etc.). However, since some data cannot be obtained in advance and only needs to be obtained on specific pages or in specific situations, if all data is obtained in advance, there will be many useless calls, which will affect performance. Therefore, in this case, Class A provides a delayed loading (i.e. lazy loading) mode that supports partial data, that is, only when the delayed loading is actively triggered later will the data be actually acquired. In other words, the existing delayed loading mode will only acquire data when it is triggered for the first time, and subsequent calls will directly use the data that has been acquired before. This will result in the delayed loaded data taking effect only at the first call, and the new data updated subsequently cannot be obtained, that is, the subsequent new data cannot be re-delayed loaded, resulting in incomplete data.
[0003] Therefore, how to trigger lazy loading to obtain updated new data is a technical problem that needs to be solved. Summary of the invention
[0004] The present disclosure provides a delayed loading detection method, device, electronic device and storage medium to at least solve the technical problem in the related art that delayed loading can only acquire data when it is triggered for the first time, and the subsequent updated data cannot be repeatedly delayed loaded, resulting in poor data integrity and reduced system performance. The technical solution of the present disclosure is as follows:
[0005] According to a first aspect of an embodiment of the present disclosure, a method for delayed loading is provided, including:
[0006] When a call operation that triggers lazy loading is detected, the class name of the data that needs to be lazy loaded is obtained;
[0007] Obtaining corresponding first parameter data from a mapping relationship stored in a data structure according to the class name; the data structure stores a mapping relationship between class names of various types of data and corresponding parameter values;
[0008] If it is determined based on the first parameter data that the data that needs to be delayed loaded has been delayed loaded, and new data is added after the delayed loading, the delayed loading call operation is re-triggered, and the corresponding second parameter data is obtained from the mapping relationship stored in the data structure according to the class name. The second parameter data is the new data added after the delayed loading.
[0009] Optionally, the method further includes:
[0010] If the data that needs to be delayed loaded has not been delayed loaded, or has been delayed loaded and no new data has been added after the delayed loading, then stop re-triggering the delayed loading.
[0011] Optionally, before obtaining the class name of the data to be lazily loaded, the method further includes:
[0012] A mapping relationship between the class name of each type of data in the data structure and the corresponding parameter value is pre-established, wherein the parameter value includes first parameter data located in the first field and second parameter data located in the second field, wherein the first parameter data includes: whether the data corresponding to the class name has been delayed loaded, and whether there is new data added after the delayed loading, and the second parameter data includes: the new data added after the delayed loading.
[0013] Optionally, the method further includes:
[0014] After detecting that delayed loading is performed according to the class name, recording the delayed loading state of the data corresponding to the class name as a loaded state in the first field of the data structure; and
[0015] When new data is added after delayed loading is detected, the added new data is added to the second field in the data structure.
[0016] Optionally, the first field and the second field in the data structure are respectively independent storage structures.
[0017] According to a second aspect of an embodiment of the present disclosure, a delayed loading detection device is provided, including:
[0018] A first acquisition module is configured to acquire the class name of the data that needs to be delayed loaded when a call operation that triggers delayed loading is detected;
[0019] A second acquisition module is configured to acquire corresponding first parameter data from a mapping relationship stored in a data structure according to the class name, wherein the data structure stores a mapping relationship between class names of various types of data and corresponding parameter values;
[0020] The delayed loading module is configured to execute delayed loading after the data that needs to be delayed loading is determined according to the first parameter data, and when new data is added after the delayed loading, re-trigger the delayed loading call operation, and obtain the corresponding second parameter data from the data structure according to the class name, where the second parameter data is the new data added after the delayed loading.
[0021] Optionally, the device further comprises:
[0022] A judgment module is configured to judge whether the data to be delayed loaded has been delayed loaded according to the first parameter data, and whether new data is added after delayed loading;
[0023] The delayed loading module is further configured to execute the step of re-triggering the delayed loading call operation and obtaining the corresponding second parameter data from the data structure according to the class name when the judgment module determines that the data that needs to be delayed loaded has been delayed loaded and new data is added after delayed loading;
[0024] The stop loading module is configured to stop re-triggering delayed loading when the judgment module determines that the data that needs to be delayed loaded has not been delayed loaded, or has been delayed loaded and no new data has been added after delayed loading.
[0025] Optionally, the device further comprises:
[0026] The establishment module is configured to execute, before the first acquisition module acquires the class name of the data that needs to be delayed loaded, pre-establishing a mapping relationship between the class name of each type of data in the data structure and the corresponding parameter value, wherein the parameter value includes first parameter data located in the first field and second parameter data located in the second field; the first parameter data includes: whether the data corresponding to the class name has been delayed loaded, and whether there is new data added after the delayed loading; the second parameter data includes: new data added after the delayed loading.
[0027] Optionally, the device further comprises:
[0028] A first recording module is configured to, after detecting that delayed loading is performed according to the class name, record the delayed loading state of the data corresponding to the class name as a loaded state in the first field of the data structure; and
[0029] The second recording module is configured to add the added new data to the second field in the data structure when it is detected that new data is added after the delayed loading.
[0030] Optionally, the first field and the second field in the data structure established by the establishment module are respectively independent storage structures.
[0031] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0032] processor;
[0033] a memory for storing instructions executable by the processor;
[0034] The processor is configured to execute the instructions to implement the delayed loading detection method as described in any one of the above items.
[0035] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the delayed loading detection method as described in any one of the above items.
[0036] According to a fifth aspect of an embodiment of the present disclosure, there is provided a computer program product, comprising a computer program or instructions, wherein when the computer program or instructions are executed by a processor, the delayed loading detection method as described in any one of the above items is implemented.
[0037] The technical solution provided by the embodiments of the present disclosure may at least include the following beneficial effects:
[0038] In the embodiment of the present disclosure, when a call operation that triggers delayed loading is detected, the class name of the data that needs to be delayed loaded is obtained; then, the corresponding first parameter data is obtained from the mapping relationship stored in the data structure according to the class name; the data structure stores the mapping relationship between the class name of each type of data and the corresponding parameter value, and when it is determined according to the first parameter data that the data that needs to be delayed loaded has been delayed loaded, and new data is added after delayed loading, the call operation of delayed loading is re-triggered, and the corresponding second parameter data is obtained from the data structure according to the class name, and the second parameter data is the new data added after delayed loading. That is to say, in the embodiment of the present disclosure, when a call operation that triggers delayed loading is detected, the class name of the data that needs to be delayed loaded is obtained, and then the class name of the data is used to determine that the data that needs to be delayed loaded has been delayed loaded and new data is added, the call operation of delayed loading is re-triggered to obtain the new data, so that it can be ensured that the delayed loading is only executed once when there is no new data, and it will not be called multiple times; when there is new data, the delayed loading can be repeatedly executed to avoid the situation where some data cannot be obtained, thereby ensuring the integrity of the data, while also reducing the pressure of the local cache and improving the system performance.
[0039] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0041] Figure 1 The figure is a flow chart of a delayed loading detection method according to an exemplary embodiment.
[0042] Figure 2 is another flow chart of a delayed loading detection method according to an exemplary embodiment.
[0043] Figure 3 The figure is a block diagram of a delayed loading detection device according to an exemplary embodiment.
[0044] Figure 4 is another block diagram of a delayed loading detection device according to an exemplary embodiment.
[0045] Figure 5 It is another block diagram of a delayed loading detection device according to an exemplary embodiment.
[0046] Figure 6 The present invention is a structural block diagram of an electronic device according to an exemplary embodiment.
[0047] Figure 7 It is a structural block diagram of a detection device with delayed loading according to an exemplary embodiment. DETAILED DESCRIPTION
[0048] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0049] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0050] Before understanding the present disclosure, please understand the following technical terms:
[0051] Lazy loading (Load On Demand), also known as delayed loading, is a technology that delays the loading of some non-critical resources when the page is loaded. In other words, it is loading on demand. Lazy loading can reduce the time of page loading, the size of the page, and reduce the occupation of system resources. For example, lazy loading of images, delaying the loading of images or loading certain images only when certain conditions are met. The main purpose of lazy loading is to optimize the front end of the server, reduce the number of requests or delay the number of requests. There are many ways to implement it, such as simple delayed loading, which can use setTimeOut or setInterval to delay loading; for example, conditional loading, that is, asynchronous downloading starts only when certain conditions are met or certain events are triggered, but it is not limited to this.
[0052] Figure 1 is a flow chart of a delayed loading detection method according to an exemplary embodiment. Figure 1 As shown, the method comprises the following steps:
[0053] In step 101, when a call operation that triggers delayed loading is detected, the class name of the data to be loaded is obtained;
[0054] In step 102, the corresponding first parameter data is obtained from a mapping relationship stored in a data structure according to the class name; the data structure stores a mapping relationship between the class name of each type of data and the corresponding parameter value.
[0055] The delayed loading detection method disclosed in the present invention can be applied to terminals, servers, etc., without limitation herein, and its terminal implementation device can be a smart phone, a laptop computer, a tablet computer, and other electronic devices, without limitation herein.
[0056] Combine the following Figure 1 , the specific implementation steps of a delayed loading detection method provided by an embodiment of the present disclosure are described in detail.
[0057] First, execute step 101, and when a call operation that triggers delayed loading is detected, obtain the class name of the data that needs to be delayed loaded;
[0058] When the back-end server detects the call operation that triggers delayed loading, it obtains the class name of the data that needs to be delayed loaded, and the class name of the data is the keyword key of the data that needs to be delayed loaded. It should be noted that in the Java framework, before obtaining a certain type of data, the data acquisition relationship will be saved in a class of a certain data structure (such as class A or class B, etc.), and this class will be used to uniformly perform the data acquisition work. When the data is subsequently displayed to be delayed loaded, the class name of the data can be used to directly obtain the parameter information corresponding to the class from the data structure, and according to the parameter information, it is determined that the data that needs to be delayed loaded has been delayed loaded, and new data has been added after the delayed loading. If delayed loading has been performed and new data has been added after delayed loading, the call operation of delayed loading is re-triggered to obtain the new data added after delayed loading, without the need to obtain the new data again by calling the service.
[0059] Next, step 102 is executed to obtain corresponding first parameter data from a mapping relationship stored in a data structure according to the class name; the data structure stores a mapping relationship between class names of various types of data and corresponding parameter values.
[0060] When it is determined according to the first parameter data that the data to be delayed loaded has been delayed loaded, and new data is added after the delayed loading, the delayed loading call operation is re-triggered to obtain the added new data,
[0061] In this step, the back-end server first obtains the corresponding first parameter data from the data structure according to the class name, and then determines whether delayed loading has been performed according to the content of the first parameter data, and whether new data is added after delayed loading. If it is determined that the data that needs to be delayed loaded has been delayed loaded, and new data is added after delayed loading, the delayed loading call operation is re-triggered, and the corresponding second parameter data is obtained from the data structure according to the class name, and the second parameter data is the new data added after delayed loading.
[0062] Among them, the data structure can be a MAP data structure, etc., and the storage method of the data structure is a KV structure, wherein K is the Key, which is the class name for the data to be obtained, that is, the keyword of the data; V is the parameter value Value corresponding to the Key, and the parameter value V contains two parameter data, one is: whether the data has been delayed loaded, and the other is: whether new data has entered after the delayed loading; it should be noted that these two parameter data are represented by a field, for example, represented by field 1, etc.
[0063] That is to say, in this step, the corresponding parameter value V can be obtained from the data structure according to the class name K, and then, according to the content description of V, it can be determined whether the data that needs to be delayed loaded has been delayed loaded, and whether new data has been added after delayed loading. If the data that needs to be delayed loaded has been delayed loaded, and new data has been added after delayed loading, the delayed loading is re-triggered to obtain the new data added after delayed loading, thereby ensuring the integrity of the data.
[0064] In the embodiment of the present disclosure, when a call operation that triggers delayed loading is detected, the class name of the data that needs to be delayed loaded is obtained; then, the corresponding first parameter data is obtained from the mapping relationship stored in the data structure according to the class name, and if it is determined according to the first parameter data that the data that needs to be delayed loaded has been delayed loaded, and new data is added after delayed loading, the call operation of delayed loading is re-triggered, and the corresponding second parameter data is obtained from the data structure according to the class name, and the second parameter data is the new data added after delayed loading. That is to say, when an operation that triggers delayed loading of calling data is detected, if the corresponding first parameter data is obtained from the mapping relationship stored in the data structure according to the class name of the data, and it is determined according to the content description of the first parameter data that the data that needs to be delayed loaded has been delayed loaded and new data is added after delayed loading, then the delayed loading is re-triggered to obtain the newly added second parameter data from the mapping relationship stored in the data structure, so that it can be ensured that the delayed loading is only executed once when there is no new data, and it will not be called multiple times; if there is new data, the delayed loading can be repeatedly executed to avoid the situation where part of the data cannot be obtained, thereby ensuring the integrity of the acquired data, while also reducing the local cache pressure and improving system performance.
[0065] See also Figure 2 , Figure 2 is another flow chart of a delayed loading detection method according to an exemplary embodiment, the method comprising:
[0066] Step 201: when a call operation that triggers delayed loading is detected, the class name of the data that needs to be delayed loaded is obtained.
[0067] Step 202: Obtain corresponding first parameter data from a mapping relationship stored in a data structure according to the class name; the data structure stores a mapping relationship between class names of various types of data and corresponding parameter values.
[0068] Among them, steps 201 to 202 are the same as steps 101 to 102. The specific implementation process is detailed in the above steps and will not be repeated here.
[0069] Step 203: judging whether the data to be delayed loaded has been delayed loaded, and whether new data has been added after delayed loading, according to the content of the first parameter data; if delayed loading has been performed, and new data has been added after delayed loading, then step 204 is performed; if delayed loading has not been performed, or delayed loading has been performed and no new data has been added after delayed loading, then step 205 is performed;
[0070] Among them, in this step, the back-end server first obtains the corresponding first parameter data from the mapping relationship stored in the data structure according to the class name; wherein, the data structure, such as the MAP data structure, has a storage structure of a KV structure, wherein K is the Key, which is the class name of the data to be obtained, that is, the keyword of the data; V is the parameter value Value corresponding to the Key, and the parameter value V contains two parameter data, the first parameter data is: whether the data has been delayed loaded, and the second parameter data is: whether delayed loading has been performed, and whether new data has entered after delayed loading; it should be noted that the two parameter data of the data that needs to be delayed loaded are represented by one field (of course, they can also be represented by two fields). Afterwards, determine whether the data that needs to be delayed loaded has been delayed loaded, and whether new data has been added after delayed loading, based on the content description of the parameter value. If delayed loading has been performed, and new data has been added after delayed loading, execute step 204; if delayed loading has not been performed, or delayed loading has been performed, and no new data has been added after delayed loading, execute step 205.
[0071] Step 204: re-triggering the calling operation of delayed loading, obtaining the corresponding second parameter data from the mapping relationship stored in the data structure according to the class name, where the second parameter data is new data added after delayed loading;
[0072] Among them, in this step, when the backend server determines that the data segment class name has been delayed loaded and new data is added after delayed loading, it will trigger delayed loading again to obtain new data, thereby ensuring data integrity.
[0073] Step 205: Stop the calling operation that triggers the delayed loading;
[0074] Step 206: Check whether there is a call operation that triggers delayed loading. If so, return to step 201; otherwise, execute step 207 to end this operation.
[0075] Among them, in this step, the back-end server determines according to the class name of the data that the data that needs to be delayed loaded has not been delayed loaded, or has been delayed loaded and no new data has been added after the delayed loading, then the delayed loading is stopped and continue to detect whether there is a calling operation that triggers the delayed loading. If so, return to the above step 201, otherwise, end this operation.
[0076] In the present disclosure, when a call operation that triggers delayed loading is detected, the class name of the data is first used to obtain from the mapping relationship of the data structure whether the data that needs to be delayed loaded has been delayed loaded and whether new data has been added after delayed loading. If it is determined that delayed loading has been performed and new data has been added after delayed loading, the call operation of delayed loading is re-triggered to obtain the newly added data; if it is determined that the class name of the data has not been delayed loaded, or delayed loading has been performed, and no new data has been added after delayed loading, then the current delayed loading is stopped, and the detection of whether there is a triggering delayed loading call operation continues. In other words, the present disclosure can ensure that delayed loading is only executed once when there is no new data, and will not be called multiple times; if there is new data, delayed loading can be repeatedly executed to avoid the situation where some new data after delayed loading cannot be obtained, thereby ensuring the integrity of the data. At the same time, whether to perform delayed loading can be controlled based on whether new data has been added after delayed loading, which reduces the pressure on the local cache and improves system performance.
[0077] Optionally, in another embodiment, based on the above embodiment, the method may further include:
[0078] A mapping relationship between the class name of each type of data in the data structure and the corresponding parameter value is pre-established, wherein the parameter value includes first parameter data located in the first field and second parameter data located in the second field, wherein the first parameter data includes: whether the data corresponding to the class name has been delayed loaded, and whether there is new data added after the delayed loading, and the second parameter data includes: the new data added after the delayed loading.
[0079] In this embodiment, in the data structure, it is necessary to create a mapping relationship between the class name of a certain type of data and the corresponding parameter value in advance, and then store the mapping relationship in the data result, such as a MAP data structure. For example, a MAP is maintained in the A-type data (data is stored in the form of a KV key-value pair), wherein the key Key (i.e., the keyword of the data) is the class name, V is the parameter value corresponding to K, K represents the class name of the data to be obtained, and V is the parameter value Value, V represents that it contains two data, and these two parameters are stored in a field in the data structure, such as the first field. Among them, the first parameter data indicates whether delayed loading has been performed; the second parameter data indicates if delayed loading has been performed, and whether new data has entered after delayed loading. So that when the call operation of delayed loading is triggered, the class name is first used to obtain the corresponding first parameter data from the mapping relationship stored in the data structure, and the content description of the first parameter data is used to determine whether the data to be delayed has been delayed loaded and whether new data has been added after delayed loading. If both are true, the call operation of delayed loading is re-triggered, otherwise, the call operation of delayed loading is stopped. Furthermore, for the newly added data, the new data can also be saved in an independent storage structure in the data structure, for example, stored in the second field, etc. In other words, the delayed loaded data and the new data after delayed loading can be stored in different fields of the data structure. By storing the field of new data, when the delayed loading operation is triggered again, only the field storing useful new data can be read. For example, call A's delayed loading operation, determine whether field 1 has been delayed loaded, and whether new data has been added after delayed loading. If new data has been added, and the added new data is stored in the second field, then when the delayed loading call operation is re-triggered, the new data in field 2 is directly read, and the complete data can be obtained by re-triggering the delayed loading.
[0080] Optionally, in another embodiment, based on the above embodiment, the method may further include:
[0081] After detecting that delayed loading is performed according to the class name, recording the delayed loading state of the data corresponding to the class name as a loaded state in the first field of the data structure; and
[0082] When new data is added after delayed loading is detected, the added new data is added to the second field in the data structure.
[0083] That is to say, in this embodiment, after delayed loading is detected according to the class name, the delayed loading state of the class name in the mapping relationship stored in the data structure is recorded as a loaded state; and when new data is added after the delayed loading is detected, the added new data is added to the second field in the data structure.
[0084] In this step, the status of the class name after lazy loading is updated and recorded to distinguish whether new data is added later.
[0085] Optionally, in another embodiment, based on the above embodiment, the first field and the second field in the data structure are independent storage structures.
[0086] It should be noted that, for the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that this implementation disclosure is not limited by the order of the actions described, because according to this disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by this disclosure.
[0087] Figure 3 is a block diagram of a delayed loading detection device according to an exemplary embodiment. Figure 3 , the device includes a first acquisition module 301, a second acquisition module 302 and a delayed loading module 303, wherein,.
[0088] The first acquisition module 301 is configured to acquire the class name of the data that needs to be delayed loaded when a call operation that triggers delayed loading is detected;
[0089] The second acquisition module 302 is configured to execute acquiring corresponding first parameter data from a data structure according to the class name, wherein the data structure stores a mapping relationship between class names of various types of data and corresponding parameter values;
[0090] The delayed loading module 303 is configured to execute delayed loading after the data that needs to be delayed loading is determined according to the first parameter data, and when new data is added after delayed loading, re-trigger the delayed loading call operation, and obtain the corresponding second parameter data from the data structure according to the class name, where the second parameter data is the new data added after delayed loading.
[0091] Optionally, in another embodiment, based on the above embodiment, the device further includes: a judgment module 401 and a stop loading module 402, and its structural diagram is shown as follows: Figure 4 As shown,
[0092] The judging module 401 is configured to judge whether the data to be delayed loaded has been delayed loaded, and whether new data has been added after delayed loading, according to the first parameter data obtained by the second obtaining module 302;
[0093] The delayed loading module 302 is also configured to execute the call operation of re-triggering delayed loading when the judgment module 401 determines that the data that needs to be delayed loaded has been delayed loaded, and new data is added after delayed loading, and obtain the corresponding second parameter data from the data structure according to the class name.
[0094] The stop loading module 402 is configured to stop re-triggering delayed loading if the judgment module 401 determines that the data to be delayed loaded has not been delayed loaded, or has been delayed loaded and no new data has been added after delayed loading.
[0095] Optionally, in another embodiment, based on the above embodiment, the device may further include: establishing module 501, whose structural diagram is shown in FIG. Figure 5 As shown,
[0096] The establishment module 501 is configured to execute, before the first acquisition module 301 acquires the class name of the data that needs to be delayed loaded, pre-establishing a mapping relationship between the class name of each type of data in the data structure and the corresponding parameter value, wherein the parameter value includes the first parameter data located in the first field and the second parameter data located in the second field; the first parameter data includes: whether the data corresponding to the class name has been delayed loaded, and whether there is new data added after the delayed loading; the second parameter data includes: the new data added after the delayed loading.
[0097] Optionally, in another embodiment, based on the above embodiment, the device may further include: a first recording module and a second recording module (not shown in the figure), wherein:
[0098] The first recording module is configured to execute, after detecting that delayed loading is performed according to the class name, recording the delayed loading state of the data corresponding to the class name as a loaded state in the first field of the data structure; and
[0099] The second recording module is configured to add the added new data to the second field in the data structure when it is detected that new data is added after delayed loading.
[0100] Optionally, in another embodiment, based on the above embodiment, the first field and the second field in the data structure established by the establishment module are independent storage structures.
[0101] Optionally, the present disclosure further provides an electronic device, including:
[0102] processor;
[0103] a memory for storing instructions executable by the processor;
[0104] The processor is configured to execute the instructions to implement the delayed loading detection method as described above.
[0105] Optionally, the present disclosure further provides a computer-readable storage medium, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the delayed loading detection method as described above.
[0106] Optionally, the present disclosure further provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the delayed loading detection method as described in any one of the above items.
[0107] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method. For relevant details, please refer to the partial description of the method embodiment, and will not be elaborated here.
[0108] In an exemplary embodiment, a storage medium including instructions is also provided, such as a memory including instructions, and the instructions can be executed by a processor of the device to complete the above method. Optionally, the storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0109] Figure 6 6 is a block diagram of an electronic device 600 according to an exemplary embodiment. For example, the electronic device 600 may be a mobile terminal or a server, and the electronic device is a mobile terminal as an example for explanation in the disclosed embodiment. For example, the electronic device 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0110] Reference Figure 6 , the electronic device 600 may include one or more of the following components: a processing component 602 , a memory 604 , a power component 606 , a multimedia component 608 , an audio component 610 , an input / output (I / O) interface 612 , a sensor component 614 , and a communication component 616 .
[0111] The processing component 602 generally controls the overall operation of the electronic device 600, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 602 may include one or more modules to facilitate the interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate the interaction between the multimedia component 608 and the processing component 602.
[0112] The memory 604 is configured to store various types of data to support operations on the device 600. Examples of such data include instructions for any application or method operating on the electronic device 600, contact data, phone book data, messages, pictures, videos, etc. The memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0113] The power supply component 606 provides power to the various components of the electronic device 600. The power supply component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 600.
[0114] The multimedia component 608 includes a screen that provides an output interface between the electronic device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front camera and / or a rear camera. When the device 600 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0115] The audio component 610 is configured to output and / or input audio signals. For example, the audio component 610 includes a microphone (MIC), and when the electronic device 600 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 604 or sent via the communication component 616. In some embodiments, the audio component 610 also includes a speaker for outputting audio signals.
[0116] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0117] The sensor assembly 614 includes one or more sensors for providing various aspects of status assessment for the electronic device 600. For example, the sensor assembly 614 can detect the open / closed state of the device 600, the relative positioning of components, such as the display and keypad of the electronic device 600, and the sensor assembly 614 can also detect the position change of the electronic device 600 or a component of the electronic device 600, the presence or absence of contact between the user and the electronic device 600, the orientation or acceleration / deceleration of the electronic device 600, and the temperature change of the electronic device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 614 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0118] The communication component 616 is configured to facilitate wired or wireless communication between the electronic device 600 and other devices. The electronic device 600 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 616 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0119] In an exemplary embodiment, the electronic device 600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the delay loading detection method shown above.
[0120] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, and the instructions can be executed by a processor 620 of an electronic device 600 to complete the delay loading detection method shown above. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0121] In an exemplary embodiment, a computer program product is further provided. When instructions in the computer program product are executed by the processor 620 of the electronic device 600, the electronic device 600 executes the delayed loading detection method shown above.
[0122] Figure 7 is a block diagram of a device 700 for detecting delayed loading according to an exemplary embodiment. For example, the device 700 may be provided as a server. Figure 7 The apparatus 700 includes a processing component 722, which further includes one or more processors, and a memory resource represented by a memory 732 for storing instructions executable by the processing component 722, such as an application. The application stored in the memory 732 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 722 is configured to execute instructions to perform the above-mentioned method for detecting delayed loading.
[0123] The device 700 may also include a power supply component 726 configured to perform power management of the device 700, a wired or wireless network interface 750 configured to connect the device 700 to a network, and an input / output (I / O) interface 758. The device 700 may operate based on an operating system stored in the memory 732, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or the like.
[0124] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.
[0125] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A delayed loading detection method, characterized in that: include: When a call operation that triggers lazy loading is detected, the class name of the data that needs to be lazy loaded is obtained; Obtaining corresponding first parameter data from a mapping relationship stored in a data structure according to the class name; The data structure stores the mapping relationship between the class name of each type of data and the corresponding parameter value; If it is determined according to the first parameter data that the data to be delayed loaded has been delayed loaded, and new data is added after the delayed loading, the delayed loading call operation is re-triggered, and the corresponding second parameter data is obtained from the mapping relationship stored in the data structure according to the class name, and the second parameter data is the new data added after the delayed loading; If the data that needs to be delayed loaded has not been delayed loaded, or has been delayed loaded and no new data has been added after the delayed loading, then stop re-triggering the delayed loading; Before obtaining the class name of the data that needs to be lazily loaded, the method further includes: A mapping relationship between the class name of each type of data in the data structure and the corresponding parameter value is pre-established, wherein the parameter value includes first parameter data located in the first field and second parameter data located in the second field, wherein the first parameter data includes: whether the data corresponding to the class name has been delayed loaded, and whether there is new data added after the delayed loading, and the second parameter data includes: the new data added after the delayed loading.
2. The delayed loading detection method according to claim 1, characterized in that: The method further comprises: After detecting that delayed loading is performed according to the class name, recording the delayed loading state of the data corresponding to the class name as a loaded state in the first field of the data structure; and When new data is added after delayed loading is detected, the added new data is added to the second field in the data structure.
3. The delayed loading detection method according to claim 2, characterized in that: The first field and the second field in the data structure are respectively independent storage structures.
4. A delayed loading detection device, characterized in that: include: A first acquisition module is configured to acquire the class name of the data that needs to be delayed loaded when a call operation that triggers delayed loading is detected; A second acquisition module is configured to acquire corresponding first parameter data from a mapping relationship stored in a data structure according to the class name, wherein the data structure stores a mapping relationship between class names of various types of data and corresponding parameter values; The delayed loading module is configured to execute, when the data to be delayed loaded is determined according to the first parameter data to be delayed loaded, and new data is added after the delayed loading, re-trigger the delayed loading call operation, and obtain the corresponding second parameter data from the data structure according to the class name, where the second parameter data is the new data added after the delayed loading; A judgment module is configured to judge whether the data to be delayed loaded has been delayed loaded according to the first parameter data, and whether new data is added after delayed loading; The delayed loading module is further configured to execute the step of re-triggering the delayed loading call operation and obtaining the corresponding second parameter data from the data structure according to the class name when the judgment module determines that the data that needs to be delayed loaded has been delayed loaded and new data is added after delayed loading; A stop loading module is configured to stop re-triggering delayed loading when the judgment module determines that the data to be delayed loaded has not been delayed loaded, or has been delayed loaded and no new data has been added after delayed loading; The establishment module is configured to execute, before the first acquisition module acquires the class name of the data that needs to be delayed loaded, pre-establishing a mapping relationship between the class name of each type of data in the data structure and the corresponding parameter value, wherein the parameter value includes first parameter data located in the first field and second parameter data located in the second field; the first parameter data includes: whether the data corresponding to the class name has been delayed loaded, and whether there is new data added after the delayed loading; the second parameter data includes: new data added after the delayed loading.
5. The delayed loading detection device according to claim 4, characterized in that: The device also includes: A first recording module is configured to, after detecting that delayed loading is performed according to the class name, record the delayed loading state of the data corresponding to the class name as a loaded state in the first field of the data structure; and The second recording module is configured to add the added new data to the second field in the data structure when it is detected that new data is added after the delayed loading.
6. The delayed loading detection device according to claim 4, characterized in that: The first field and the second field in the data structure established by the establishment module are respectively independent storage structures.
7. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the delayed loading detection method according to any one of claims 1 to 3.
8. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the delayed loading detection method according to any one of claims 1 to 3.
9. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the delayed loading detection method according to any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Operation parameter loading method and device
CN104978203A
Program publishing and loading method and device, computer system and readable storage medium
CN110275706A
