An interface synchronization method, apparatus, device, and storage medium
By dividing the interface into regions and parsing synchronous threads, the interface update information is obtained and updated, solving the problems of high resource consumption and severe latency in existing technologies. This achieves fast synchronization and efficient updating of the interface, improving system response speed and user experience.
Patent Information
- Application Number
- CN202411140305.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2044-08-20
AI Technical Summary
Existing data synchronization technologies suffer from high resource consumption, severe latency, and high development and maintenance costs when dealing with large-scale data, making it impossible to achieve fast and efficient interface synchronization.
The interface to be updated is divided into several regions to be updated. The interface update information is parsed by a synchronous thread to obtain the address and length of the update region, determine the target region to be updated, and update the target region. The interface update information is stored in a cache unit to improve the real-time performance and consistency of the interface update.
It enables rapid interface synchronization, reduces unnecessary updates, improves system response speed and efficiency, and enhances user experience and system reliability.
Smart Images

Figure CN118672712B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data synchronization technology, and in particular to an interface synchronization method, apparatus, device, and storage medium. Background Technology
[0002] In modern software, data synchronization is a crucial step. With the continuous increase in data volume and changes in business processes, ensuring the synchronization of communication with applications is paramount. Traditional data synchronization methods, regardless of their specific implementation, have numerous shortcomings, such as data inaccuracy and severe interface delays.
[0003] Existing data synchronization technologies can be divided into batch processing and real-time processing. Batch processing refers to collecting a certain amount of data and synchronizing it for display on the interface within a specific time. Real-time processing involves processing and analyzing the data immediately after it is received in the application and synchronizing it to the interface in a short time. However, both methods have drawbacks: when dealing with large-scale data, they not only consume a lot of memory and resources but also incur high development and maintenance costs, and there is a high latency during real-time updates.
[0004] In summary, the shortcomings of the existing technology urgently need to be addressed. Summary of the Invention
[0005] This invention provides an interface synchronization method, apparatus, device, and storage medium to overcome the deficiencies in the prior art, achieve rapid interface synchronization, and improve the system's response speed and efficiency.
[0006] This invention provides an interface synchronization method, comprising:
[0007] The interface to be updated is divided into several areas to be updated;
[0008] Obtain interface update information, which includes interface information, update area address, and update address length;
[0009] Based on the update region address and the update address length, determine the target region to be updated corresponding to the interface update information;
[0010] The target area to be updated is updated based on the interface information.
[0011] According to an interface synchronization method provided by the present invention, the step of dividing the interface to be updated into several regions to be updated specifically includes:
[0012] The interface to be updated is divided into several areas to be updated;
[0013] The region to be updated includes a region memory;
[0014] The region memory includes the region data address and region address length of the region to be updated.
[0015] According to an interface synchronization method provided by the present invention, the step of determining the target area to be updated corresponding to the interface update information based on the update area address and the update address length specifically includes:
[0016] The interface update information is parsed to obtain the update area address and the update address length;
[0017] The update region address and the update address length are matched with the region data address and the region address length to determine the target region to be updated corresponding to the interface update information.
[0018] According to an interface synchronization method provided by the present invention, the step of parsing the interface update information to obtain the update region address and the update address length specifically includes:
[0019] The interface update information is parsed by a synchronization thread to obtain the update region address and the update address length. The synchronization thread is used to parse the data received by TCP and to update the interface to be updated according to the interface update information.
[0020] According to an interface synchronization method provided by the present invention, the step of updating the target area to be updated based on the interface information specifically includes:
[0021] Attach the interface to be updated to the application tree;
[0022] The interface update information is displayed in the target area to be updated via the synchronization thread.
[0023] According to an interface synchronization method provided by the present invention, the area to be updated further includes several functional components, and the area memory includes component data addresses and component address lengths.
[0024] According to an interface synchronization method provided by the present invention, after the step of obtaining interface update information, the interface synchronization method further includes:
[0025] The interface update information is cached in a cache unit, which is used to store the interface update information.
[0026] The present invention also provides an interface synchronization method apparatus, comprising:
[0027] The area division module is used to divide the interface to be updated into several areas to be updated;
[0028] The information acquisition module is used to acquire interface update information, which includes interface information, update area address, and update address length.
[0029] The target determination module is used to determine the target area to be updated corresponding to the interface update information based on the update area address and the update address length.
[0030] The information update module is used to update the target area to be updated based on the interface information.
[0031] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the interface synchronization method described above.
[0032] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the interface synchronization method as described above.
[0033] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the interface synchronization method described above.
[0034] The interface synchronization method, apparatus, device, and storage medium provided by this invention divides the interface to be updated into several regions to be updated; acquires interface update information, including interface information, update region address, and update address length; determines the target region to be updated corresponding to the interface update information based on the update region address and the update address length; and updates the target region to be updated based on the interface information. This invention enables the interface to be divided into different regions according to different functions or data requirements. When an interface update is needed, the region to be updated can be determined based on the content to be updated, thereby reducing unnecessary interface updates and improving system response speed and efficiency. Attached Figure Description
[0035] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0036] Figure 1 This is a flowchart illustrating the interface synchronization method provided by the present invention;
[0037] Figure 2 This is a schematic diagram of the interface synchronization device provided by the present invention;
[0038] Figure 3 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0039] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0040] Data synchronization is a crucial task in modern software applications. With the continuous increase in data volume and the increasing complexity of business processes, ensuring synchronization between communication and applications becomes paramount. However, traditional data synchronization technologies often reveal many shortcomings when faced with large data volumes and complex business processes. For example, issues such as data inaccuracy and severe interface latency can negatively impact user experience and system performance.
[0041] Existing data synchronization technologies can be mainly divided into two categories: batch processing and real-time processing.
[0042] Batch processing refers to collecting a certain amount of data, synchronizing it within a specific time frame, and displaying it on a user interface. The advantage of this method is that it can process large amounts of data during off-peak hours, thus reducing the real-time pressure on the system. However, batch processing has the following drawbacks:
[0043] Resource consumption: When processing large amounts of data, synchronously updating the interface will consume a lot of memory and computing resources, which places high demands on system hardware.
[0044] Latency: Since batch processing is performed within a specific time frame, there is a delay between data updates and display, which cannot meet the requirements for real-time data synchronization.
[0045] Real-time processing involves processing and analyzing data received by the application immediately and synchronizing it to the user interface within a short time. The advantage of real-time processing is that it can reflect data changes promptly, providing a better user experience. However, this method also has the following drawbacks:
[0046] Resource consumption: Real-time processing requires continuous use of system resources, especially when processing large-scale data, where resource consumption is a particularly prominent issue.
[0047] Complexity: Real-time processing requires handling complex data synchronization logic, resulting in high development and maintenance costs.
[0048] Latency: Although the goal of real-time processing is to reduce latency, systems may still experience high latency when dealing with large-scale data.
[0049] To address the problems in existing technologies, this invention proposes an interface synchronization method to achieve rapid interface synchronization and improve system response speed and efficiency. The interface synchronization method is described below, as follows: Figure 1 As shown, including but not limited to the following steps:
[0050] Step 110: Divide the interface to be updated into several areas to be updated.
[0051] To achieve efficient interface updates, step 110 first divides the interface to be updated into several regions. Based on business requirements, the interface is divided into several regions. For example, the interface can be divided into a header region, a body region, and a footer region. For each region, a corresponding Region object is created, and its interface information, data address, and address length are set. A Cache object is created, and when TCP receives data, it is immediately written to the cache.
[0052] Step 120: Obtain interface update information, which includes interface information, update area address, and update address length.
[0053] In this step, the system will obtain interface update information, including interface information, update region address, and update address length. A class can be created to encapsulate this interface update information, containing the interface information, update region address, and update address length.
[0054] Step 130: Determine the target area to be updated corresponding to the interface update information based on the update area address and the update address length.
[0055] In step 130, based on the update area address and update address length, the list of already divided interface areas is traversed to determine the target area to be updated that meets the conditions.
[0056] Step 140: Update the target area to be updated based on the interface information.
[0057] In this step, the system uses the acquired interface information to update the identified target area to be updated. Specifically, based on the target area to be updated determined in the previous step, the corresponding interface information is extracted. This information includes the interface layout, displayed content, and styles. Based on the parsed interface information, the actual update operation is performed on the target area to be updated. This includes writing new data into the corresponding interface elements and ensuring the interface is correctly displayed on the user's device. Finally, the success of the update operation can be confirmed, ensuring the interface has been updated as expected. If errors or exceptions occur during the update process, appropriate error handling and logging are required.
[0058] As an optional embodiment, the step of dividing the interface to be updated into several areas to be updated specifically includes:
[0059] The interface to be updated is divided into several areas to be updated;
[0060] The region to be updated includes a region memory;
[0061] The region memory includes the region data address and region address length of the region to be updated.
[0062] Specifically, a RegionType enumeration can be created to represent the predefined region types. Different region types can represent different parts of the interface, facilitating subsequent update operations. Next, a Region class can be created to represent the attributes and behaviors of each region. This class contains interface information, data address, and address length, describing the specific content and update method of the region. Then, a Cache class can be created to cache data received from TCP. When TCP receives data, it is immediately written to the cache class. All data on the interface is read from the cache, ensuring data real-time performance and consistency.
[0063] As an optional embodiment, the step of determining the target area to be updated corresponding to the interface update information based on the update area address and the update address length specifically includes:
[0064] The interface update information is parsed to obtain the update area address and the update address length;
[0065] The update region address and the update address length are matched with the region data address and the region address length to determine the target region to be updated corresponding to the interface update information.
[0066] In this optional embodiment, the update region address and update address length are obtained by parsing the interface update information, and this information is matched with the addresses and lengths of the already divided regions to determine the target region to be updated. Parsing the interface update information to extract the update region address and update address length ensures the accuracy of the obtained address and length information, facilitating subsequent matching operations. By traversing the list of already divided interface regions, the parsed update region address and update address length are matched with the address and length of each region to determine the target region to be updated that meets the conditions.
[0067] As an optional embodiment, the step of parsing the interface update information to obtain the update region address and the update address length specifically includes:
[0068] The interface update information is parsed by a synchronization thread to obtain the update region address and the update address length. The synchronization thread is used to parse the data received by TCP and to update the interface to be updated according to the interface update information.
[0069] In this optional embodiment, a synchronization thread is created to perform the synchronization interface task. When TCP receives data, it caches the data, and the synchronization thread parses the data. The core of the parsing is to obtain the address and length of the current data, and then find the current region and interface information based on the address and length of the region container, and update the interface accordingly.
[0070] Specifically, first, a synchronization thread class is created to parse the data received via TCP and update the interface. Next, a cache class is created to store the received TCP data and provides methods for the synchronization thread to retrieve this data. When TCP receives data, it parses the data and writes it to the cache. In the main program, a synchronization thread is created and started to receive TCP data and process updates.
[0071] This alternative implementation provides an efficient real-time data synchronization method by creating a synchronization thread to parse the data received via TCP and update the interface. The synchronization thread periodically checks the cached data, parses the address and length of the update region, and locates the target region to be updated based on the region container address and length, ultimately updating the interface. This method ensures the real-time nature and consistency of the interface data, improving system reliability and user experience.
[0072] As an optional embodiment, the step of updating the target area to be updated based on the interface information specifically includes:
[0073] Attach the interface to be updated to the application tree;
[0074] The interface update information is displayed in the target area to be updated via the synchronization thread.
[0075] In this optional embodiment, the interface update operation is achieved by attaching the interface to be updated to the application tree and displaying the interface update information in the target area to be updated via a synchronization thread. Specifically, the interface to be updated is attached to the application's UI tree to ensure that new interface elements can be displayed and interacted with correctly. The synchronization thread periodically checks the cached interface update information and updates the display in the target area to be updated.
[0076] With this optional embodiment, the system can parse the data received via TCP using a synchronous thread, attach the interface to be updated to the application tree, and perform display updates in the target area to be updated. This ensures the real-time nature and consistency of interface updates, improving user experience and system reliability.
[0077] As an optional embodiment, the area to be updated further includes several functional components, and the area memory includes component data addresses and component address lengths.
[0078] The interface allows registering multiple combinations of addresses and lengths within a region container, establishing a one-to-many relationship between classes and students. Furthermore, the interface supports registering multiple functional modules into the region module multiple times. This design is beneficial for adapting to different scenarios and data requirements, while also significantly improving code reusability and extensibility. Supporting the registration of multiple functional modules also facilitates modular design.
[0079] As an optional embodiment, after the step of obtaining interface update information, the interface synchronization method further includes:
[0080] The interface update information is cached in a cache unit, which is used to store the interface update information.
[0081] Specifically, a cache unit is defined. This cache unit class stores UI update information and provides methods for the synchronization thread to access it. When TCP receives UI update information, it stores it in the cache unit. The synchronization thread periodically checks the cache unit, reads the UI update information from it, and performs parsing and UI update operations. In the main program, the synchronization thread is created and started to receive TCP data and process updates.
[0082] The interface synchronization device provided by the present invention will be described below, such as... Figure 2 As shown, the interface synchronization device described below and the interface synchronization method described above can be referred to in correspondence.
[0083] An interface synchronization device, comprising:
[0084] The region division module 210 is used to divide the interface to be updated into several regions to be updated.
[0085] Information acquisition module 220 is used to acquire interface update information, which includes interface information, update area address and update address length;
[0086] The target determination module 230 is used to determine the target area to be updated corresponding to the interface update information based on the update area address and the update address length.
[0087] The information update module 240 is used to update the target area to be updated based on the interface information.
[0088] Figure 3 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 3 As shown, the electronic device may include: a processor 310, a communications interface 320, a memory 330, and a communication bus 340, wherein the processor 310, the communications interface 320, and the memory 330 communicate with each other via the communication bus 340. The processor 310 can call logical instructions in the memory 330 to execute an interface synchronization method, which includes:
[0089] The interface to be updated is divided into several areas to be updated;
[0090] Obtain interface update information, which includes interface information, update area address, and update address length;
[0091] Based on the update region address and the update address length, determine the target region to be updated corresponding to the interface update information;
[0092] The target area to be updated is updated based on the interface information.
[0093] Furthermore, the logical instructions in the aforementioned memory 330 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0094] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program, the computer program being able to be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer being able to execute the interface synchronization method provided by the above methods, the method comprising:
[0095] The interface to be updated is divided into several areas to be updated;
[0096] Obtain interface update information, which includes interface information, update area address, and update address length;
[0097] Based on the update region address and the update address length, determine the target region to be updated corresponding to the interface update information;
[0098] The target area to be updated is updated based on the interface information.
[0099] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the interface synchronization methods provided by the methods described above, the method comprising:
[0100] The interface to be updated is divided into several areas to be updated;
[0101] Obtain interface update information, which includes interface information, update area address, and update address length;
[0102] Based on the update region address and the update address length, determine the target region to be updated corresponding to the interface update information;
[0103] The target area to be updated is updated based on the interface information.
[0104] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0105] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, 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 can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0106] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for synchronizing an interface, characterized in that, include: The interface to be updated is divided into several areas to be updated; Obtain interface update information, which includes interface information, update area address, and update address length; Based on the update region address and the update address length, determine the target region to be updated corresponding to the interface update information; The target area to be updated is updated based on the interface information. The step of dividing the interface to be updated into several areas to be updated specifically includes: The interface to be updated is divided into several areas to be updated; The region to be updated includes a region memory; The region memory includes the region data address and region address length of the region to be updated; Specifically, a RegionType enumeration is created. The RegionType enumeration is used to represent the types of regions that have been divided. Different region types can represent different parts of the interface, which facilitates subsequent update operations. Create a Region class, which represents the attributes and behaviors of each region; this class contains interface information, data address, and address length, which are used to describe the specific content and update method of the region. Create a Cache class, which is used to cache data received from TCP. When TCP receives data, it immediately writes it into the cache class. The step of determining the target area to be updated corresponding to the interface update information based on the update area address and the update address length specifically includes: The interface update information is parsed to obtain the update area address and the update address length; The update region address and the update address length are matched with the region data address and the region address length to determine the target region to be updated corresponding to the interface update information; The step of parsing the interface update information to obtain the update region address and the update address length specifically includes: The interface update information is parsed by a synchronization thread to obtain the update area address and the update address length. The synchronization thread is used to parse the data received by TCP and to update the interface to be updated according to the interface update information. Specifically, a synchronous thread class is created to parse the data received via TCP and update the interface; The cache class is used to store TCP-received data and provides methods for synchronization threads to retrieve this data; When TCP receives data, it parses the data and writes it to the buffer; In the main program, a synchronization thread is created and started to receive TCP data and process updates; The step of updating the target area to be updated based on the interface information specifically includes: Attach the interface to be updated to the application tree; The interface update information is displayed in the target area to be updated via the synchronization thread; Following the step of obtaining interface update information, the interface synchronization method further includes: The interface update information is cached in a cache unit, which is used to store the interface update information.
2. The interface synchronization method according to claim 1, characterized in that, The area to be updated also includes several functional components, and the area memory includes component data addresses and component address lengths.
3. An interface synchronization device, characterized in that, include: The area division module is used to divide the interface to be updated into several areas to be updated; The information acquisition module is used to acquire interface update information, which includes interface information, update area address, and update address length. The target determination module is used to determine the target area to be updated corresponding to the interface update information based on the update area address and the update address length. The information update module is used to update the target area to be updated based on the interface information. The step of dividing the interface to be updated into several areas to be updated specifically includes: The interface to be updated is divided into several areas to be updated; The region to be updated includes a region memory; The region memory includes the region data address and region address length of the region to be updated; Specifically, a RegionType enumeration is created. The RegionType enumeration is used to represent the types of regions that have been divided. Different region types can represent different parts of the interface, which facilitates subsequent update operations. Create a Region class, which represents the attributes and behaviors of each region; this class contains interface information, data address, and address length, which are used to describe the specific content and update method of the region. Create a Cache class, which is used to cache data received from TCP. When TCP receives data, it immediately writes it into the cache class. The step of determining the target area to be updated corresponding to the interface update information based on the update area address and the update address length specifically includes: The interface update information is parsed to obtain the update area address and the update address length; The update region address and the update address length are matched with the region data address and the region address length to determine the target region to be updated corresponding to the interface update information; The step of parsing the interface update information to obtain the update region address and the update address length specifically includes: The interface update information is parsed by a synchronization thread to obtain the update area address and the update address length. The synchronization thread is used to parse the data received by TCP and to update the interface to be updated according to the interface update information. Specifically, a synchronous thread class is created to parse the data received via TCP and update the interface; The cache class is used to store TCP-received data and provides methods for synchronization threads to retrieve this data; When TCP receives data, it parses the data and writes it to the buffer; In the main program, a synchronization thread is created and started to receive TCP data and process updates; The step of updating the target area to be updated based on the interface information specifically includes: Attach the interface to be updated to the application tree; The interface update information is displayed in the target area to be updated via the synchronization thread; Following the step of obtaining interface update information, the following is also included: The interface update information is cached in a cache unit, which is used to store the interface update information.
4. 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 program, it implements the interface synchronization method as described in any one of claims 1 to 2.
5. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the interface synchronization method as described in any one of claims 1 to 2.
Citation Information
Patent Citations
Data synchronization method and device
CN102081665A
Page loading method, device and equipment and readable storage medium
CN110020325A
Data updating method, device and equipment
CN115087958B