Page updating method and device, processor and storage medium
Through the observer mode and anti-shake throttling technology, the status changes of data topics and event topics in the data management platform are monitored and optimized, which solves the system performance degradation and user experience problems caused by frequent data updates, and achieves a smoother interactive experience and Performance improvements.
Patent Information
- Application Number
- CN202410960465.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-10-11
AI Technical Summary
Due to frequent background data updates on the data management platform, system performance declines and user interaction experience is poor.
The observer mode is used to monitor the status changes of the preset data topics and event topics in the page, and combined with anti-shake and throttling technologies, it controls the page update frequency and reduces unnecessary business logic execution, thereby optimizing system performance.
By effectively monitoring and processing data topic status changes, the system load is reduced, the system performance and user interaction experience are improved, and the problem of frequent page updates caused by frequent data updates is avoided.
Smart Images

Figure CN118760808A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a page updating method, a page updating device, a processor and a storage medium. Background Art
[0002] A data management platform is a type of software system specifically designed to process and analyze large amounts of data. It helps businesses and organizations extract valuable information from data by providing functions such as data management, data integration, data analysis, and data visualization.
[0003] In the actual operation of the data management platform, due to the frequent updates of background data, it is necessary to frequently obtain updated data from the background / and perform related processing operations on the updated data to update the front-end page, which reduces the overall performance of the data management platform. For example, the page response speed becomes slower. At the same time, due to the frequent updates of the page, the user interaction experience is also reduced. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a page update method, a page update device, a processor and a storage medium to solve the problem of system performance degradation caused by frequent background data updates, which affects the user interaction experience.
[0005] In order to achieve the above-mentioned object, the first aspect of the present application provides a page updating method, the method comprising:
[0006] Monitoring the state change of a preset data subject in the current page through an observer mode; wherein the observer mode includes a preset data subject and a data observer, the preset data subject includes at least one preset target data, and the data observer includes a first anti-shake observer and a first throttling observer;
[0007] When the status of the preset data subject is detected to change, the data observer is notified;
[0008] When the data observer receives the notification, it determines whether to process the notification immediately based on the first anti-shake function and the first throttling function. If so, it updates the current page based on the state change of the preset data subject.
[0009] In the embodiment of the present application, when the data observer receives the notification, it determines whether to process the notification immediately based on the first anti-shake function and the first throttling function. If so, it updates the current page based on the state change of the preset data subject, including:
[0010] The first anti-shake observer determines whether to process the notification immediately based on the first anti-shake function and the time point when the notification is received;
[0011] The first throttling observer determines whether to process the notification immediately based on the first throttling function and the time point when the notification is received;
[0012] If the first anti-shake observer and / or the first throttling observer determines to process the notification immediately, the current page is updated based on the state change of the preset data subject.
[0013] In an embodiment of the present application, updating the current page based on the state change of the preset data subject includes:
[0014] Sending a first data acquisition request to a server, so that the server responds to the first data acquisition request and returns a first request result;
[0015] According to the result of the first request, the entire current page is updated.
[0016] In an embodiment of the present application, updating the current page based on the state change of the preset data subject includes:
[0017] Sending a second data acquisition request to the server, so that the server responds to the second data acquisition request and returns a second request result; wherein the second data acquisition request includes information identifying a preset data subject;
[0018] Based on the result of the second request, the current page is partially updated.
[0019] In an embodiment of the present application, the method further includes:
[0020] The state change of a preset event subject in the current page is monitored through the observer mode; wherein the observer mode includes a preset event subject and an event observer, the preset event subject includes at least one preset target event, and the event observer includes a second anti-shake observer and a second throttling observer;
[0021] When the status of the preset event subject is detected to change, the event observer is notified;
[0022] When the event observer receives the notification, it determines whether to process the notification immediately based on the second anti-shake function and the second throttling function. If so, it updates the current page based on the state change of the preset event subject.
[0023] In the embodiment of the present application, when the event observer receives the notification, it determines whether to process the notification immediately based on the second anti-shake function and the second throttling function. If so, it updates the current page based on the state change of the preset event subject, including:
[0024] The second anti-shake observer determines whether to process the notification immediately based on the second anti-shake function and the time point when the notification is received;
[0025] The second throttling observer determines whether to process the notification immediately based on the second throttling function and the time point when the notification is received;
[0026] If the second anti-shake observer and / or the second throttling observer determines to process the notification immediately, the current page is updated based on the state change of the preset event subject.
[0027] In an embodiment of the present application, the method further includes:
[0028] After the data observer receives the notification, the processing status of the data observer on the notification is determined;
[0029] If the data observer's processing status for the notification is unprocessed, the latest update time of the current page is obtained;
[0030] Determine whether to update the current page based on the time difference between the latest update time and the current time.
[0031] A second aspect of the present application provides a page updating device, the device comprising:
[0032] A first state change monitoring module, used to monitor the state change of a preset data subject in the current page through an observer mode; wherein the observer mode includes a preset data subject and a data observer, the preset data subject includes at least one preset target data, and the data observer includes a first anti-shake observer and a first throttling observer;
[0033] A first state change transmission module is used to notify the data observer when the state of the preset data subject is monitored to change;
[0034] The first state change processing module is used to determine whether to process the notification immediately based on the first anti-shake function and the first throttling function when the data observer receives the notification. If so, update the current page based on the state change of the preset data subject.
[0035] A third aspect of the present application provides a processor configured to execute the above-mentioned page update method.
[0036] A fourth aspect of the present application provides a machine-readable storage medium, on which instructions are stored. When the instructions are executed by a processor, the processor is configured to execute the above-mentioned page update method.
[0037] The page update method, device, processor and storage medium provided by the present application monitor the state changes of the preset data subject in the current page through the observer mode, ensuring the effectiveness and maintainability of monitoring and processing the state changes of the preset data subject, and further optimizing the processing method when the preset data subject state changes by combining anti-shake technology and throttling technology, that is, reducing the execution frequency of the corresponding business logic in the system when the preset data subject state changes frequently, so as to reduce the system load and thus improve the system performance. The present application controls the update frequency of the page to avoid the problem of frequent page updates caused by frequent data updates, and provides users with a smooth interactive experience.
[0038] Other features and advantages of the embodiments of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application. In the accompanying drawings:
[0040] Figure 1 A schematic diagram of a first process flow of a page updating method according to an embodiment of the present application is shown;
[0041] Figure 2 A schematic diagram of a structure of a page updating device according to an embodiment of the present application is shown;
[0042] Figure 3 The internal structure diagram of the computer device according to the embodiment of the present application is schematically shown.
[0043] Description of Reference Numerals
[0044] A01-processor; A02-network interface; A03-internal memory; A04-display screen; A05-input device; A06-non-volatile storage medium; B01-operating system; B02-computer program. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the specific implementation methods described herein are only used to illustrate and explain the embodiments of the present application, and are not used to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0046] It should be noted that if the embodiments of the present application involve directional indications (such as up, down, left, right, front, back, etc.), such directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0047] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0048] In view of the problem that frequent background data updates in related technologies cause system performance degradation and affect user interaction experience, the present application provides a page update method, device, processor and storage medium. The page update method, device, processor and storage medium provided by the present application are described in detail below in conjunction with the accompanying drawings through specific embodiments and implementation methods.
[0049] Figure 1 The first flow chart of the page update method of the embodiment of the present application is schematically shown. Figure 1 As shown, in one embodiment of the present application, a page updating method is provided, the method comprising:
[0050] Step 200: monitor the status change of the preset data subject in the current page through the observer mode.
[0051] The observer mode includes a preset data subject and a data observer, and the preset data subject includes at least one preset target data.
[0052] Specifically, the observer pattern is a design pattern that implements a one-to-many dependency relationship by establishing a subscription relationship between a subject and an observer. In this pattern, the subject is the object being monitored, and the observer is the object that responds (i.e., performs corresponding processing), that is, when the state of the subject changes, all observers who have subscribed to the subject will be notified so that each observer can respond.
[0053] In this embodiment, the preset data subject and data observer are the two main roles in the observer pattern, that is, the subject and the observer. A subscription relationship is established between the preset data subject and the data observer, and the number of data observers can be set according to the actual situation. Among them, the preset data subject is mainly used to manage and notify data observers. Specifically, the preset data subject registers data observers so that the data observers can receive notifications; the preset data subject unregisters data observers so that the data observers stop receiving notifications; when the state of the preset data subject changes (that is, there is a change in the state of at least one preset target data), all data observers are notified. In this embodiment, the change in the state of the preset data subject includes attribute changes, and the attribute change represents that at least one attribute value of the preset target data has changed.
[0054] Taking the energy storage energy management platform as an example, as a key energy management system, it needs to process complex and frequently updated energy data. The method of monitoring the state changes of the target energy data in the current page of the platform through the observer mode specifically includes: creating an energy data topic (corresponding to the preset data topic, which includes the target energy data), and defining its registration, deregistration and notification methods for energy data observers (corresponding to the above data observers); creating an energy data observer interface or abstract class, and making all energy data observers implement the interface or inherit the abstract class; defining the method for each energy data observer to receive energy data topic notifications and respond when receiving energy data topic notifications.
[0055] This embodiment implements page updates based on the observer pattern, which can significantly improve the scalability, flexibility and maintainability of the system. Specifically, in the observer pattern, the subject state change and the observer's processing logic are separated, making the code easier to understand, maintain and expand. In simple terms, the subject does not need to know the specific implementation of the observer, but only needs to know the observer interface. In this way, the subject and the observer can be easily expanded and modified. Moreover, the observer pattern can dynamically add or remove observers at runtime. This free registration and deregistration mechanism makes the system more flexible. In addition, when the subject state changes, all relevant observers can be notified and processed accordingly. This notification mechanism is conducive to building complex business logic.
[0056] Step 400: when a change in the state of a preset data subject is detected, the data observer is notified.
[0057] Optionally, in step 400, when a change in the state of a preset data subject is detected, first state change information is also generated, and the first state change information is transmitted to the data observer while notifying the data observer. That is, step 400 is specifically as follows: when a change in the state of a preset data subject is detected, first state change information is generated, the data observer is notified, and the first state change information is transmitted to the data observer.
[0058] In this embodiment, the first state change information includes the latest attribute value after the attribute value of the preset target data changes and the historical attribute value before the attribute value of the preset target data changes.
[0059] This embodiment transmits the first state change information so that the data observer can make corresponding processing according to its own logic, which not only makes the message transmission and response mechanism in the observer mode more efficient and flexible, but also significantly improves the performance and scalability of the system and can adapt to complex business needs. Of course, it is understandable that according to specific business needs, the first state change information can also include other additional information related to the state change, such as the time information of the change of the preset data subject state, so that the data observer can more completely understand the change of the preset data subject state.
[0060] Step 600: When the data observer receives the notification, it determines whether to process the notification immediately based on the first anti-shake function and the first throttling function. If so, it updates the current page based on the state change of the preset data subject.
[0061] Specifically, by subscribing to a preset data topic, the data observer can receive notifications when the preset data topic changes, and respond to changes in the status of the preset data topic in a timely manner. It is understandable that in the case where the preset target data is updated frequently (i.e., the preset data topic status changes frequently), the page update frequency can be reduced by reducing the data observer's response frequency to the received notifications, that is, reducing the data observer's response frequency to changes in the preset data topic status. Based on this, in order to reduce the page update frequency and thus improve system performance, as a specific implementation, in the observer mode, the data observer includes a first anti-shake observer and a first throttling observer, and the step 600 includes:
[0062] Step 610: The first anti-shake observer determines whether to process the notification immediately based on the first anti-shake function and the time point when the notification is received.
[0063] Specifically, the anti-shake function is used to prevent multiple consecutive triggering of function calls in a short period of time, so that only the last function call takes effect. The core idea is to set a timer to execute the function if it is not triggered again within a specified time interval; if it is triggered again within this time interval, the timer is restarted. The anti-shake function effectively controls the triggering frequency of the function by delaying the execution time of the function, thereby improving performance.
[0064] In this embodiment, the first anti-shake function includes two main parts: a timer and a function to be executed, which work together to achieve the anti-shake effect. Among them, the timer is used to delay the execution of the function to be executed, and the time of the timer can be set according to specific needs and actual conditions. The function to be executed is used to update the current page based on the state change of the preset data subject, and the time point of triggering the function to be executed is the time point when the notification is received. In this embodiment, the first anti-shake observer is used as a specific observer, and the execution time of the function to be executed is delayed based on the time point of receiving the notification, and the triggering frequency of the function to be executed is controlled, that is, to avoid triggering the update of the current page too frequently, thereby reducing the page update frequency and unnecessary performance consumption.
[0065] Step 620 : The first throttling observer determines whether to process the notification immediately based on the first throttling function and the time point when the notification is received.
[0066] Specifically, the throttling function is used to control a function to be executed at most once within a certain period of time, that is, to limit the execution frequency of the function. Specifically, the throttling function sets a time interval. The function will only be executed when the time interval between two consecutive triggers is greater than or equal to the set time interval. If the time interval between two consecutive triggers is less than the set time interval, the function will not be executed, thereby effectively controlling the execution frequency of the function and improving the performance of the application.
[0067] In this embodiment, the first throttling function also includes a timer and a function to be executed. The function to be executed is also used to update the current page based on the state change of the preset data subject, and the time point when the function to be executed is triggered is also the time point when the notification is received. In this embodiment, the first throttling observer is used as a specific observer. Through the combination of the timer and the function to be executed, it is ensured that the function to be executed is executed at most once within the set time interval, effectively controlling the execution frequency of the function to be executed, reducing unnecessary system overhead and resource consumption, that is, reducing the system load, thereby optimizing system performance.
[0068] Taking the above-mentioned energy storage energy management platform as an example, by registering anti-shake observers and throttling observers in each component of the platform that needs to display or process energy data in real time, when the state of the target energy data in the component changes, it can be determined according to the anti-shake and throttling logic whether to perform corresponding processing on the change in the state of the target energy data (such as directly displaying the target energy data, performing corresponding statistical calculations based on the target energy data and then displaying it), so as to reduce the frequency of business logic processing and page updates.
[0069] The data observer of this embodiment determines the processing timing and frequency of notifications according to the anti-shake mechanism and the throttling mechanism, and can process notifications more reasonably, thereby reducing the page update frequency and improving system performance and user experience.
[0070] Step 630: If the first anti-shake observer and / or the first throttling observer determines to process the notification immediately, the current page is updated based on the state change of the preset data subject.
[0071] In this embodiment, since the first anti-shake observer controls the page update frequency based on the anti-shake mechanism, and the first throttling observer controls the page update frequency based on the throttling mechanism, when at least one of the first anti-shake observer and the first throttling observer determines to process the notification immediately, the current page is updated based on the status change of the preset data subject, which can effectively reduce the network request frequency and the page update frequency, thereby improving system performance and user experience.
[0072] As a specific implementation, step 630 specifically includes:
[0073] Step 631: Send a first data acquisition request to the server, so that the server responds to the first data acquisition request and returns a first request result.
[0074] Step 632: Update the entire current page according to the first request result.
[0075] In order to update the entire current page, when sending the first data acquisition request to the server, a simple GET request may be sent to obtain the new content of the entire page (i.e., the first request result). The GET request may include the URL of the current page and possible cache control information to ensure that the latest page content is obtained from the server, thereby completely refreshing the page.
[0076] Taking the above energy storage management platform as an example, a request can be sent to display multiple fields in its database on the front-end page, that is, to display specific energy data, such as energy production and energy storage status. When the data directly or indirectly related to the preset data subject status accounts for a large proportion in the front-end page (such as more than 80%), the current page can be updated to select the entire current page for update. Among them, the proportion of certain data in the front-end page can be calculated by the position and size of these data in the entire page content.
[0077] It is understandable that when the data directly or indirectly related to the preset data subject status accounts for a small proportion of the front-end page, updating the current page can be selected to partially update the current page. Based on this, as another specific implementation, the step 630 specifically includes:
[0078] Step 633: Send a second data acquisition request to the server, so that the server responds to the second data acquisition request and returns a second request result.
[0079] The second data acquisition request includes information identifying a preset data subject to ensure that the server can correctly process the request and return corresponding data.
[0080] Step 634: Partially update the current page according to the second request result.
[0081] In this embodiment, when the preset data subject includes more than two preset target data, the second data acquisition request specifically includes identification information of the preset target data whose status has changed, so as to improve the response speed of the server through a smaller request load.
[0082] Among them, in order to partially update the current page, an asynchronous request (i.e., a second data acquisition request) can be sent by using the AJAX technology in JavaScript to obtain and update the data of a specific part of the page. In the AJAX request, the GET or POST method can be used to send information identifying a preset data subject as part of the request to the server; the WebSocket communication protocol can also be used to enable the client and the server to communicate bidirectionally. The client sends a request to the server so that the server pushes the updated data to the client, thereby achieving the update of partial data.
[0083] This embodiment can optimize performance and improve user experience by partially updating the page (also called local update). Specifically, by updating only the part of the page that needs to be changed, the amount of data transmission between the server and the client can be significantly reduced, thereby improving the loading speed; the server only needs to process and send part of the updated content instead of the entire page, which reduces processing time and resource consumption, that is, reduces server load; since there is no need to re-parse and render the entire page, it can quickly respond to status changes of preset data themes; local updates can smoothly update content and provide a smoother experience, while maintaining the scrolling position of the page, etc., to prevent users from losing their original operation progress due to page refresh.
[0084] In addition, in page development, events refer to various interactions or actions performed by users on a page, such as clicking a button, entering text, and moving the mouse. By capturing these events, developers can write corresponding logic to respond to user operations, such as dynamically updating page content, executing specific functions, or displaying specific effects, so that users can interact with the page in real time and flexibly, achieving a richer and more interactive user experience. In the process of using a page, due to user misoperation, network delays, etc., an event may be frequently triggered in a short period of time, causing the system to repeatedly execute the business processing of the event, resulting in system performance degradation and poor user interaction experience.
[0085] In view of the problem in the related art that frequent event triggering causes system performance degradation and poor user interaction experience, optionally, the method further includes:
[0086] Step 710: monitor the status change of the preset event theme in the current page through the observer mode.
[0087] The observer mode includes a preset event subject and an event observer, the preset event subject includes at least one preset target event, and the event observer includes a second anti-shake observer and a second throttling observer.
[0088] It should be understood that in the observer mode, more than two different topics can be included in the same page, each topic can exist independently and each maintains a set of observers.
[0089] Step 720: When a change in the status of a preset event topic is detected, the event observer is notified.
[0090] Step 730: When the event observer receives the notification, it determines whether to process the notification immediately based on the second anti-shake function and the second throttling function. If so, it updates the current page based on the state change of the preset event theme.
[0091] As a specific implementation, in the observer mode, step 730 includes:
[0092] Step 731: The second anti-shake observer determines whether to process the notification immediately based on the second anti-shake function and the time point when the notification is received.
[0093] Step 732: The second throttling observer determines whether to process the notification immediately based on the second throttling function and the time point when the notification is received.
[0094] Step 733: If the second anti-shake observer and / or the second throttling observer determines to process the notification immediately, the current page is updated based on the state change of the preset event subject.
[0095] In this embodiment, the method of controlling the update of the current page by monitoring the status changes of the preset event theme in the current page is similar to the method of controlling the update of the current page by monitoring the status changes of the preset data theme in the current page, and will not be repeated here.
[0096] It is worth mentioning that in this embodiment, when the second anti-shake observer and / or the second throttling observer determine to process the notification immediately, whether to update the entire current page or to partially update the current page is selected based on the proportion of page components affected by the preset target event whose state has changed in the front-end page.
[0097] This embodiment can improve system performance by preventing the system from repeatedly executing the business logic of the same event in a short period of time, and can provide a smoother user experience by avoiding frequent page updates.
[0098] In addition, in the observer mode, since the observer may be unable to respond to changes in the subject due to program problems (such as exceptions when processing subject notifications or being in an invalid state), there is a problem that the front-end page does not update content for a long time, resulting in a poor user experience.
[0099] In view of the problem in the related art that the front-end page has not been updated for a long time, resulting in poor user experience, optionally, the method further includes:
[0100] Step 810: After receiving the notification, the data observer determines the processing status of the notification by the data observer.
[0101] Among them, in the observer mode, the notification is a message sent by the subject to the observer, and the observer needs to perform corresponding processing after receiving the notification. For the data observer in this embodiment, the corresponding processing of the received notification is to determine whether to process the notification immediately, that is, to determine whether to update the current page based on the status change of the preset data subject.
[0102] In this embodiment, after receiving the notification, the data observer determines the processing status of the notification by the data observer, that is, determines whether the data observer has processed the notification accordingly, wherein determining whether the data observer has processed the notification accordingly can be achieved through return value confirmation, callback confirmation, etc. When the data observer processes the received notification accordingly, the processing status of the data observer for the notification is the processed status; conversely, when the data observer does not process the received notification accordingly, the processing status of the data observer for the notification is the unprocessed status.
[0103] Step 820: If the data observer's processing status of the notification is unprocessed, the latest update time point of the current page is obtained.
[0104] Step 830: Determine whether to update the current page based on the time difference between the latest update time point and the current time point.
[0105] As a specific implementation, step 830 includes:
[0106] Step 831, if the time difference between the latest update time point and the current time point is greater than or equal to the preset time interval, a third data acquisition request is sent to the server, so that the server responds to the third data acquisition request, returns the third request result, and updates the current page according to the third request result.
[0107] In this embodiment, when the front-end page has not been updated for a long time, requests are regularly initiated at preset time intervals to update the front-end page, which can effectively improve the user experience.
[0108] It is not difficult to see that the page update method provided in this embodiment monitors the state changes of the preset data subject in the current page through the observer mode, ensuring the effectiveness and maintainability of monitoring and processing the state changes of the preset data subject, and further optimizes the processing method when the preset data subject state changes by combining anti-shake technology and throttling technology, that is, reducing the execution frequency of the corresponding business logic in the system when the preset data subject state changes frequently, so as to reduce the system load and improve the system performance. This embodiment controls the update frequency of the page to avoid the problem of frequent page updates caused by frequent data updates, and provides users with a smooth interactive experience.
[0109] Figure 1 FIG. 1 is a flow chart of a page updating method in one embodiment. It should be understood that although Figure 1The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0110] Figure 2 The structure block diagram of the page updating device of the embodiment of the present application is schematically shown. Figure 2 As shown, in one embodiment of the present application, a page updating device is provided, the page updating device comprising a first state change monitoring module, a first state change transmission module and a first state change processing module, wherein:
[0111] The first state change monitoring module is used to monitor the state changes of a preset data subject in the current page through an observer mode; wherein, the observer mode includes a preset data subject and a data observer, the preset data subject includes at least one preset target data, and the data observer includes a first anti-shake observer and a first throttling observer.
[0112] The first state change transmission module is used to notify the data observer when it monitors that the state of a preset data subject has changed.
[0113] The first state change processing module is used to determine whether to process the notification immediately based on the first anti-shake function and the first throttling function when the data observer receives the notification. If so, update the current page based on the state change of the preset data subject.
[0114] In this embodiment, the first state change processing module includes:
[0115] The first state change processing unit is used for the first anti-shake observer to determine whether to immediately process the notification based on the first anti-shake function and the time point when the notification is received.
[0116] The second state change processing unit is used for the first throttling observer to determine whether to immediately process the notification based on the first throttling function and the time point when the notification is received.
[0117] The first page update control unit is configured to update the current page based on a state change of a preset data subject when the first anti-shake observer and / or the first throttling observer determines to process the notification immediately.
[0118] In this embodiment, the first page update control unit may include:
[0119] The first request subunit is used to send a first data acquisition request to the server, so that the server responds to the first data acquisition request and returns a first request result.
[0120] The first updating subunit is used to update the entire current page according to the first request result.
[0121] In this embodiment, the first page update control unit may further include:
[0122] The second request subunit is used to send a second data acquisition request to the server, so that the server responds to the second data acquisition request and returns a second request result; wherein the second data acquisition request includes information identifying a preset data subject.
[0123] The second updating subunit is used to partially update the current page according to the second request result.
[0124] In this embodiment, the device further includes:
[0125] The second state change monitoring module is used to monitor the state change of the preset event theme in the current page through the observer mode; wherein, the observer mode includes a preset event theme and an event observer, the preset event theme includes at least one preset target event, and the event observer includes a second anti-shake observer and a second throttling observer.
[0126] The second state change transmission module is used to notify the event observer when it is detected that the state of the preset event subject has changed.
[0127] The second state change processing module is used to determine whether to immediately process the notification based on the second anti-shake function and the second throttling function when the event observer receives the notification. If so, update the current page based on the state change of the preset event theme.
[0128] In this embodiment, the second state change processing module includes:
[0129] The third state change processing unit is used for the second anti-shake observer to determine whether to immediately process the notification based on the second anti-shake function and the time point when the notification is received.
[0130] The fourth state change processing unit is used for the second throttling observer to determine whether to immediately process the notification based on the second throttling function and the time point when the notification is received.
[0131] The second page update control unit is used to update the current page based on the state change of the preset event subject when the second anti-shake observer and / or the second throttling observer determines to process the notification immediately.
[0132] In this embodiment, the device further includes:
[0133] The processing status determination module is used to determine the processing status of the data observer on the notification after the data observer receives the notification.
[0134] The time point acquisition module is used to obtain the latest update time point of the current page when the data observer's processing status of the notification is unprocessed.
[0135] The page update control module is used to determine whether to update the current page according to the time difference between the latest update time point and the current time point.
[0136] In this embodiment, the page update device includes a processor and a memory. The first state change monitoring module, the first state change transmission module and the first state change processing module are all stored in the memory as program units, and the processor executes the above program modules stored in the memory to implement corresponding functions.
[0137] The processor includes a kernel, and the kernel calls the corresponding program unit from the memory. One or more kernels can be set, and the above page update method is implemented by adjusting kernel parameters.
[0138] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0139] An embodiment of the present application provides a processor configured to execute the above-mentioned page update method.
[0140] An embodiment of the present application provides a machine-readable storage medium, on which instructions are stored. When the instructions are executed by a processor, the processor is configured to execute the above-mentioned page update method.
[0141] Figure 3 The internal structure diagram of the computer device of the embodiment of the present application is schematically shown. Figure 3As shown, in one embodiment of the present application, a computer device is provided, which may be a terminal. The computer device includes a processor A01, a network interface A02, a display screen A04, an input device A05 and a memory (not shown in the figure) connected via a system bus. Among them, the processor A01 of the computer device is used to provide computing and control capabilities. The memory of the computer device includes an internal memory A03 and a non-volatile storage medium A06. The non-volatile storage medium A06 stores an operating system B01 and a computer program B02. The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 in the non-volatile storage medium A06. The network interface A02 of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor A01, a page update method is implemented. The display screen A04 of the computer device may be a liquid crystal display or an electronic ink display, and the input device A05 of the computer device may be a touch layer covered on the display screen, or a key, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0142] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0143] In one embodiment, the page updating device provided by the present application can be implemented in the form of a computer program. The computer program can be Figure 3 The computer device shown in the figure is run. The memory of the computer device can store various program modules constituting the page updating device, such as: Figure 2 The first state change monitoring module, the first state change transmission module and the first state change processing module shown in the figure. The computer program composed of each program module enables the processor to execute the steps of the page update method of each embodiment of the present application described in this specification.
[0144] Figure 3 The computer device shown can be Figure 2 In the page updating device shown, the first state change monitoring module executes step 200 , the first state change transmitting module executes step 400 , and the first state change processing module executes step 600 .
[0145] The present application provides a device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the following steps are implemented:
[0146] Monitor the state change of the preset data subject in the current page through the observer mode; wherein the observer mode includes the preset data subject and the data observer, and the preset data subject includes at least one preset target data;
[0147] When the status of the preset data subject is detected to change, the data observer is notified;
[0148] When the data observer receives the notification, it determines whether to process the notification immediately based on the first anti-shake function and the first throttling function. If so, it updates the current page based on the state change of the preset data subject.
[0149] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0150] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0151] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0152] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0153] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0154] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0155] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0156] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0157] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A page update method, It is characterized in that The method comprises: Monitoring the state change of a preset data subject in the current page through an observer mode; wherein the observer mode includes a preset data subject and a data observer, the preset data subject includes at least one preset target data, and the data observer includes a first anti-shake observer and a first throttling observer; When the status of the preset data subject is detected to change, the data observer is notified; When the data observer receives the notification, it determines whether to process the notification immediately based on the first anti-shake function and the first throttling function. If so, it updates the current page based on the state change of the preset data subject.
2. The method according to claim 1, It is characterized in that When the data observer receives the notification, it determines whether to process the notification immediately based on the first anti-shake function and the first throttling function. If so, it updates the current page based on the state change of the preset data subject, including: The first anti-shake observer determines whether to process the notification immediately based on the first anti-shake function and the time point when the notification is received; The first throttling observer determines whether to process the notification immediately based on the first throttling function and the time point when the notification is received; If the first anti-shake observer and / or the first throttling observer determines to process the notification immediately, the current page is updated based on the state change of the preset data subject.
3. The method according to claim 1, It is characterized in that Update the current page based on the state changes of the preset data theme, including: Sending a first data acquisition request to a server, so that the server responds to the first data acquisition request and returns a first request result; According to the result of the first request, the entire current page is updated.
4. The method according to claim 1, It is characterized in that Update the current page based on the state changes of the preset data theme, including: Sending a second data acquisition request to the server, so that the server responds to the second data acquisition request and returns a second request result; wherein the second data acquisition request includes information identifying a preset data subject; Based on the result of the second request, the current page is partially updated.
5. The method according to claim 1, It is characterized in that The method further comprises: The state change of a preset event subject in the current page is monitored through the observer mode; wherein the observer mode includes a preset event subject and an event observer, the preset event subject includes at least one preset target event, and the event observer includes a second anti-shake observer and a second throttling observer; When the status of the preset event subject is detected to change, the event observer is notified; When the event observer receives the notification, it determines whether to process the notification immediately based on the second anti-shake function and the second throttling function. If so, it updates the current page based on the state change of the preset event subject.
6. The method according to claim 5, It is characterized in that When the event observer receives the notification, it determines whether to process the notification immediately based on the second anti-shake function and the second throttling function. If so, it updates the current page based on the state change of the preset event subject, including: The second anti-shake observer determines whether to process the notification immediately based on the second anti-shake function and the time point when the notification is received; The second throttling observer determines whether to process the notification immediately based on the second throttling function and the time point when the notification is received; If the second anti-shake observer and / or the second throttling observer determines to process the notification immediately, the current page is updated based on the state change of the preset event subject.
7. The method according to any one of claims 1 to 6, It is characterized in that The method further comprises: After the data observer receives the notification, the processing status of the data observer on the notification is determined; If the data observer's processing status for the notification is unprocessed, the latest update time of the current page is obtained; Determine whether to update the current page based on the time difference between the latest update time and the current time.
8. A page updating device, It is characterized in that The device comprises: A first state change monitoring module, used to monitor the state change of a preset data subject in the current page through an observer mode; wherein the observer mode includes a preset data subject and a data observer, the preset data subject includes at least one preset target data, and the data observer includes a first anti-shake observer and a first throttling observer; A first state change transmission module is used to notify the data observer when the state of the preset data subject is monitored to change; The first state change processing module is used to determine whether to process the notification immediately based on the first anti-shake function and the first throttling function when the data observer receives the notification. If so, update the current page based on the state change of the preset data subject.
9. A processor, It is characterized in that The method is configured to execute the page updating method according to any one of claims 1 to 7.
10. A machine-readable storage medium having instructions stored thereon, It is characterized in that When the instruction is executed by a processor, the processor is configured to execute the page updating method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Data updating method and device
CN106302008A
Anti-shake and throttling packaging method and system
CN111460350A
Page presentation data clearing method and apparatus, computer device and storage medium
WO2020258663A1
