Method and apparatus for local data management of online applications
By comparing version numbers and performing data cleanup mechanisms when launching online applications, the problem of useless data occupying storage resources in online applications is solved, ensuring efficient use of storage resources and a good user experience.
Patent Information
- Application Number
- CN202011186535.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-30
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2040-10-30
AI Technical Summary
In online applications, existing local data permanent storage solutions result in useless data occupying a large amount of storage space, causing resource waste and potentially affecting the use of useful data, or even leading to user churn.
When the online application starts, the front-end data version number is determined and sent to the back-end device. The back-end device determines the changed data information based on the version number and returns it. The front-end device cleans and rebuilds the local data based on this information and updates the front-end data version number to be consistent with the back-end version number.
It enables timely cleaning of useless data, reduces waste of storage resources, avoids impact on useful data, and ensures the stable operation of online applications.
Smart Images

Figure CN113760859B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data management, and in particular to a local data management method and device for online applications. Background Art
[0002] Online applications (such as online applets) consist of two parts: code and local data.
[0003] Local data in online applications is used to store user logins, cross-terminal information, business information, and some cached data. During business upgrades, local data for obsolete businesses must be deleted, and modified local data must be rebuilt, otherwise business anomalies may occur. Because data is closely tied to business operations, some online applications, such as WeChat mini-programs, only provide permanent local data storage solutions.
[0004] The permanent storage solution for local data will cause a large amount of useless data to occupy a lot of space, and most of the data is useless, resulting in a waste of storage resources. Moreover, when the storage limit of the local data queue is reached, it may also affect the use of useful data. For example, login information will be squeezed out of the local data queue, making users unable to log in, thereby causing user loss. Summary of the Invention
[0005] In view of this, the purpose of the present invention is to provide a local data management method and device for online applications, which can clean up useless data in a timely manner, reduce the waste of storage resources and the impact on the use of useful data.
[0006] In order to achieve the above object, the present invention provides the following technical solutions:
[0007] A first method for managing local data of an online application is applied to a front-end device of the online application. The method includes:
[0008] After the online application is started, determine the front-end data version number of the online application;
[0009] Sending the front-end data version number to a back-end device of the online application, so that the back-end device determines the changed data information according to the front-end data version number and the back-end data version number of the online application recorded by the back-end device, and returns the changed data information and the back-end data version number;
[0010] Receive the changed data information and backend data version number returned by the backend device, clean up and rebuild the local data of the online application according to the changed data information, and update the frontend data version number of the online application to the backend data version number.
[0011] The second local data management method for online applications is applied to the backend device of the online application and includes:
[0012] Receive the front-end data version number of the online application sent by the front-end device after the online application is started;
[0013] Comparing the received front-end data version number with the back-end data version number of the online application recorded by the back-end device;
[0014] If the former is smaller than the latter, the change data information corresponding to each version number recorded by the back-end device that is higher than the front-end data version number is collected, and the collected change data information and the back-end data version number are sent to the front-end device, so that the front-end device cleans and rebuilds the local data of the online application according to the received change data information, and updates the front-end data version number of the online application to the back-end data version number.
[0015] The first local data management device for online applications is applied to the front-end device of the online application, and includes:
[0016] A determination unit, used to determine the front-end data version number of the online application after the online application is started;
[0017] a transceiver unit, configured to send the front-end data version number to a back-end device of an online application, so that the back-end device determines the changed data information based on the front-end data version number and the back-end data version number of the online application recorded by the back-end device, and returns the changed data information and the back-end data version number; and to receive the changed data information and the back-end data version number returned by the back-end device;
[0018] The processing unit is configured to clean up and rebuild the local data of the online application according to the changed data information, and update the front-end data version number of the online application to the back-end data version number.
[0019] The second local data management device for online applications is applied to the back-end equipment of online applications and includes:
[0020] a transceiver unit, configured to receive a front-end data version number of the online application sent by the front-end device after the online application is started; and to send the change data information collected by the processing unit and the back-end data version number of the online application recorded in the back-end data to the front-end device, so that the front-end device cleans and rebuilds the local data of the online application according to the received change data information, and updates the front-end data version number of the online application to the back-end data version number;
[0021] The processing unit is used to compare the front-end data version number received by the transceiver unit with the back-end data version number of the online application recorded by the back-end device. If the former is smaller than the latter, the change data information corresponding to each version number recorded by the back-end device that is higher than the front-end data version number is collected.
[0022] An electronic device comprising a processor and a memory;
[0023] The memory stores one or more computer programs that can be executed by the processor; when the processor executes the one or more computer programs, it implements the steps in the above-mentioned first local data management method for online applications, or implements the steps in the above-mentioned second local data management method for online applications.
[0024] A non-transitory computer-readable storage medium stores instructions that, when executed by a processor, cause the processor to implement the steps of the first method for managing local data for online applications, or the steps of the second method for managing local data for online applications.
[0025] As can be seen from the above technical solution, in the present invention, after the online application is started, the front-end data version number of the online application is determined and sent to the back-end device of the online application; the back-end device determines the change data information based on the front-end data version number and the back-end data version number of the online application recorded by the back-end device, and returns the change data information and the back-end data version number, so that the front-end device can clean up and rebuild the local data of the online application based on the change data information, and update the front-end data version number of the online application to the back-end data version number. It can be seen that in the present invention, each time the online application is started, if the local version number is different from the back-end data version number, the local data will be cleaned up and rebuilt accordingly, thereby timely cleaning up useless data, reducing the waste of storage resources and the impact on the use of useful data. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0027] Figure 1 This is a flow chart of a local data management method for online applications according to a first embodiment of the present invention;
[0028] Figure 2 This is a flow chart of a local data management method for online applications according to a second embodiment of the present invention;
[0029] Figure 3 This is a flow chart of a local data management method for online applications according to a third embodiment of the present invention;
[0030] Figure 4 This is a flow chart of a local data management method for online applications according to a fourth embodiment of the present invention;
[0031] Figure 5 This is a flow chart of a local data management method for online applications according to a fifth embodiment of the present invention;
[0032] Figure 6 1 is a schematic structural diagram of a local data management device for online applications according to a first embodiment of the present invention;
[0033] Figure 7 This is a schematic structural diagram of a local data management device for online applications according to a second embodiment of the present invention;
[0034] Figure 8 It is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0035] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0036] See also Figure 1 , Figure 1 This is a flow chart of a local data management method for online applications according to an embodiment of the present invention. The method is applied to a front-end device of an online application, such as Figure 1 As shown, the following steps are included:
[0037] Step 101: After the online application is started, the front-end data version number of the online application is determined;
[0038] Step 102: Send the front-end data version number to the back-end device of the online application, so that the back-end device determines the changed data information according to the front-end data version number and the back-end data version number of the online application recorded by the back-end device, and returns the data change information and the back-end data version number;
[0039] Step 103: Receive the changed data information and backend data version number returned by the backend device, clean up and rebuild the local data of the online application according to the changed data information, and update the frontend data version number of the online application to the backend data version number.
[0040] from Figure 1The illustrated method can be viewed as follows: in this embodiment, after the online application is started, the front-end data version number of the online application is sent to the back-end device of the online application. The back-end device determines the changed data information based on the front-end data version number and the back-end data version number of the online application recorded by the back-end device, and returns the changed data information and the back-end data version number. The front-end device can then clean up and rebuild the local data of the online application based on the changed data information, and update the front-end data version number of the online application to the back-end data version number. Because this method is executed each time the online application is started, changes in data versions can be detected promptly, allowing local data to be cleaned up and rebuilt accordingly. This allows for the timely removal of useless data, reducing the waste of storage resources and the impact on the use of useful data.
[0041] See also Figure 2 , Figure 2 This is a flow chart of a local data management method for online applications according to embodiment 2 of the present invention. This method is applied to a front-end device for online applications, such as Figure 1 As shown, the following steps are included:
[0042] Step 2011: After the online application is started, the local data queue of the online application is searched. If the local data queue of the online application is not found, a local data queue is created for the online application, and the version number 0 is marked in the created local data queue.
[0043] In this embodiment, version number 0 is the initial version number. In actual applications, the initial version number can also be set to other values, such as 1.
[0044] Step 2012: Determine the version number marked in the local data queue of the online application as the front-end data version number of the online application;
[0045] In this embodiment, when the local data queue of the online application is found, the version number (for example, 2) marked in the local data queue is determined as the front-end data version number; when the local data queue of the online application is not found, a local data queue is created for the online application, and version number 0 is marked in the local data queue, and then version number 0 is determined as the front-end data version number.
[0046] The above steps 2011 to 2012 are Figure 1 The specific refinement of step 101 is shown.
[0047] Step 202: Send the front-end data version number to the back-end device of the online application, so that the back-end device determines the changed data information according to the front-end data version number and the back-end data version number of the online application recorded by the back-end device, and returns the changed data information and the back-end data version number;
[0048] In this embodiment, when the front-end data version number is the same as the back-end data version number recorded by the back-end device, it means that no data change has occurred. In this case, empty change data information or no information can be returned. When the front-end data version number is greater than the back-end data version number recorded by the back-end device and is the same, it means that the local data version is higher than the back-end data version in the back-end device, so it does not need to be updated. In this case, empty data change information or no information can be returned. When the front-end data version number is less than the back-end data version number recorded by the back-end device and is the same, it means that the local data version is lower than the back-end data version in the back-end device. At this time, whether there is data change information based on the version after the front-end data version number, if so, these data change information can be collected and returned to the front-end device.
[0049] Step 2031: Receive the changed data information and backend data version number returned by the backend device, and clean and rebuild the local data of the online application according to the changed data information;
[0050] Step 2032: Update the version number marked in the local data queue of the online application to the backend data version number.
[0051] The above step 2032 is Figure 1 The specific details of "updating the local data version number of the online application to the backend data version number" in step 103 are shown.
[0052] The above steps 2031 to 2032 are Figure 1 The specific refinement of step 103 is shown.
[0053] In this embodiment, the local data of the online application is cleaned and rebuilt according to the changed data information, so that the local data version and the back-end data version in the back-end device are consistent. Therefore, after data cleaning and reconstruction, the front-end data version number is updated to be consistent with the back-end data version number recorded in the back-end device.
[0054] from Figure 2The illustrated method can be viewed as follows: in this embodiment, after the online application is started, the version number marked in the online application's local data queue is determined as the front-end data version number, and the front-end data version number is sent to the online application's back-end device. The back-end device then determines the changed data information based on the front-end data version number and the back-end data version number of the online application recorded by the back-end device, and returns the changed data information and the back-end data version number. The front-end device can then clean and rebuild the local data of the online application based on the changed data information and update the front-end data version number of the online application to the back-end data version number. Because this method is executed each time the online application is started, changes in the version number can be detected in a timely manner, allowing local data to be cleaned and rebuilt accordingly. This allows for the timely cleaning of useless data, reducing the waste of storage resources and the impact on the use of useful data.
[0055] See also Figure 3 、 Figure 3 This is a flow chart of a local data management method for online applications according to a third embodiment of the present invention. This method is applied to a front-end device for online applications, such as Figure 3 As shown, the following steps are included:
[0056] Step 3011: After the online application is started, the local data queue of the online application is searched. If the local data queue of the online application is not found, a local data queue is created for the online application, and the version number 0 is marked in the created local data queue.
[0057] In this embodiment, any local data in the local data queue of the online application is stored using a key-value pair.
[0058] Step 3012: Determine the version number marked in the local data queue of the online application as the front-end data version number of the online application;
[0059] In this embodiment, when the local data queue of the online application is found, the version number (for example, 2) marked in the local data queue is determined as the front-end data version number; when the local data queue of the online application is not found, a local data queue is created for the online application, and version number 0 is marked in the local data queue, and then version number 0 is determined as the front-end data version number.
[0060] The above steps 3011 to 3012 are Figure 1 The specific refinement of step 101 is shown.
[0061] Step 302: Send the front-end data version number to the back-end device of the online application, so that the back-end device determines the changed data information according to the front-end data version number and the back-end data version number of the online application recorded by the back-end device, and returns the changed data information and the back-end data version number;
[0062] In this embodiment, the changed data information includes the changed Key.
[0063] In this embodiment, in the backend device of the online application, each time a version of the backend data of the online application is updated, the changed data information corresponding to the version, specifically the changed Key, is recorded.
[0064] Step 3031: Receive the changed data information and backend data version number returned by the backend device;
[0065] Step 3032: For each changed key included in the changed data information, search for data containing the key in the local data queue of the online application, and delete the found data;
[0066] Step 3033: For each changed key contained in the changed data information, request the backend device for data containing the key. If the data containing the key is found, add the requested data to the local data list of the online application.
[0067] In this embodiment, if the request for data containing the key from the back-end device fails, that is, the data containing the key is not requested, it means that the data containing the key is invalid and becomes useless data, and the key can be discarded. Since the data containing the key has been deleted in step 3032, the data containing the key can be completely cleaned up.
[0068] The above steps 3032 to 3033 are Figure 1 The detailed description of "cleaning and rebuilding the local data of the online application according to the changed data information" in step 103 is shown.
[0069] Step 3034: Update the front-end data version number of the online application to the back-end data version number.
[0070] The above steps 3031 to 3034 are Figure 1 The specific refinement of step 103 is shown.
[0071] from Figure 3The illustrated method can be viewed as follows: in this embodiment, after the online application is started, the version number marked in the online application's local data queue is determined as the front-end data version number, and the front-end data version number is sent to the online application's back-end device. The back-end device then determines and returns change data information based on the front-end data version number and the back-end data version number of the online application recorded by the back-end device. The front-end device can then clean up and rebuild the local data of the online application based on the key for each change contained in the change data information, and update the front-end data version number of the online application to the back-end data version number. Because this method is executed each time the online application is started, changes in the version number can be detected promptly, allowing local data to be cleaned up and rebuilt accordingly. This allows for the timely cleaning of useless data, reducing the waste of storage resources and the impact on the use of useful data.
[0072] See also Figure 4 ,, Figure 4 This is a flow chart of a local data management method for online applications according to a fourth embodiment of the present invention. This method is applied to a front-end device for online applications, such as Figure 1 As shown, the following steps are included:
[0073] Step 401: After the online application is started, the front-end data version number of the online application is determined;
[0074] Step 402: Send the front-end data version number to the back-end device of the online application, so that the back-end device determines the changed data information according to the front-end data version number and the back-end data version number of the online application recorded by the back-end device, and returns the data change information and the back-end data version number;
[0075] Step 403: Receive the changed data information and backend data version number returned by the backend device, clean up and rebuild the local data of the online application according to the changed data information, and update the frontend data version number of the online application to the backend data version number.
[0076] The above steps 401 to 403 are Figure 1 The implementation principles of steps 101 to 103 are the same and will not be repeated here.
[0077] In actual applications, when a user requests business data, a business data request is triggered. Upon receiving this business data request, the online application's front-end device first determines whether the requested data exists. If so, it directly returns the requested data. If not, it requests the data from the online application's back-end device and returns the requested data to the user. This process involves querying and adding data. In this embodiment, the following steps 404 to 406 are used to store and maintain the data involved.
[0078] Step 404: Receive a service data request from the user and determine whether the data requested by the user exists in the local data queue. If the data requested by the user exists in the local data queue, execute step 405. If the data requested by the user does not exist in the local data queue, execute step 406.
[0079] Step 405: Adjust the data requested by the user to the head position of the local data queue;
[0080] In this embodiment, according to the LRU algorithm, the data most recently accessed by the user is placed at the head of the local data queue, which allows the data that is not frequently accessed to gradually move to the tail of the local data queue.
[0081] Step 406: Request the data from the backend device and add the requested data to the head of the local data queue. If the length of the local data queue exceeds the preset queue length threshold, delete the data exceeding the preset queue length threshold from the tail of the local data queue.
[0082] In this embodiment, when the data in the local data queue reaches the storage upper limit of the local data queue, the tail data in the local data queue is deleted first. The tail data in the local data queue is data that is not frequently accessed or data that has not been accessed recently.
[0083] from Figure 4 The illustrated method can be viewed as follows: in this embodiment, after the online application is launched, the front-end data version number of the online application is sent to the back-end device of the online application. The back-end device determines the changed data information based on the front-end data version number and the back-end data version number of the online application recorded by the back-end device, and returns the changed data information and the back-end data version number. The front-end device can then clean up and rebuild the local data of the online application based on the changed data information and update the front-end data version number of the online application to the back-end data version number. Furthermore, data in the local data queue is repositioned and deleted based on user access to data, so that the most recently or most frequently accessed data is stored at the head of the local data queue, thereby reducing the possibility of valid data being squeezed out of the local data queue and thus reducing the impact on the use of useful data. Because this method is executed each time the online application is launched, changes in data versions can be detected promptly, allowing local data to be cleaned and rebuilt accordingly, thereby promptly clearing useless data, reducing storage resource waste and the impact on the use of useful data.
[0084] See also Figure 5 , Figure 5 This is a flow chart of a method for managing local data of an online application according to a fifth embodiment of the present invention. This method is applied to a back-end device of an online application, such as Figure 5 As shown, the following steps are included:
[0085] Step 501: Receive the front-end data version number of the online application sent by the front-end device after the online application is started;
[0086] Step 502: Compare the received front-end data version number with the back-end data version number of the online application recorded by the back-end device. If the former is smaller than the latter, execute step 503; otherwise, execute step 504.
[0087] In this embodiment, when the front-end data version number is the same as the back-end data version number recorded by the back-end device, it means that no data change has occurred. In this case, empty change data information or no information can be returned. When the front-end data version number is greater than the back-end data version number recorded by the back-end device and is the same, it means that the local data version is higher than the back-end data version in the back-end device, so it does not need to be updated. In this case, empty data change information or no information can be returned. When the front-end data version number is less than the back-end data version number recorded by the back-end device and is the same, it means that the local data version is lower than the back-end data version in the back-end device. At this time, whether there is data change information based on the version after the front-end data version number, if so, these data change information can be collected and returned to the front-end device.
[0088] Step 503: Collect the change data information corresponding to each version number recorded by the backend device that is higher than the frontend data version number, and go to step 505;
[0089] In this embodiment, in the backend device of the online application, each time the backend data of the online application is updated to a new version, the change data information corresponding to the new version will be recorded. When it is determined that the backend data version number is greater than the frontend data version number, the change data information corresponding to each version number higher than the frontend data version number can be collected and returned to the frontend device.
[0090] Step 504: Send the empty change data information to the front-end device.
[0091] In this embodiment, after the empty change data information is sent to the front-end device, the front-end device will not clean up or rebuild the local data, nor will it update the front-end data version number.
[0092] In this embodiment, when the backend device determines that the frontend data version number is not less than the backend data version number, it may not return any information, so that the frontend device will not clean up and rebuild the local data, nor will it update the frontend data version number.
[0093] Step 506: Send the collected change data information and the backend data version number to the front-end device, so that the front-end device cleans and rebuilds the local data of the online application according to the received change data information, and updates the front-end data version number of the online application to the back-end data version number.
[0094] from Figure 5 The illustrated method can be viewed as follows: in this embodiment, after an online application is started, the online application's front-end data version number is sent to the online application's back-end device. Based on the front-end data version number and the back-end data version number of the online application recorded by the back-end device, the back-end device determines change data information and returns the change data information and back-end data version number. The front-end device can then clean up and rebuild the online application's local data based on the change data information and update the online application's front-end data version number to the back-end data version number. Because this method is executed each time the online application is started, version number changes can be promptly detected, allowing local data to be cleaned up and rebuilt accordingly. This allows for the timely removal of useless data, reducing storage resource waste and the impact on the use of useful data.
[0095] The embodiment of the present invention also provides a local data management device for online applications, which is applied to the front-end equipment of online applications, such as Figure 6 As shown, the device includes:
[0096] Determining unit 601, used to determine the front-end data version number of the online application after the online application is started;
[0097] The transceiver unit 602 is configured to send the front-end data version number to the back-end device of the online application, so that the back-end device determines the changed data information based on the front-end data version number and the back-end data version number of the online application recorded by the back-end device and returns the changed data information and the back-end data version number; and is configured to receive the changed data information and the back-end data version number returned by the back-end device;
[0098] The processing unit 603 is configured to clean up and rebuild the local data of the online application according to the changed data information, and update the front-end data version number of the online application to the back-end data version number.
[0099] Figure 6 In the device shown,
[0100] The determining unit 601 determines the front-end data version number of the online application, including:
[0101] Search for the local data queue of the online application. If no local data queue is found for the online application, create a local data queue for the online application and mark the created local data queue with version 0.
[0102] Determine the version number marked in the local data queue of the online application as the front-end data version number of the online application;
[0103] The processing unit 603 updates the front-end data version number of the online application to the back-end data version number, including:
[0104] The version number marked in the local data queue of the online application is updated to the backend data version number.
[0105] Figure 6 In the device shown,
[0106] Any local data in the local data queue of an online application is stored using key-value pairs;
[0107] The changed data information includes the changed Key;
[0108] The processing unit 603 cleans and rebuilds the local data of the online application according to the changed data information, including:
[0109] For each changed key contained in the changed data information, search for data containing the key in the local data queue of the online application and delete the found data;
[0110] For each changed key contained in the changed data information, a request is made to the backend device for data containing the key. If the data containing the key is found, the found data is added to the local data list of the online application.
[0111] Figure 6 In the device shown,
[0112] The transceiver unit 602 is further configured to: receive a service data request from a user;
[0113] The processing unit 603 is further used to determine whether the user-requested data exists in the local data queue after the transceiver unit 602 receives the user's business data request. When the user-requested data exists in the local data queue, the user-requested data is adjusted to the head position of the local data queue; when the user-requested data does not exist in the local data queue, the back-end device is requested for the data, and the requested data is added to the head position of the local data queue. If the length of the local data queue exceeds the preset queue length threshold, the data exceeding the preset queue length threshold is deleted from the tail of the local data queue.
[0114] The embodiment of the present invention also provides another local data management device for online applications, which is applied to the back-end equipment of online applications, such as Figure 7 As shown, the device includes:
[0115] The transceiver unit 701 is configured to receive the front-end data version number of the online application sent by the front-end device after the online application is started; and to transmit the change data information collected by the processing unit 702 and the back-end data version number of the online application recorded by the back-end device to the front-end device, so that the front-end device cleans and rebuilds the local data of the online application based on the received change data information, and updates the front-end data version number of the online application to the back-end data version number.
[0116] The processing unit 702 is used to compare the front-end data version number received by the transceiver unit 701 with the back-end data version number. If the former is smaller than the latter, the change data information corresponding to each version number recorded by the back-end device that is higher than the front-end data version number is collected.
[0117] The embodiment of the present invention further provides an electronic device, such as Figure 8 As shown, the electronic device includes a processor 801 and a memory 802;
[0118] The memory 802 stores one or more computer programs that can be executed by the processor 801; when the processor 801 executes the one or more computer programs, the following is achieved: Figure 1-5 The steps in the local data management method for online applications shown in any of the flowcharts.
[0119] The embodiment of the present invention further provides a non-transient computer-readable storage medium, wherein the non-transient computer-readable storage medium stores instructions, wherein the instructions, when executed by a processor, enable the processor to implement the following Figure 1-5 The steps in the local data management method for online applications shown in any of the flowcharts.
[0120] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A local data management method for online applications, applied to the front-end device of online applications, characterized in that: The method includes: After the online application is started, determine the front-end data version number of the online application; Sending the front-end data version number to a back-end device of the online application, so that the back-end device determines the changed data information according to the front-end data version number and the back-end data version number of the online application recorded by the back-end device, and returns the changed data information and the back-end data version number; Receive the changed data information and backend data version number returned by the backend device, clean up and rebuild the local data of the online application according to the changed data information, and update the frontend data version number of the online application to the backend data version number; any local data in the local data queue of the online application is stored using a key-value pair, the changed data information includes the changed key, and the local data queue contains the data of the key; the most recently or most frequently accessed data is stored at the head of the local data queue; The method further comprises: Receive the user's business data request and determine whether the data requested by the user exists in the local data queue; When the data requested by the user exists in the local data queue, the data requested by the user is adjusted to the head position of the local data queue; When the data requested by the user does not exist in the local data queue, the backend device is requested to process the data, and the requested data is added to the head of the local data queue. If the length of the local data queue exceeds a preset queue length threshold, the data exceeding the preset queue length threshold is deleted from the tail of the local data queue. Cleaning and rebuilding the local data of the online application based on the changed data information includes: For each changed key contained in the changed data information, search for data containing the key in the local data queue of the online application and delete the found data; For each changed key contained in the changed data information, the backend device is requested for data containing the key. If the data containing the key is obtained, the requested data is added to the local data list of the online application.
2. The method according to claim 1, characterized in that Determine the front-end data version number of the online application, including: Search for the local data queue of the online application. If no local data queue is found for the online application, create a local data queue for the online application and mark the created local data queue with version 0. Determine the version number marked in the local data queue of the online application as the front-end data version number of the online application; Updating the front-end data version number of the online application to the back-end data version number includes: The version number marked in the local data queue of the online application is updated to the backend data version number.
3. A local data management method for online applications, applied to the back-end device of online applications, characterized in that: The method includes: Receive the front-end data version number of the online application sent by the front-end device of the online application after the online application is started; Comparing the received front-end data version number with the back-end data version number of the online application recorded by the back-end device; If the former is less than the latter, then collect the change data information corresponding to each version number recorded by the back-end device that is higher than the front-end data version number, and send the collected change data information and the back-end data version number to the front-end device, so that the front-end device cleans up and rebuilds the local data of the online application according to the received change data information, and updates the front-end data version number of the online application to the back-end data version number; any local data in the local data queue of the online application is stored using a key-value pair, the change data information includes the changed key, and the local data queue contains the data of the key; the most recently or most frequently accessed data is stored at the head of the local data queue; The method further includes: sending the data requested by the front-end device to the front-end device; wherein the front-end device receives the service data request of the user and determines whether the data requested by the user exists in the local data queue; when the data requested by the user exists in the local data queue, the front-end device adjusts the data requested by the user to the head position of the local data queue; when the data requested by the user does not exist in the local data queue, the front-end device requests the data from the back-end device and adds the requested data to the head position of the local data queue, and if the length of the local data queue exceeds a preset queue length threshold, deleting the data exceeding the preset queue length threshold from the tail of the local data queue; Clean up and rebuild the local data of the online application based on the received change data information, including: For each changed key contained in the changed data information, search for data containing the key in the local data queue of the online application and delete the found data; For each changed key contained in the changed data information, the backend device is requested for data containing the key. If the data containing the key is obtained, the requested data is added to the local data list of the online application.
4. A local data management device for online applications, applied to the front-end equipment of online applications, characterized in that: The device includes: A determination unit, used to determine the front-end data version number of the online application after the online application is started; a transceiver unit, configured to send the front-end data version number to a back-end device of an online application, so that the back-end device determines the changed data information based on the front-end data version number and the back-end data version number of the online application recorded by the back-end device, and returns the changed data information and the back-end data version number; and to receive the changed data information and the back-end data version number returned by the back-end device; a processing unit configured to clean and rebuild the local data of the online application based on the changed data information, and update the front-end data version number of the online application to the back-end data version number; any local data in the local data queue of the online application is stored using a key-value pair, the changed data information includes the changed key, and the local data queue contains the data for the key; the most recently or most frequently accessed data is stored at the head of the local data queue; The transceiver unit is further configured to: receive a service data request from a user; The processing unit is further configured to, after the transceiver unit receives the user's service data request, determine whether the user-requested data exists in the local data queue; if the user-requested data exists in the local data queue, adjust the user-requested data to the head of the local data queue; if the user-requested data does not exist in the local data queue, request the data from the back-end device and add the requested data to the head of the local data queue; and if the length of the local data queue exceeds a preset queue length threshold, delete the data exceeding the preset queue length threshold from the tail of the local data queue; The processing unit cleans and rebuilds the local data of the online application according to the changed data information, including: For each changed key contained in the changed data information, search for data containing the key in the local data queue of the online application and delete the found data; For each changed key contained in the changed data information, a request is made to the backend device for data containing the key. If the data containing the key is found, the found data is added to the local data list of the online application.
5. The device according to claim 4, characterized in that The determining unit determines the front-end data version number of the online application, including: Search for the local data queue of the online application. If no local data queue is found for the online application, create a local data queue for the online application and mark the created local data queue with version 0. Determine the version number marked in the local data queue of the online application as the front-end data version number of the online application; The processing unit updates the front-end data version number of the online application to the back-end data version number, including: The version number marked in the local data queue of the online application is updated to the backend data version number.
6. A local data management device for online applications, applied to back-end equipment of online applications, characterized in that: The device includes: The transceiver unit is configured to receive the front-end data version number of the online application sent by the front-end device after the online application is started; and to transmit the change data information collected by the processing unit and the back-end data version number of the online application recorded by the back-end device to the front-end device, so that the front-end device cleans and rebuilds the local data of the online application based on the received change data information, and updates the front-end data version number of the online application to the back-end data version number. Any local data in the local data queue of the online application is stored using a key-value pair. The change data information includes the changed key, and the local data queue contains the data of the key. The most recently or most frequently accessed data is stored at the head of the local data queue. a processing unit configured to compare the front-end data version number received by the transceiver unit with the back-end data version number, and if the former is smaller than the latter, collect change data information corresponding to each version number recorded by the back-end device that is higher than the front-end data version number; The transceiver unit is further configured to send the data requested by the front-end device to the front-end device; wherein the front-end device receives a service data request from a user and determines whether the data requested by the user exists in a local data queue; when the data requested by the user exists in the local data queue, the front-end device adjusts the data requested by the user to the head position of the local data queue; when the data requested by the user does not exist in the local data queue, the front-end device requests the data from the back-end device and adds the requested data to the head position of the local data queue; if the length of the local data queue exceeds a preset queue length threshold, the data exceeding the preset queue length threshold is deleted from the tail of the local data queue; For each changed key contained in the changed data information, search for data containing the key in the local data queue of the online application and delete the found data; For each changed key contained in the changed data information, a request is made to the backend device for data containing the key. If the data containing the key is found, the found data is added to the local data list of the online application.
7. An electronic device, characterized in that: The electronic device includes a processor and a memory; The memory stores one or more computer programs that can be executed by the processor; when the processor executes the one or more computer programs, it implements the steps of the local data management method for online applications as described in claim 1 or 2, or implements the steps of the local data management method for online applications as described in claim 3.
8. A non-transitory computer-readable storage medium storing instructions, characterized in that: When the instructions are executed by a processor, the processor implements the steps in the local data management method for online applications according to claim 1 or 2, or implements the steps in the local data management method for online applications according to claim 3.
Citation Information
Patent Citations
Method and device for implementation of automatic online updating of application program
CN102591685A
System and method for automatically setting applet latest version
US6874142B1