A method and device for updating data

By using the pipeline model to create a new data cache in a large application system, the problem of abnormal return results during the cache data update process is solved, and the data update speed and efficiency are improved.

CN113779082BActive Publication Date: 2024-09-20BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110009562.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-05
Publication Date
2024-09-20
Estimated Expiration
2041-01-05

AI Technical Summary

Technical Problem

In large application systems, the update process of cached data takes a long time due to the item-by-item update method, and abnormal data is generated due to network or application reasons during the update process, resulting in abnormal query return results and taking a long time.

Method used

By creating a new data cache, using the pipeline model to write the target cache data to be updated obtained from the data source into the new data cache, and the old cache provides the return data of the query request before deleting the old data cache, overcoming the data dynamics Changes result in abnormal return results and increase data update speed.

Benefits of technology

It provides correct query return data during the data update process, reduces the risk of abnormal data, increases the speed of data update, and solves the problem of abnormal data during the update process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113779082B
    Figure CN113779082B
Patent Text Reader

Abstract

The present invention discloses a method and device for updating data, and relates to the field of computer technology. A specific implementation of the method includes: by creating a new data cache, using a pipeline model to write the target cache data to be updated obtained from a data source into the new data cache, and deleting the old data cache to complete the data update; when receiving a data query request, before the update of the data is completed, the old cache data provides the return data of the query request, thereby overcoming the abnormal return result caused by the dynamic change of data during the data update process; at the same time, the pipeline model is used to update the data, thereby improving the speed of data update, thereby overcoming the problem of abnormal data generated during the data update process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for updating data. Background Art

[0002] In large-scale application systems, a combination of cache and data source is usually used. The cache receives and processes data query requests to improve data access efficiency, thereby improving the performance and efficiency of the application system, and also improving the stability and fault tolerance of the application system data. In order to synchronize the data in the cache and the data source, the cache often needs to be updated regularly.

[0003] Currently, in the cache, when a large amount of data, numbering in the millions or tens of millions, needs to be updated, the update process usually takes a while because the data is updated one by one. Before the update is completed, there is a problem of abnormal data returned by querying the cache. In addition, due to the long update time, during the update process, if a large amount of abnormal data appears due to network or application reasons, it needs to be checked and repaired one by one, which takes a long time. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a method and device for updating data, which can create a new data cache, write the target cache data to be updated obtained from the data source into the new data cache by using a pipeline model, and delete the old data cache to complete the data update; when receiving a query request, before deleting the old data cache (that is, before the update of the data is completed), the old cache data provides the return data of the query request, thereby overcoming the abnormal return result caused by the dynamic change of data in the process of updating data; at the same time, the pipeline model is used to update the data, which improves the speed of data updating, thereby overcoming the problem of abnormal data generated in the process of updating data.

[0005] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present invention, a method for updating data is provided, characterized in that it includes: determining the first cache data corresponding to the current cache data identifier based on a received request to update the current cache data, determining the first data source corresponding to the first cache data, the first data source containing the updated target cache data; creating second cache data, and using a pipeline model, writing the target cache data contained in the first data source into the second cache data; deleting the first cache data, and associating the second cache data with the current cache data identifier.

[0006] Optionally, the method for updating data is characterized in that:

[0007] Determining a first data source corresponding to first cache data, wherein the first data source includes updated target cache data, further comprising: determining an original data source corresponding to the first data source, wherein the first data source obtains the updated target cache data from the original data source.

[0008] Optionally, the method for updating data is characterized in that:

[0009] The first data source obtains the updated target cache data from the original data source, and also includes: the first data source obtains the target cache data through at least one of the original data sources, and composes the target cache data according to partial data and / or full data provided by the original data source.

[0010] Optionally, the method for updating data is characterized in that:

[0011] The first data source obtains the updated target cache data from the original data source, and also includes: if the original data source receives incremental data after the first data source obtains the full data of the original data source, the first data source obtains the incremental data through a message queue.

[0012] Optionally, the method for updating data is characterized in that:

[0013] The method comprises: after deleting the first cache data, when receiving a request to query the current cache data, determining the second cache data associated with the current cache data identifier, and obtaining return data corresponding to the query request from the second cache data.

[0014] Optionally, the method for updating data is characterized in that:

[0015] Deleting the first cache data also includes: before deleting the first cache data, when receiving a request to query the current cache data, determining the first cache data associated with the current cache data identifier, and obtaining return data corresponding to the query request from the first cache data.

[0016] Optionally, the method for updating data is characterized in that:

[0017] Deleting the first cache data and associating the second cache data with the current cache data identifier includes: storing the current cache identifier and a corresponding value, and after deleting the first cache data, storing the identifier of the second cache data as the corresponding value of the current cache data identifier.

[0018] To achieve the above object, according to a second aspect of an embodiment of the present invention, a device for updating data is provided, characterized in that it comprises: a processing update request module and a data update execution module; wherein,

[0019] The update request processing module is used to determine the first cache data corresponding to the current cache data identifier according to the received cache data update request; determine the first data source corresponding to the first cache data, the first data source contains the updated target cache data;

[0020] The execution data update module is used to create second cache data, write the target cache data contained in the first data source into the second cache data using a pipeline model; delete the first cache data, and associate the second cache data with the current cache data identifier.

[0021] Optionally, the device for updating data is characterized in that:

[0022] Determining a first data source corresponding to first cache data, wherein the first data source includes updated target cache data, further comprising: determining an original data source corresponding to the first data source, wherein the first data source obtains the updated target cache data from the original data source.

[0023] Optionally, the device for updating data is characterized in that:

[0024] The first data source obtains the updated target cache data from the original data source, and also includes: the first data source obtains the target cache data through at least one of the original data sources, and composes the target cache data according to partial data and / or full data provided by the original data source.

[0025] Optionally, the device for updating data is characterized in that:

[0026] The first data source obtains the updated target cache data from the original data source, and also includes: if the original data source receives incremental data after the first data source obtains the full data of the original data source, the first data source obtains the incremental data through a message queue.

[0027] Optionally, the device for updating data is characterized in that:

[0028] The method comprises: after deleting the first cache data, when receiving a request to query the current cache data, determining the second cache data associated with the current cache data identifier, and obtaining return data corresponding to the query request from the second cache data.

[0029] Optionally, the device for updating data is characterized in that:

[0030] Deleting the first cache data also includes: before deleting the first cache data, when receiving a request to query the current cache data, determining the first cache data associated with the current cache data identifier, and obtaining return data corresponding to the query request from the first cache data.

[0031] Optionally, the device for updating data is characterized in that:

[0032] Deleting the first cache data and associating the second cache data with the current cache data identifier includes: storing the current cache identifier and a corresponding value, and after deleting the first cache data, storing the identifier of the second cache data as the corresponding value of the current cache data identifier.

[0033] To achieve the above-mentioned purpose, according to the third aspect of an embodiment of the present invention, there is provided an electronic device for updating data, characterized in that it comprises: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement any of the methods described in the above-mentioned methods for updating data.

[0034] To achieve the above-mentioned purpose, according to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, characterized in that when the program is executed by a processor, any method described in the above-mentioned method for updating data is implemented.

[0035] An embodiment of the above invention has the following advantages or beneficial effects: by creating a new data cache, the target cache data to be updated obtained from the data source is written into the new data cache using a pipeline model, and the old data cache is deleted to complete the data update; when a query request is received, before the old data cache is deleted (i.e., before the data update is completed), the old cache data provides the return data of the query request, thereby overcoming the abnormal return result caused by the dynamic change of data during the data update process; at the same time, the pipeline model is used to update the data, which improves the speed of data update, thereby overcoming the problem of abnormal data generated during the data update process.

[0036] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0038] Figure 1It is a flowchart of a method for updating data provided by an embodiment of the present invention;

[0039] Figure 2 It is a schematic diagram of a process of updating cache data provided by an embodiment of the present invention;

[0040] Figure 3 It is a schematic diagram of a process of querying cache data provided by an embodiment of the present invention;

[0041] Figure 4 is a schematic diagram of the structure of a device for updating data provided by an embodiment of the present invention;

[0042] Figure 5 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0043] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0044] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0045] like Figure 1 As shown, an embodiment of the present invention provides a method for updating data, which may include the following steps:

[0046] Step S101: according to a received request for updating cache data, determining first cache data corresponding to a current cache data identifier; determining a first data source corresponding to the first cache data, wherein the first data source includes updated target cache data.

[0047] Specifically, in an application system, it is usually necessary to regularly update cache data to ensure data consistency. When a request to update cache data is received, first determine the first cache data corresponding to the current cache data identifier; the first cache data is, for example, Redis (Remote Dictionary Server) cache data, and the present invention uses Redis as a tool for executing cache; and, optionally, the first cache data is stored in a hash table data structure.

[0048] Furthermore, the current cache identifier and the corresponding value are obtained, wherein, for example, the current cache data identifier and the corresponding value are stored in the form of a key-value pair, and the present invention does not limit the specific format and content of the current cache data identifier and the corresponding value. In the following example key-value pair <"current-data-key":"userinfo-12345-2019">, current-data-key is the current cache data identifier; userinfo-12345-2019 is the corresponding first cache data. When a request to update the cache data is received, it is determined that the first cache data corresponding to the current cache data identifier is userinfo-12345-2019; userinfo-12345-2019 is the identifier of the first cache data. In the description below, "userinfo-12345-2019" represents the first cache data. For example, "userinfo-12345-2019" represents a data table with a hash table structure. The present invention does not limit the specific content of the first cache data (identifier); further, a first data source corresponding to the first cache data is obtained, and data to be updated (i.e., target cache data) is obtained from the first data source; that is, the first data source contains the updated target cache data.

[0049] Furthermore, the first data source may be metadata, which has a corresponding original data source (e.g., MySQL database, etc.), and metadata is data about data, which generally corresponds to structured data (e.g., MySQL database, etc.). Using metadata to describe data resources is conducive to providing flexible retrieval for resources and data exchange between different systems, etc. The standards and usage methods of metadata are prior art, and the present invention will not elaborate on metadata. Further, the original data source includes target cache data, that is, the original data source corresponding to the first data source is determined, and the first data source obtains the updated target cache data from the original data source; further, the original data source can be one or more, for example: the original data source A provides full data, the original data source B provides partial data, and the original data source (which can also be an incremental data source) C provides incremental data; it can be understood that the number of data of the target cache data and the number of existing data in the first cache data may be inconsistent; the overlap between the content of the target cache data and the existing data content in the first cache data may be 0% to 100%; that is, the first data source obtains the target cache data through at least one of the original data sources, and forms the target cache data according to the partial data and / or full data provided by the original data source; the original data source provides any one or more of partial data and full data (that is, all data contained in the original data source); the target cache data is formed according to the partial and / or full data. In addition, after the original data source provides the full data, new incremental data is received, and the incremental data needs to be cached, the first data source obtains the incremental data through the message queue, that is, if the original data source receives incremental data after the first data source obtains the full data of the original data source, the first data source obtains the incremental data through the message queue; this method can ensure that during the synchronization between the first data source and the original data source, data inconsistencies caused by the original data source receiving new data can be avoided.

[0050] Step S102: create second cache data, write the target cache data contained in the first data source into the second cache data by using a pipeline model; delete the first cache data, and use the second cache data as the current cache data.

[0051] Specifically, as described in step S101, after obtaining the target cache data, data update is performed, and the second cache data is first created. For example: the second cache data is identified as "userinfo-12345-2020". In the description below, "userinfo-12345-2020" represents the second cache data. The identifier can be dynamically generated according to the set rules. Preferably, the content of the first cache data identifier is combined with the current time information, etc. The present invention does not limit the specific content of the second cache data identifier; in this application, the first cache data indicates the old cache data to be updated, and the second cache data is the newly created cache data containing updated data.

[0052] Furthermore, the pipeline model is used to write the target cache data into the second cache data (userinfo-12345-2020), wherein the pipeline model is implemented through pipeline technology, which can send multiple commands at one time and return the results at one time after execution, thereby reducing the round-trip delay time by reducing the number of communications between the client and Redis, and the principle of pipeline technology is queue, thereby ensuring the order of data; it is particularly suitable for the transmission of massive data, for example: when the data volume is 100,000 or 1 million, the data update can be completed instantly (microseconds or milliseconds); the pipeline model can be used to update data using the following example function method: Pipeline.hMSet("userinfo-12345-2020", "identification of target cache data"); it can be seen that the use of the pipeline model, compared with the existing method of updating the first cache data (when updating the first cache data, the database writing method is used to update the data one by one), improves the speed of updating data.

[0053] Furthermore, after completing the data update (writing) of the second cache data, the first cache data is deleted, and the second cache data is used as the current cache data; for example, in the key-value pair example of step S101, <"current-data-key":"userinfo-12345-2019">, userinfo-12345-2019 is the first cache data; in this step, after the cache data is updated, userinfo-12345-2019 is deleted to release space and resources, and further, the second cache data is used as the current cache data, that is, the value of the key-value pair is set to <"current-data-key":"userinfo-12345-2020">; that is, the current cache identifier and the corresponding value are stored, and after deleting the first cache data, the identifier of the second cache data is stored as the associated value of the current cache data identifier.

[0054] Furthermore, in the process of executing the above cache data update, when a data query request is received, the method for processing the request is as follows:

[0055] 1) Before deleting the first cache data, when receiving a request to query the current cache data, determine the first cache data associated with the current cache data identifier, and obtain the return data corresponding to the request from the first cache data. Specifically, when the first cache data is deleted, it means that the cache data update has been completed. On the contrary, during the cache data update process, a data query request for the current cache data is received (for example: the request contains current-data-key), and the corresponding relationship of "current-data-key":"userinfo-12345-2019" is used to determine that the current cache data being queried is the first cache data, and then the first cache data (userinfo-12345-2019) is used to provide return data. Since there is no read and write operation and data change on the first cache data during the update process, the correctness of the returned data is improved and the risk of data anomalies is reduced.

[0056] 2) After deleting the first cached data, when receiving a request to query the current cached data, determine the second cached data associated with the current cached data identifier, and obtain the return data corresponding to the query request from the second cached data. Specifically, after deleting the first cached data (that is, the update of the cached data has been completed), if a request to query the current cached data (for example: the request contains current-data-key) is received, the corresponding relationship of <"current-data-key":"userinfo-12345-2020"> is used to determine that the current cached data being queried is the second cached data, and the second cached data (for example: userinfo-12345-2020) is used to provide return data.

[0057] like Figure 2 As shown, an embodiment of the present invention provides a method for updating cache data, which may include the following steps:

[0058] Step S201: receiving a request to update current cache data.

[0059] Specifically, according to the received request to update the current cache data, the first cache data corresponding to the current cache data identifier is determined; the specific description of determining the first cache data corresponding to the current cache data identifier is consistent with the description of step S101 and is not repeated here.

[0060] Step S202: Determine target cache data corresponding to the first cache data.

[0061] Specifically, a first data source corresponding to the first cache data is determined, the first data source includes updated target cache data; wherein an original data source corresponding to the first data source is obtained, and the first data source obtains the updated target cache data from the original data source. The description of the first data source and the corresponding original data source is consistent with the description of step S101, and will not be repeated here.

[0062] Step S203: The first data source obtains the full amount of data from the original data source.

[0063] Specifically, the first data source obtains the full amount of data from the original data source as part of the target cache data, that is, the first data source obtains the target cache data through at least one of the original data sources, and forms the target cache data based on the partial data and / or full amount of data provided by the original data source. Specifically, the description of obtaining full amount of data and partial data from the original data source is consistent with the description of step S101, and will not be repeated here.

[0064] Step S204: the first data source obtains incremental data from the incremental data source.

[0065] Specifically, if the original data source receives incremental data after the first data source obtains the full data of the original data source, the first data source obtains the incremental data through the message queue. The description of incremental data is consistent with the description of step S101 and is not repeated here.

[0066] Step S205: writing the target cache data into the second cache data to complete updating the cache data.

[0067] Specifically, the second cache data is created, and the target cache data contained in the first data source is written into the second cache data using a pipeline model. The description of creating the second cache data and writing the cache data is consistent with the description of step S102, and will not be repeated here.

[0068] Step S206: Delete the first cache data, and associate the second cache data with the current cache data identifier.

[0069] Specifically, the specific description of associating the second cache data with the current cache data identifier is consistent with the description of step S102, and is not repeated here.

[0070] like Figure 3 As shown, an embodiment of the present invention provides a method for querying cache data, which may include the following steps:

[0071] Step S301: receiving a request for querying current cache data.

[0072] Specifically, a request for current cached data is received, and the identifier of the cached data that provides return data for the request is determined based on the value corresponding to the identifier of the current cached data; the description of the association between the current cached data identifier and the first cached data or the second cached data is consistent with the description of step S101 and will not be repeated here.

[0073] Step S302: before and during data update, obtaining return data from the first cache data.

[0074] Specifically, before data is updated and during data update (i.e., before deleting the first cached data), when a request to query the current cached data is received, the first cached data associated with the current cached data identifier is determined, and return data corresponding to the request is obtained from the first cached data. The description of processing cached data query requests before and during data update is consistent with the description of step S102 and will not be repeated here.

[0075] Step S303: after the data is updated, the return data is obtained from the second cache data.

[0076] Specifically, after the data update is completed, the first cache data is deleted, and the second cache data is associated with the current cache data identifier, including: storing the current cache identifier and the corresponding value, and after deleting the first cache data, storing the identifier of the second cache data as the associated value of the current cache data identifier.

[0077] Further, after deleting the first cache data, when receiving a request to query the current cache data, the second cache data associated with the current cache data identifier is determined, and the return data corresponding to the query request is obtained from the second cache data. The description of processing cache data query requests after data update is consistent with the description of step S102 and is not repeated here.

[0078] like Figure 4 As shown, an embodiment of the present invention provides a device 400 for updating data, characterized in that it includes: a processing update request module 401 and an execution data update module 402; wherein,

[0079] The update request processing module 401 is used to determine the first cache data corresponding to the current cache data identifier according to the received request for updating the cache data; determine the first data source corresponding to the first cache data, the first data source contains the updated target cache data;

[0080] The execution data update module 402 is used to create second cache data, write the target cache data contained in the first data source into the second cache data using a pipeline model; delete the first cache data, and associate the second cache data with the current cache data identifier.

[0081] Optionally, the update request processing module 401 is further configured to determine an original data source corresponding to the first data source, and the first data source obtains the updated target cache data from the original data source.

[0082] Optionally, the update request processing module 401 includes the first data source acquiring the target cache data through at least one of the original data sources, and composing the target cache data according to partial data and / or full data provided by the original data source.

[0083] Optionally, the processing update request module 401 includes: if the original data source receives incremental data after the first data source obtains the full data of the original data source, the first data source obtains the incremental data through a message queue.

[0084] Optionally, the execution data update module 402 is also used to delete the first cache data and associate the second cache data with the current cache data identifier, including: after deleting the first cache data, when receiving a request to query the current cache data, determining the second cache data associated with the current cache data identifier, and obtaining return data corresponding to the query request from the second cache data.

[0085] Optionally, the execution data update module 402 is also used to determine the first cache data associated with the current cache data identifier when receiving a request to query the current cache data before deleting the first cache data, and obtain return data corresponding to the query request from the first cache data.

[0086] Optionally, the execution data updating module 402 is further configured to store the current cache identifier and the corresponding value, and after deleting the first cache data, store the identifier of the second cache data as the corresponding value of the current cache data identifier.

[0087] An embodiment of the present invention also provides an electronic device for updating data, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in any of the above embodiments.

[0088] An embodiment of the present invention further provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the method provided in any of the above embodiments is implemented.

[0089] Figure 5 An exemplary system architecture 500 is shown to which the method for updating data or the apparatus for updating data according to the embodiments of the present invention can be applied.

[0090] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0091] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various client applications can be installed on terminal devices 501, 502, 503, such as client applications for managing data sources.

[0092] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting various client applications, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0093] The server 505 may be a server that provides various services, such as a background management server that provides support for client applications used by users using the terminal devices 501, 502, and 503. The background management server may process the received request to update cache data, and provide return data for the query request from the terminal device using the updated cache data.

[0094] It should be noted that the method for updating data provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the device for updating data is generally disposed in the server 505 .

[0095] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0096] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device suitable for implementing an embodiment of the present invention. Figure 6 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0097] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0098] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.

[0099] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.

[0100] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0101] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0102] The modules and / or units involved in the embodiments of the present invention may be implemented in software or hardware. The modules and / or units described may also be arranged in a processor. For example, they may be described as: a processor includes a module for processing update requests and a module for executing data updates. The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the module for executing data updates may also be described as a module for creating new cache data to complete data updates and deleting old cache data.

[0103] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: determining the first cache data corresponding to the current cache data identifier according to the received request to update the current cache data, determining the first data source corresponding to the first cache data, and the first data source containing the updated target cache data; creating second cache data, and using the pipeline model, writing the target cache data contained in the first data source into the second cache data; deleting the first cache data, and associating the second cache data with the current cache data identifier.

[0104] It can be seen that the method and device for updating data provided by the embodiments of the present invention can create a new data cache, use the pipeline model to write the target cache data to be updated obtained from the data source into the new data cache, and delete the old data cache to complete the data update; when receiving a query request, before deleting the old data cache (that is, before the update of the data is completed), the old cache data provides the return data of the query request, thereby overcoming the abnormal return result caused by the dynamic change of data during the data update process; at the same time, the pipeline model is used to update the data, which improves the speed of data update, thereby overcoming the problem of abnormal data generated during the data update process.

[0105] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for updating data, characterized in that: include: Determine, according to the received request to update the current cache data, first cache data corresponding to the current cache data identifier, and determine a first data source corresponding to the first cache data, wherein the first data source includes the updated target cache data; Creating second cache data, and using a pipeline model, writing the target cache data contained in the first data source into the second cache data; Deleting the first cache data, and associating the second cache data with the current cache data identifier; The method further includes: after deleting the first cache data, when receiving a request to query the current cache data, determining the second cache data associated with the current cache data identifier, and obtaining return data corresponding to the query request from the second cache data.

2. The method according to claim 1, characterized in that Determining a first data source corresponding to the first cache data, wherein the first data source includes updated target cache data, further comprising: An original data source corresponding to the first data source is determined, and the first data source obtains the updated target cache data from the original data source.

3. The method according to claim 2, characterized in that The first data source acquires the updated target cache data from the original data source, further comprising: The first data source obtains the target cache data through at least one of the original data sources, and composes the target cache data according to partial data and / or full data provided by the original data source.

4. The method according to claim 3, characterized in that The first data source acquires the updated target cache data from the original data source, further comprising: If the original data source receives incremental data after the first data source obtains the full amount of data from the original data source, the first data source obtains the incremental data through a message queue.

5. The method according to claim 1, characterized in that Deleting the first cache data also includes: Before deleting the first cache data, when receiving a request to query the current cache data, the first cache data associated with the current cache data identifier is determined, and return data corresponding to the query request is obtained from the first cache data.

6. The method according to any one of claims 1 to 5, characterized in that: Deleting the first cache data and associating the second cache data with the current cache data identifier includes: The current cache identifier and the corresponding value are stored, and after deleting the first cache data, the identifier of the second cache data is stored as the corresponding value of the current cache data identifier.

7. A device for updating data, characterized in that: include: Processing update request module and executing data update module; wherein, The update request processing module is used to determine the first cache data corresponding to the current cache data identifier according to the received cache data update request; determine the first data source corresponding to the first cache data, the first data source contains the updated target cache data; The execution data update module is used to create second cache data, write the target cache data contained in the first data source into the second cache data by using a pipeline model; delete the first cache data, and associate the second cache data with the current cache data identifier; The device is further configured to, after deleting the first cache data, determine the second cache data associated with the current cache data identifier when receiving a request to query the current cache data, and obtain return data corresponding to the query request from the second cache data.

8. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.