Data update methods and apparatus, storage media, electronic devices

By dividing the updated data into target data layers and performing comparisons at the same level within the Vue framework, the problem of low data update efficiency in extremely long lists is solved, thereby improving data loading speed.

CN115563133BActive Publication Date: 2026-05-26QINGDAO HAIER TECH +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
QINGDAO HAIER TECH
Filing Date
2021-06-30
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In Vue development scenarios involving extremely long lists, as the amount of data increases, the update efficiency gradually decreases, leading to a deterioration in user experience, a problem that existing technologies have failed to effectively solve.

Method used

By dividing the updated data into target data layers, comparing data differences only at the same layer, and storing the updated data in the target container child nodes, the full data comparison is avoided.

Benefits of technology

It improves data loading speed, ensures that update efficiency does not decrease as the amount of data increases, and enhances the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115563133B_ABST
    Figure CN115563133B_ABST
Patent Text Reader

Abstract

This invention provides a data update method, apparatus, storage medium, and electronic device. The method includes: upon obtaining updated data, determining a first target data layer where the updated data resides; updating K data entries with the updated data to obtain the updated K data entries; and storing the updated K data entries in a target container child node. This invention solves the data loading problem in related technologies, thereby improving data loading speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of communications, and more specifically, to a data update method and apparatus, a storage medium, and an electronic device. Background Technology

[0002] The Visual User Environment (VUE) framework, as one of the most popular front-end frameworks, is widely used in the front-end field. However, when developing business scenarios with extremely long lists using VUE, due to VUE's own update mechanism, the update efficiency gradually decreases as the list data increases. When the data reaches a certain scale, users will clearly perceive a slower response time. For example, when developing a page similar to a social media feed with 10,000 entries, if someone likes a particular entry, VUE will automatically check the differences before and after updating these 10,000 entries. This means it needs to compare 10,000 times before determining what needs to be updated. In hardware environments with poor computing performance, the user experience degradation will be even more pronounced.

[0003] In existing technologies, pagination is added to list pages, for example, loading only 10 items at a time, with the user scrolling up to load the next 10. This reduces the likelihood of unacceptable sluggish updates for users in scenarios with short visit durations and small data loads. However, pagination logic cannot be adapted to all business scenarios and cannot be applied in situations where pagination is not possible. Even with sufficient user browsing time, there is still a possibility of loading massive amounts of data, which would still pose the risk of sluggish updates.

[0004] No effective solutions have yet been proposed in the relevant technologies to address the aforementioned technical problems. Summary of the Invention

[0005] This invention provides a data update method, apparatus, storage medium, and electronic device to at least solve the data loading problem in related technologies.

[0006] According to an embodiment of the present invention, a data update method is provided, comprising: upon obtaining updated data, determining a first target data layer in which the updated data is located, wherein the first target data layer includes K data entries and a target container child node, and K is a natural number greater than or equal to 1; updating the K data entries with the updated data to obtain updated K data entries; and storing the updated K data entries in the target container child node.

[0007] According to another embodiment of the present invention, a data update apparatus is provided, comprising: a first determining module, configured to determine a first target data layer in which the updated data is located when updated data is obtained, wherein the first target data layer includes K data entries and a target container sub-node, and K is a natural number greater than or equal to 1; a first updating module, configured to update the updated data into the K data entries to obtain updated K data entries; and a first storage module, configured to store the updated K data entries into the target container sub-node.

[0008] In one exemplary embodiment, the apparatus further includes: a first processing module, configured to layer the K data items into a data layer to obtain the first target data layer; a first insertion module, configured to insert the first container node into the first target data layer; and a first addition module, configured to add N first container child nodes to the first container node, wherein the N first container child nodes include the target container child node, and N is a natural number greater than or equal to 1.

[0009] In an exemplary embodiment, the first update module includes: a first comparison unit, configured to compare the updated data with each of the K data entries to determine the data to be updated in the K data entries; and a first replacement unit, configured to replace the data to be updated with the updated data to obtain the updated K data entries.

[0010] In one exemplary embodiment, the apparatus further includes a second adding module, configured to add a second container sub-node after the target container sub-node, wherein the second container sub-node is configured to carry updated data in the target container sub-node.

[0011] In one exemplary embodiment, the above apparatus further includes: a first loading module, configured to load M data into a target application when M data are acquired, wherein M is a natural number greater than or equal to 1; a first layering module, configured to layer the M data into a second target data layer; and a third adding module, configured to add a second container node to the second target data layer.

[0012] According to yet another embodiment of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.

[0013] According to yet another embodiment of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0014] This invention addresses the issue of data loading speed by determining a first target data layer containing updated data (K data entries and target container child nodes, where K is a natural number greater than or equal to 1) upon receiving updated data. The updated data is then applied to the K data entries to obtain the updated K data entries. Finally, the updated K data entries are stored in the target container child nodes. This approach ensures that updates only compare data at the same level, avoiding update lag and accelerating data loading. Therefore, it solves the data loading problem in data-related technologies, thereby improving data loading speed. Attached Figure Description

[0015] Figure 1 This is a hardware structure block diagram of a mobile terminal for a data update method according to an embodiment of the present invention.

[0016] Figure 2 This is a flowchart of a data update method according to an embodiment of the present invention;

[0017] Figure 3 This is a schematic diagram illustrating the principle of an embodiment of the present invention;

[0018] Figure 4 This is a flowchart based on a specific embodiment of the present invention;

[0019] Figure 5 This is a structural block diagram of a data update device according to an embodiment of the present invention. Detailed Implementation

[0020] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings and examples.

[0021] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0022] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for a data update method according to an embodiment of the present invention. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0023] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the data update method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0024] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0025] This embodiment provides a data update method. Figure 2 This is a flowchart of a data update method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:

[0026] Step S202: If updated data is obtained, determine the first target data layer where the updated data is located. The first target data layer includes K data items and target container child nodes, where K is a natural number greater than or equal to 1.

[0027] Step S204: Update the K data entries with the updated data to obtain the updated K data entries;

[0028] Step S206: Store the updated K records into the target container child node.

[0029] The entity performing the above steps can be a terminal, but is not limited to this.

[0030] This embodiment includes, but is not limited to, scenarios involving the loading of massive amounts of data. For example, a Moments page may contain 10,000 posts. If someone likes one of the posts, they can pull down to update the Moments page and load the updated data.

[0031] In this embodiment, taking the Moments list as an example, a user's like will trigger a data update. The Moments list data before and after the update belong to the same layer. The differences between each piece of data are compared from beginning to end, and if there are any changes, an update will be performed.

[0032] In this embodiment, for example, the target data layer includes 10 data entries.

[0033] Through the above steps, upon obtaining updated data, the first target data layer containing the updated data is determined. This first target data layer includes K data entries and target container child nodes, where K is a natural number greater than or equal to 1. The updated data is then applied to the K data entries to obtain the updated K data entries. Finally, the updated K data entries are stored in the target container child nodes. This ensures that during data updates, only data at the same level is compared, avoiding update lag and accelerating data loading. Therefore, it solves the data loading problem in data-related technologies, achieving the effect of improving data loading speed.

[0034] In one exemplary embodiment, before determining the first target data layer where the updated data resides upon obtaining the updated data, the method further includes:

[0035] S1, divide the K data items into data layers to obtain the first target data layer;

[0036] S2, Insert the first container node into the first target data layer;

[0037] S3, add N first container child nodes to the first container node, where the N first container child nodes include the target container child node, and N is a natural number greater than or equal to 1.

[0038] In this embodiment, taking Moments as an example, the data in Moments is re-layered, with 10 data entries per layer. At the same time, a container child node is maintained in this layer. Subsequent data is inserted into the container child node according to the same rule (10 data entries per layer, and a child node is maintained in this layer). This process is repeated until all data is processed.

[0039] In one exemplary embodiment, updating the K data entries with the updated data to obtain the updated K data entries includes:

[0040] S1, compare the updated data with each of the K data entries to determine the data to be updated among the K data entries;

[0041] S2, replace the data to be updated with the updated data, and get the updated K data.

[0042] In this embodiment, for example, when a user likes a post on WeChat Moments, it is only necessary to compare the differences of 10 data points at the same level as the post to obtain the updated content. The time complexity is O(10), which greatly improves the update efficiency and ensures that the update efficiency will not decrease as the amount of data increases.

[0043] In one exemplary embodiment, after storing the updated K data into the target container child node, the method further includes:

[0044] S1, add a second container child node after the target container child node, wherein the second container child node is used to carry the updated data in the target container child node.

[0045] In this embodiment, by adding a first container child node, when data is updated, it is only necessary to compare the differences in data at the same level as the updated data. This improves the efficiency of the update process.

[0046] In one exemplary embodiment, the method further includes:

[0047] S1, if M data items are obtained, load M data items into the target application, where M is a natural number greater than or equal to 1;

[0048] S2, divide the M data items into the second target data layer;

[0049] S3, add a second container node in the second target data layer.

[0050] In this embodiment, for example, when new data is loaded, the new data can be divided into a new hierarchical structure, and container nodes can be added at the end of the same layer.

[0051] The present invention will be described in detail below with reference to specific embodiments:

[0052] This embodiment is applicable, but is not limited to, business scenarios where pagination logic cannot be adapted. This embodiment uses a Document Object Model (DOM) structure to ensure that update efficiency is not affected in scenarios with extremely long lists.

[0053] like Figure 3As shown, this embodiment divides the data into a new hierarchical structure, including a root node, multiple first-level child nodes, and renders the DOM with the same hierarchical structure, adding child container nodes at the end of each level. When the data exceeds 10 items, subsequent data is inserted into the child container nodes according to the same rules. This process is repeated recursively until all data is loaded. For example, when node data is updated, multiple second-level child nodes are added after the child container, and a child container node is added at the end of the same level. This triggers Vue to compare the data before and after the update at the same level, rather than all data.

[0054] like Figure 4 As shown, this embodiment specifically includes the following steps:

[0055] S401: Data initialization, load 10 data entries.

[0056] S402: Generate a layer of DOM nodes from 10 data entries, insert the root node (equivalent to the first target data layer mentioned above), and add child container nodes at the end.

[0057] S403: Determine if there is any remaining unloaded data based on the acquired data. If so, enable the pull-to-load function; otherwise, disable the pull-to-load function and complete the rendering.

[0058] S404: When a user action triggers an update to a certain data item, Vue compares the 10 data items at the same level as that data item and updates the DOM structure at that level.

[0059] S405: Pull up to load and retrieve 10 new data entries. Repeat steps S402 and S403.

[0060] This embodiment is also applicable to business scenarios where pagination is not possible. Furthermore, since the diff algorithms of the React and Vue frameworks are essentially the same—both compare within the same layer—this embodiment is also applicable to front-end applications written using the React framework.

[0061] In summary, in scenarios with massive amounts of data, Vue can ensure that the time complexity of comparing data before and after is always O(10), thus avoiding slow updates.

[0062] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0063] This embodiment also provides a data update device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0064] Figure 5 This is a structural block diagram of a data update apparatus according to an embodiment of the present invention, such as... Figure 5 As shown, the device includes:

[0065] The first determining module 52 is used to determine the first target data layer where the updated data is located when the updated data is obtained. The first target data layer includes K data items and target container child nodes, where K is a natural number greater than or equal to 1.

[0066] The first update module 54 is used to update the K data entries with the updated data to obtain the updated K data entries;

[0067] The first storage module 56 is used to store the updated K data into the target container child node.

[0068] In one exemplary embodiment, the above-described apparatus further includes:

[0069] The first processing module is used to divide the above K data into data layers to obtain the above first target data layer;

[0070] The first insertion module is used to insert the first container node into the first target data layer.

[0071] The first addition module is used to add N first container child nodes to the first container node, wherein the N first container child nodes include the target container child node, and N is a natural number greater than or equal to 1.

[0072] In one exemplary embodiment, the first update module described above includes:

[0073] The first comparison unit is used to compare the updated data with each of the K data entries to determine the data to be updated among the K data entries.

[0074] The first replacement unit is used to replace the data to be updated with the updated data to obtain the updated K data entries.

[0075] In one exemplary embodiment, the above-described apparatus further includes:

[0076] The second addition module is used to add a second container sub-node after the target container sub-node, wherein the second container sub-node is used to carry the updated data in the target container sub-node.

[0077] In one exemplary embodiment, the above-described apparatus further includes:

[0078] The first loading module is used to load M data into the target application when M data are obtained, where M is a natural number greater than or equal to 1.

[0079] The first layering module is used to layer M data items into the second target data layer;

[0080] The third addition module is used to add a second container node in the second target data layer.

[0081] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0082] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.

[0083] In this embodiment, the computer-readable storage medium described above may be configured to store a computer program for performing the above steps.

[0084] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0085] Embodiments of the present invention also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.

[0086] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0087] In one exemplary embodiment, the processor described above may be configured to perform the above steps via a computer program.

[0088] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0089] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0090] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A data update method, characterized in that, include: Upon obtaining updated data, the first target data layer where the updated data is located is determined. The first target data layer includes K data items and target container child nodes, where K is a natural number greater than or equal to 1, and the updated data is the updated data of the K data items. The updated data is then applied to the K data entries to obtain the updated K data entries; The updated K records are stored in the target container child node; The method further includes: when M data items are obtained, loading the M data items into the target application, wherein M is a natural number greater than or equal to 1, and the M data items are newly added data items unrelated to the K data items; layering the M data items into a second target data layer, wherein the first target data layer and the second target data layer are different; and adding a second container node in the second target data layer.

2. The method according to claim 1, characterized in that, The method further includes: The K data items are layered into a data layer to obtain the first target data layer; Insert a first container node into the first target data layer; Add N first container child nodes to the first container node, wherein the N first container child nodes include the target container child node, and N is a natural number greater than or equal to 1.

3. The method according to claim 1, characterized in that, The updated data is applied to the K data entries to obtain the updated K data entries, including: The updated data is compared with each of the K data entries to determine the data to be updated among the K data entries; The data to be updated is replaced with the updated data to obtain the updated K data entries.

4. The method according to claim 1, characterized in that, The method further includes: A second container child node is added after the target container child node, wherein the second container child node is used to carry the updated data in the target container child node.

5. A data update device, characterized in that, include: The first determining module is used to determine the first target data layer where the updated data is located when the updated data is obtained. The first target data layer includes K data items and target container child nodes, where K is a natural number greater than or equal to 1, and the updated data is the updated data of the K data items. The first update module is used to update the K data entries with the update data to obtain the updated K data entries; The first storage module is used to store the updated K data into the target container child node; The first loading module is used to load the M data items into the target application when M data items are obtained, where M is a natural number greater than or equal to 1, and the M data items are newly added data items unrelated to the K data items; the first layering module is used to layer the M data items into the second target data layer, where the first target data layer and the second target data layer are different; the third adding module is used to add a second container node to the second target data layer.

6. The apparatus according to claim 5, characterized in that, The device further includes: The first processing module is used to divide the K data items into data layers to obtain the first target data layer; The first insertion module is used to insert a first container node into the first target data layer; The first addition module is used to add N first container child nodes to the first container node, wherein the N first container child nodes include the target container child node, and N is a natural number greater than or equal to 1.

7. The apparatus according to claim 5, characterized in that, The first update module includes: The first comparison unit is used to compare the updated data with each of the K data entries to determine the data to be updated among the K data entries; The first replacement unit is used to replace the data to be updated with the updated data to obtain the updated K data entries.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the method described in any one of claims 1 to 4.

9. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method described in any one of claims 1 to 4.