Data cache synchronization method and device, electronic equipment, medium and program product

Through the dual-link cache synchronization solution of cross-city transaction messages and asynchronous RPC, the problem of cached data consistency in Internet financial scenarios is solved, the timeliness, accuracy and stability of data synchronization are achieved, and the shortcomings of single-link dependencies are made up.

CN120336047AActive Publication Date: 2025-07-18CHONGQING ANT CONSUMER FINANCE CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510819460.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-18
Publication Date
2025-07-18
Estimated Expiration
2045-06-18

AI Technical Summary

Technical Problem

In the Internet financial scenario, the existing technology has problems such as dirty data, data delay and data loss in the cached data consistency issue, resulting in inconsistent cached data. The single-link dependent message middleware or RPC gateway scheme is prone to obstacles in extreme cases, affecting the timeliness and stability of synchronization.

Method used

The dual-link cache synchronization scheme with cross-city transaction messages and asynchronous RPC bottom-compensation is adopted. The target data is sent across cities through transaction messages and an asynchronous cache synchronization task is generated. The compensation synchronization cache is used to ensure the timely and accurate synchronization of the data on the second server.

Benefits of technology

Improve the timeliness, accuracy and stability of data cache synchronization, avoid delays or losses caused by message middleware jitter, and enhance the reliability of cache synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120336047A_ABST
    Figure CN120336047A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a data cache synchronization method and device, electronic equipment, a medium and a program product. The method comprises the steps that after a first server generates a target event, target data related to the target event is sent to a second server in a cross-city mode in a transaction message mode, so that after the second server subscribes to the transaction message, the target data sent by the first server through the transaction message is synchronously cached; in addition, after the target event occurs in the first server, an asynchronous cache synchronization task can be generated and executed, and the asynchronous cache synchronization task is to send target data related to the target event to the second server in an asynchronous RPC mode, so that the second server performs asynchronous compensation and synchronous cache based on the target data sent by the first server through the asynchronous RPC. A single-chain roadblock risk that a cache synchronization link only depends on message-oriented middleware or an RPC gateway is made up, and timeliness, accuracy and stability of data cache synchronization are guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of computer technology, and particularly to a data cache synchronization method, apparatus, electronic device, medium, and program product. Background Art

[0002] In the Internet finance scenario, in order to pursue the customer experience (such as the payment scenario), a data cache solution is adopted in the technical architecture design. By greatly reducing the link latency, a smooth customer experience is achieved. At the same time, unnecessary link dependencies and system interactions are reduced to a certain extent, improving the system stability. Summary of the Invention

[0003] Embodiments of this specification provide a data cache synchronization method, apparatus, electronic device, medium, and program product. Through a dual-link cache synchronization solution of cross-city transaction messages and asynchronous RPC fallback compensation, the risk of a single-link failure that only relies on a message middleware or an RPC gateway in the cache synchronization link is compensated, ensuring the timeliness, accuracy, and stability of data cache synchronization. The above technical solutions are as follows: In a first aspect, an embodiment of this specification provides a data cache synchronization method. The method is applied to a first server and includes: After a target event occurs on the first server, the target data related to the target event is sent across cities to a second server in the form of a transaction message, so that after the second server subscribes to the transaction message, the target data sent by the first server through the transaction message is synchronously cached; After a target event occurs on the first server, an asynchronous cache synchronization task is generated; the asynchronous cache synchronization task is to send the target data related to the target event to the second server through asynchronous RPC; The asynchronous cache synchronization task is executed, so that the second server performs asynchronous compensation synchronous caching based on the target data sent by the first server through asynchronous RPC.

[0004] In a second aspect, an embodiment of this specification provides another data cache synchronization method. The method is applied to a second server and includes: After subscribing to the transaction message of the first server, the target data sent by the first server through the transaction message is synchronously cached; the target data is the data related to the target event that occurs on the first server; The target data sent by the first server through asynchronous RPC is received; Asynchronous compensation synchronous caching is performed based on the target data sent by the first server through asynchronous RPC.

[0005] In a third aspect, an embodiment of this specification provides a data cache synchronization device. The above device is applied to a first server, and the above device includes: A first sending module, configured to, after a target event occurs in the first server, send target data related to the target event to a second server across cities in the form of a transaction message, so that after the second server subscribes to the transaction message, synchronously cache the target data sent by the first server through the transaction message; A cache synchronization task generation module, configured to, after a target event occurs in the first server, generate an asynchronous cache synchronization task; the above asynchronous cache synchronization task is to send the target data related to the target event to the second server through the asynchronous RPC method; A cache synchronization task execution module, configured to execute the above asynchronous cache synchronization task, so that the second server performs asynchronous compensation synchronization caching based on the target data sent by the first server through asynchronous RPC.

[0006] In a fourth aspect, an embodiment of this specification provides another data cache synchronization device. The above device is applied to a second server, and the above device includes: A first synchronous cache module, configured to, after subscribing to the transaction message of the first server, synchronously cache the target data sent by the first server through the transaction message; the above target data is the data corresponding to the target event that occurs in the first server; A first receiving module, configured to receive the target data sent by the first server through asynchronous RPC; A second synchronous cache module, configured to perform asynchronous compensation synchronization caching based on the target data sent by the first server through asynchronous RPC.

[0007] In a fifth aspect, an embodiment of this specification provides an electronic device, including: a processor and a memory; The above processor is connected to the above memory; The above memory is used to store executable program code; The above processor runs a program corresponding to the executable program code by reading the executable program code stored in the above memory, so as to execute the method provided in the first aspect or the second aspect of the embodiment of this specification.

[0008] In a sixth aspect, an embodiment of this specification provides a computer storage medium. The above computer storage medium stores multiple instructions, and the above instructions are suitable for being loaded and executed by a processor to execute the method provided in the first aspect or the second aspect of the embodiment of this specification.

[0009] In a seventh aspect, an embodiment of this specification provides a computer program product containing instructions. When the computer program product runs on a computer or a processor, the computer or the processor is caused to execute the data cache synchronization method provided in the first aspect or the second aspect of the embodiments of this specification.

[0010] In the embodiments of this specification, after a target event occurs on a first server, target data related to the target event is sent across cities to a second server in the form of a transaction message, so that after the second server subscribes to the transaction message, the target data sent by the first server through the transaction message is synchronously cached; after a target event occurs on the first server, the first server generates and executes an asynchronous cache synchronization task, and the asynchronous cache synchronization task is to send the target data related to the target event to the second server in an asynchronous RPC manner, so that the second server performs asynchronous compensation synchronization caching based on the target data sent by the first server through asynchronous RPC. Thus, through a dual-link cache synchronization solution of cross-city transaction messages and asynchronous RPC fallback compensation, the problem of dirty data caused by possible jitter of the message middleware resulting in message delay or loss in extreme cases is avoided, and the single-link failure risk that only relies on the message middleware or the RPC gateway in the cache synchronization link is made up for, ensuring the timeliness, accuracy, and stability of data cache synchronization. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] To more clearly illustrate the technical solutions in the embodiments of this specification, the accompanying drawings required for the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of this specification. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0012] Figure 1 It is a schematic diagram of the architecture of a data cache system provided for an exemplary embodiment of this specification; Figure 2 It is a schematic flowchart of a data cache synchronization method provided for an exemplary embodiment of this specification; Figure 3 It is a schematic diagram of the implementation architecture of a data cache synchronization provided for an exemplary embodiment of this specification; Figure 4 It is a schematic flowchart of the implementation process of a data cache verification method provided for an exemplary embodiment of this specification; Figure 5 It is a schematic diagram of the implementation architecture of a data cache verification provided for an exemplary embodiment of this specification; Figure 6 It is a schematic diagram of the inclusion relationship of data verification provided for an exemplary embodiment of this specification; Figure 7A structural schematic diagram of a data cache synchronization device provided by an exemplary embodiment of this specification; Figure 8 A structural schematic diagram of another data cache synchronization device provided by an exemplary embodiment of this specification; Figure 9 A structural schematic diagram of an electronic device provided by an exemplary embodiment of this specification. Specific implementation manners

[0013] Next, the technical solutions in the embodiments of this specification will be clearly and completely described with reference to the accompanying drawings in the embodiments of this specification.

[0014] The terms "first", "second", "third", etc. in this specification, the claims and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products or devices.

[0015] It should be noted that the information (including but not limited to user equipment information, user personal information, etc.), data (including but not limited to data for analysis, stored data, displayed data, etc.) and signals involved in the embodiments of this specification are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of relevant countries and regions. For example, the target data, data to be verified, etc. involved in this specification are all obtained under sufficient authorization.

[0016] In the Internet finance scenario, although the relevant data cache solutions have been greatly optimized in terms of time consumption, there are often relatively large challenges in the cache data consistency issue. For example, dirty data, data latency, data loss, etc. will all lead to cache data inconsistency problems. Based on this, the embodiments of this specification provide a data cache synchronization method, which makes up for the single-link failure risk that only relies on the message middleware or RPC gateway in the cache synchronization link through a dual-link cache synchronization scheme of cross-city transaction messages and asynchronous RPC fallback compensation, and ensures the timeliness, accuracy and stability of data cache synchronization.

[0017] Next, please refer to Figure 1 , Figure 1 An architecture schematic diagram of a data cache system provided by an exemplary embodiment of this specification. As Figure 1As shown, the data caching system may include: a first server 110 and a second server 120. Among them: The first server 110 may be, but is not limited to, the server corresponding to the first city data center, which is a core component of the first city data center and is used to run application programs and process user requests. A protocol signing application may be installed in the first server 110 to provide protocol signing services for users. After a target event occurs in the first server, the first server 110 may send the target data related to the target event across cities to the second server 120 in the form of a transaction message, and generate and execute an asynchronous cache synchronization task. The asynchronous cache synchronization task is to send the target data related to the target event to the second server 120 by means of asynchronous RPC. The first server 110 may be, but is not limited to, a hardware server, a virtual server, a cloud server, etc.

[0018] The second server 120 may be a server corresponding to the second city data center that can provide multiple data caches. After subscribing to the transaction message of the first server 110, it can synchronize and cache the target data sent by the first server 110 through the transaction message; and receive the target data sent by the first server 110 through asynchronous RPC, and perform asynchronous compensation synchronization caching based on the target data sent by the first server 110 through asynchronous RPC. The second server 120 may be, but is not limited to, a hardware server, a virtual server, a cloud server, etc.

[0019] The network may be a medium that provides a communication link between the second server 120 and the first server 110, or may be the Internet including network devices and transmission media, and is not limited thereto. The transmission medium may be a wired link, such as, but not limited to, coaxial cable, optical fiber, and digital subscriber line (DSL), etc., or a wireless link, such as, but not limited to, wireless fidelity (WIFI), Bluetooth, and mobile device network, etc.

[0020] It can be understood that Figure 1 The numbers of the first server 110 and the second server 120 in the data caching system shown are only examples. In specific implementations, the data caching system may include any number of first servers 110 and second servers 120. The embodiments of this specification do not make specific limitations on this. For example, but not limited to, the first server 110 may be a first server cluster composed of multiple first servers, and the second server 120 may be a second server cluster composed of multiple second servers.

[0021] Next, in combination with Figure 1 , the data cache synchronization method provided by the embodiments of this specification will be introduced. For details, please refer to Figure 2, which is a schematic flowchart of a data cache synchronization method provided by an exemplary embodiment of this specification. As Figure 2 shown, the data cache synchronization method includes the following steps: S201. After a target event occurs, the first server sends target data related to the target event to the second server across cities in the form of a transaction message.

[0022] Specifically, the above-mentioned target event may include, but is not limited to, a protocol signing event or other events that require data cache synchronization. The above-mentioned protocol signing event refers to the process of concluding a legally binding service agreement between the user and the service provider corresponding to the first server through methods such as electronic signature, API call, or interface operation. For example, but not limited to, the user completes the signing of an online loan contract. When the first server detects that a target event has occurred, it may, but is not limited to, encapsulate the target data related to the target event (such as, but not limited to, the signed protocol identifier, user information, timestamp, etc.) into a transaction message and send it to the second server through a message queue that supports the XA protocol, ensuring that the target data related to the target event will not be lost during the cross-city cache synchronization process and guaranteeing the atomicity of message transmission and the local transaction of the first server. The above-mentioned transaction message refers to the message sent by the application system that publishes the message in the local database transaction operation sequence. The delivery of such messages is consistent with the database transaction state. When the transaction state is committed, the message will be delivered to the subscriber; when the transaction state is rolled back, the message will not be delivered to the subscriber.

[0023] Optionally, while encapsulating the target data related to the target event (such as, but not limited to, the signed protocol identifier, user information, timestamp, etc.) into a transaction message, it may also, but is not limited to, generate a first version information based on algorithms such as the Lamport clock algorithm. The target data sent by the first server through the transaction message carries the first version information, and the first version information is used to identify the freshness of the target data sent by the first server through the transaction message, supporting the second server that receives the target data to decide whether it needs to synchronize and cache the target data sent by the first server through the transaction message. The above-mentioned first version information may include, but is not limited to, the first version number of the target data sent by the first server through the transaction message.

[0024] S202. After subscribing to the transaction message, the second server synchronizes and caches the target data sent by the first server through the transaction message.

[0025] Specifically, the second server may, but is not limited to, subscribe to the transaction message through a long connection, verify the message integrity after receiving it, and write the target data sent by the first server through the transaction message into the cache cluster of the local city data center, such as, but not limited to, writing it into its cache database.

[0026] Optionally, the target data sent by the first server through the transaction message carries the first version information. After subscribing to the transaction message, the second server can first determine whether the first version information is greater than the current version information in the corresponding cache database of the second server (i.e., the latest version information locally cached by the second server); then, when the first version information is greater than the current version information, it means that the second server does not synchronously cache the target data corresponding to the first version information, and the target data sent by the first server through the transaction message is updated. Then, the step of synchronously caching the target data sent by the first server through the transaction message can be executed, so as to avoid the second server from repeatedly synchronously caching or caching invalid data that has become outdated through version comparison, and improve the utilization rate and effectiveness of cache synchronization.

[0027] S203. After the target event occurs on the first server, an asynchronous cache synchronization task is generated.

[0028] Specifically, after the target event occurs on the first server, in addition to sending the target data related to the target event to the second server across cities in the form of a transaction message, it will also asynchronously generate a compensation task (i.e., an asynchronous cache synchronization task) and encapsulate the same target data for the same target event. The embodiments of this specification can not only asynchronously process the erasure scenario of message loss or synchronization failure in the data cache synchronization process through the above asynchronous cache synchronization task, but also reduce the latency impact on the core transaction of the first server through asynchronous processing.

[0029] Optionally, the above asynchronous cache synchronization task can be scheduled through a distributed task queue, and corresponding initial delay and retry policies can be set.

[0030] S204. The first server executes the asynchronous cache synchronization task, and the asynchronous cache synchronization task is to send the target data related to the target event to the second server through asynchronous RPC.

[0031] Specifically, the first server can execute the asynchronous cache synchronization task according to the scheduling policy, that is, send the target data related to the target event to the second server through asynchronous RPC. The above asynchronous RPC is a non-blocking remote service call mechanism, which allows the first server to continue to execute other operations after sending the target data related to the target event.

[0032] Optionally, the target data sent by the first server through asynchronous RPC carries second version information, which is used to decide whether to asynchronously compensate for synchronously caching the target data sent by the first server through asynchronous RPC. The second version information is used to identify the freshness of the target data sent by the second server through asynchronous RPC, and supports the second server that receives the target data to decide whether it needs to synchronously cache the target data sent by the first server through asynchronous RPC. The second version information may include, but is not limited to, the second version number of the target data sent by the first server through asynchronous RPC.

[0033] Optionally, after generating the asynchronous cache synchronization task and before executing the asynchronous cache synchronization task, the first server may also, but is not limited to, record the asynchronous cache synchronization task in the first database corresponding to the first server. Then, periodically extract and execute the asynchronous cache synchronization tasks in the to-be-executed state from the first database.

[0034] S205. The second server performs asynchronous compensation synchronous caching based on the target data sent by the first server through asynchronous RPC.

[0035] Specifically, the target data sent by the first server through asynchronous RPC carries second version information; after receiving the target data sent by the first server through asynchronous RPC, the second server will first determine whether the second version information is greater than the current version information in the cache database corresponding to the second server; then, in the case where the second version information is greater than the current version information, it indicates that the second server does not synchronously cache the target data corresponding to the second version information, and the target data sent by the first server through asynchronous RPC is updated. Then, the target data sent by the first server through asynchronous RPC can be asynchronously compensated and synchronously cached, so that both the scenario of message loss or synchronization failure in the data cache synchronization process can be processed through asynchronous compensation synchronous caching, and the second server can be prevented from repeatedly synchronously caching or caching invalid data that has become obsolete through version comparison, improving the utilization rate and effectiveness of cache synchronization.

[0036] Exemplarily, such as Figure 3As shown in the figure, the first server is installed with a protocol center program. After the user completes the protocol signing through the protocol center program, the first server will not only cache and synchronize the target data related to the target event corresponding to the user in the protocol center program to the second server in the form of a cross-city transaction message, but also generate a corresponding asynchronous cache synchronization task, record it in the first database, and then regularly poll and extract and execute the asynchronous cache synchronization tasks in the first database that are in the to-be-executed state for asynchronous RPC compensation cache synchronization. After subscribing to the cross-city transaction message, the data view application installed on the second server can synchronize and cache the corresponding target data in its cache database by referring to a process similar to the above S202. After receiving the target data sent by the first server through asynchronous RPC, the second server can synchronize and cache the corresponding target data in its cache database by referring to a process similar to the above S205 for compensation synchronization cache.

[0037] In the embodiments of this specification, after a target event occurs on the first server, the target data related to the target event is sent across cities to the second server in the form of a transaction message, so that after subscribing to the transaction message, the second server synchronizes and caches the target data sent by the first server through the transaction message; after a target event occurs on the first server, the first server generates and executes an asynchronous cache synchronization task, and the asynchronous cache synchronization task is to send the target data related to the target event to the second server through asynchronous RPC, so that the second server performs asynchronous compensation synchronization cache based on the target data sent by the first server through asynchronous RPC. Thus, through a dual-link cache synchronization scheme of cross-city transaction messages and asynchronous RPC fallback compensation, the problem of dirty data caused by message middleware jitter resulting in message delay or loss in extreme cases is avoided, and the single-link failure risk relying only on message middleware or RPC gateways in the cache synchronization link is compensated, ensuring the timeliness, accuracy, and stability of data cache synchronization.

[0038] In the related data cache synchronization scheme, after synchronizing the data cache through transaction messages, the cache synchronization consistency problem is also discovered by means of active real-time verification. However, its active real-time cache verification scheme is single and cannot cover all verification scenarios, and there may be omissions in the verification scenarios, resulting in the problem of cache dirty data.

[0039] Based on this, the embodiments of this specification also propose a more comprehensive data cache verification method after data cache synchronization. Next, please refer to Figure 4 , which is a schematic diagram of the implementation process of a data cache verification method provided by an exemplary embodiment of this specification. As Figure 4 shown, the data cache verification method may but is not limited to include the following steps: S401, the first server sends a first data verification request to the second server.

[0040] Specifically, the above first data verification request may, but is not limited to, carry at least one of the following data verification types: online data verification, offline data verification, incremental verification, full - volume verification, etc. Among them, the triggering conditions corresponding to online data verification and offline data verification are different.

[0041] The verification method corresponding to the above online data verification may, but is not limited to, include active verification and passive verification. The above active verification refers to the verification of the consistency of the cached data in the cache database corresponding to the second server and the data in the first database corresponding to the first server initiated by the data update party (i.e., the first server), and its corresponding implementation process is similar to S401 - S403. The above passive verification refers to the verification of the consistency of the cached data in the cache database and the data in the first database corresponding to the first server initiated when the cache database corresponding to the second server performs cache refresh, and its corresponding implementation process is similar to S404 - S406.

[0042] Optionally, the above first data verification request may, but is not limited to, include an online data verification request, the above first cached data to be verified may, but is not limited to, include the full - volume cached data in the cache database corresponding to the second server, and the above first data to be verified may, but is not limited to, include the full - volume data in the first database corresponding to the first server. After the first server has a target event, the first server may save the target data related to the target event to the first database corresponding to the first server. And when the data stored in the first database is updated (changed), it will trigger the execution of the step of sending the first data verification request to the second server, that is, trigger the online active verification of data caching. The above full - volume data may, but is not limited to, be the data related to the target event corresponding to the target users who have completed protocol signing in the first database, so as to ensure that subsequent efficient and real - time caching data verification can be achieved for the target users who have completed protocol signing currently, and timely guarantee the consistency of their data cache synchronization.

[0043] Optionally, the above first data verification request may also include, but is not limited to, a data offline verification request. The data offline verification request carries the target data type and the target data verification range to be verified. The target data type may include, but is not limited to, incremental data and / or full data. The target data verification range may include, but is not limited to, at least one target data verification time period, such as, but not limited to, the last week, the last month, the last three months, etc. The incremental data refers to the data newly generated during the target data verification time period. When the current time reaches the preset offline verification time (such as, but not limited to, 24:00 every weekend, the 1st of each month, etc.) or a data offline verification instruction is received, the step of sending the first data verification request to the second server will be triggered for execution. The full data may include, but is not limited to, the data related to the target events corresponding to all users who have completed protocol signing in the first database.

[0044] S402. In response to the first data verification request, the second server sends the first cached data to be verified in its corresponding cached database to the first server.

[0045] Optionally, when the first data verification request is a data online verification request, the first data verification request may carry, but is not limited to, the target user identifier to be verified. After receiving the first data verification request, the second server may first query the corresponding first cached data to be verified in the cached database based on the target user identifier, that is, all the data related to the target events corresponding to the target user identifier, and then return the first cached data to be verified to the first server.

[0046] Optionally, when the first data verification request is a data offline verification request, the data offline verification request may carry, but is not limited to, the target data type and the target data verification range to be verified. After receiving the first data verification request, the second server may first retrieve the corresponding first cached data to be verified in the cached database based on the target data type and the target data verification range to be verified, and then return the first cached data to be verified to the first server.

[0047] S403. The first server performs data verification based on the first cached data to be verified and the first data to be verified in its corresponding first database, and obtains a first data verification result.

[0048] Specifically, the data types and / or data verification ranges of the first cached data to be verified and the first data to be verified are consistent. After receiving the first cached data to be verified returned by the second server, the first server will perform data verification on the first cached data to be verified and the corresponding first data to be verified in its first data, such as, but not limited to, verifying whether the respective field information of the first cached data to be verified and the first data to be verified is consistent, etc., to obtain a first data verification result.

[0049] Optionally, when the first data verification result indicates that the first cached data to be verified is inconsistent with the first data to be verified, a data caching warning message is issued to promptly alert the abnormal situation of inconsistent data caching and prompt relevant personnel to check in a timely manner whether there are problems in the data caching link.

[0050] and / or Next, please continue to refer to Figure 4 , such as Figure 4 shown, the data caching verification method may also but is not limited to include the following steps: S404, the second server sends a second data verification request to the first server.

[0051] Specifically, the above second data verification request may also but is not limited to include a data online verification request. After the cached data in the cache database corresponding to the second server is updated (changed), the second server generates a cache verification task and stores the cache verification task in the second database corresponding to the data bypass of the second server. Then, the cache verification tasks in the to-be-executed state are periodically extracted and executed from the second database to trigger the sending of a second data verification request to the first server.

[0052] S405, in response to the second data verification request, the first server sends the second data to be verified in the first database corresponding to the first server to the second server.

[0053] Optionally, the above second data verification request may also but is not limited to carry the user identifier for which the corresponding cached data to be verified is updated (changed). After receiving the second data verification request, the first server may first query the corresponding second data to be verified in the first database based on the user identifier, that is, all data related to the target event corresponding to the user identifier, and then return the second cached data to be verified to the second server.

[0054] S406, the second server performs data verification based on the second data to be verified and the second cached data to be verified in the cache database corresponding to the second server to obtain a second data verification result.

[0055] Specifically, the data types and / or data verification scopes of the above second data to be verified and the second cached data to be verified are consistent. The data verification process in S406 is similar to the data verification process in S403 and will not be elaborated here.

[0056] Optionally, the above second data to be verified may also but is not limited to include all data (i.e., all data) in the first database corresponding to the first server, and the above second cached data to be verified includes all cached data (i.e., all cached data) in the cache database corresponding to the second server.

[0057] Optionally, the above second data to be verified may but is not limited to include all data corresponding to the user identifier for which the cached data in the first database corresponding to the first server has been updated (changed). The above second cached data to be verified includes all cached data corresponding to the user identifier for which the cached data in the cached database corresponding to the second server has been updated (changed).

[0058] Optionally, when the second data verification result indicates that the second cached data to be verified is inconsistent with the second data to be verified, a data caching warning message is issued to promptly remind of the abnormal situation of inconsistent data caching, and prompt relevant personnel to check in time whether there is a problem with the data caching link.

[0059] Exemplarily, as Figure 5 shown, the first server is installed with a protocol center program. When the data in the first database corresponding to the protocol center changes, the first server will trigger active verification (online verification), that is, request the corresponding first cached data to be verified from the data bypass of the second server to verify with its own first data to be verified to obtain the first data verification result. When the current time reaches the preset offline verification time (such as but not limited to 24:00 every weekend, the 1st of each month, etc.) or when a data offline verification instruction is received, the first server will also trigger active verification (offline verification), that is, request the corresponding first cached data to be verified from the data bypass of the second server to verify with its own first data to be verified to obtain the first data verification result. At this time, if the triggered is an offline incremental cache verification, the first data to be verified may but is not limited to be an incremental data set obtained by pre-offline processing of the changed protocol data within the target time period; if the triggered is an offline full cache verification, the first data to be verified may but is not limited to be a full data set obtained by pre-offline processing of all protocol data in the first database. When the cached data in the cached database corresponding to the second server changes, the second server will call the data bypass to trigger passive verification (online verification), that is, request the corresponding second data to be verified from the first server to verify with its own second cached data to be verified to obtain the second data verification result.

[0060] The inclusion relationship of the data verification scope among the above online cache verification, incremental verification, and full verification is as Figure 6 shown. In the embodiments of this specification, through the three-level cache verification system as Figure 6 shown, it can but is not limited to cover verification mechanisms in three different time efficiency dimensions, namely online second-level verification, offline daily incremental verification, and monthly full verification, and cover two verification directions of active verification and passive verification in terms of scenarios, avoiding the risk of missed verification. Thus, through a multi-time efficiency cycle and multi-direction verification scheme, it can 100% detect and promptly handle cache synchronization inconsistency problems, effectively ensuring cache consistency.

[0061] Next, please refer to Figure 7 , Figure 7 , which is a schematic structural diagram of a data cache synchronization device provided for an exemplary embodiment of this specification. The above data cache synchronization device is applied to the first server. As Figure 7 shown, the data cache synchronization device 700 includes: A first sending module 710, configured to, after a target event occurs in the first server, send target data related to the target event to a second server across cities in the form of a transaction message, so that after the second server subscribes to the transaction message, synchronously cache the target data sent by the first server through the transaction message; A cache synchronization task generation module 720, configured to generate an asynchronous cache synchronization task after a target event occurs in the first server; the asynchronous cache synchronization task is to send the target data related to the target event to the second server through an asynchronous RPC method; A cache synchronization task execution module 730, configured to execute the asynchronous cache synchronization task, so that the second server asynchronously compensates and synchronously caches based on the target data sent by the first server through an asynchronous RPC.

[0062] In a possible implementation, the target data sent by the first server through a transaction message carries a first version information, and the first version information is used to decide whether to synchronously cache the target data sent by the first server through the transaction message; the target data sent by the first server through an asynchronous RPC carries a second version information, and the second version information is used to decide whether to asynchronously compensate and synchronously cache the target data sent by the first server through an asynchronous RPC.

[0063] In a possible implementation, the data cache synchronization device 700 further includes: A recording module, configured to record the asynchronous cache synchronization task into a first database corresponding to the first server; The cache synchronization task execution module 730 is specifically configured to: Regularly extract and execute the asynchronous cache synchronization tasks in a to-be-executed state from the first database.

[0064] In a possible implementation, the data cache synchronization device 700 further includes: A second sending module, configured to send a first data verification request to the second server, so that in response to the first data verification request, the second server sends first to-be-verified cache data in a cache database corresponding to the second server to the first server; A first receiving module, configured to receive the first cache data to be verified sent by the second server, and perform data verification based on the first cache data to be verified and the first data to be verified in the first database corresponding to the first server, so as to obtain a first data verification result; the data types and / or data verification scopes of the first cache data to be verified and the first data to be verified are consistent; and / or A second receiving module, configured to receive a second data verification request sent by the second server; A third sending module, configured to, in response to the second data verification request, send the second data to be verified in the first database corresponding to the first server to the second server, so that the second server performs data verification based on the second data to be verified and the second cache data to be verified in the cache database corresponding to the second server, to obtain a second data verification result; the data types and / or data verification scopes of the second data to be verified and the second cache data to be verified are consistent.

[0065] In a possible implementation manner, the first data verification request includes a data online verification request; the first cache data to be verified includes the full amount of cache data in the cache database corresponding to the second server; the first data to be verified includes the full amount of data in the first database corresponding to the first server; the data cache synchronization device 700 further includes: A storage module, configured to, after a target event occurs on the first server, save the target data related to the target event to the first database corresponding to the first server; A first execution module, configured to, after the data stored in the first database is updated, execute the step of sending a first data verification request to the second server.

[0066] In a possible implementation manner, the first data verification request includes a data offline verification request; the data offline verification request carries the target data type and target data verification scope to be verified; the target data type includes incremental data and / or full amount of data; the target data verification scope includes at least one target data verification time period; the data cache synchronization device 700 further includes: A second execution module, configured to execute the step of sending a first data verification request to the second server when the current time reaches a preset offline verification time or a data offline verification instruction is received.

[0067] In a possible implementation manner, the data cache synchronization device 700 further includes: An alarm module, configured to send a data cache alarm message when the first data verification result is that the first cache data to be verified is inconsistent with the first data to be verified.

[0068] Next, please refer to Figure 8 , Figure 8 , which is a schematic structural diagram of another data cache synchronization device provided for an exemplary embodiment of this specification. The above data cache synchronization device is applied to the second server, as Figure 8 shown. The data cache synchronization device 800 includes: A first synchronization cache module 810, configured to, after subscribing to the transaction messages of the first server, synchronously cache the target data sent by the first server through the transaction messages; the target data is the data corresponding to the target event that occurs in the first server; A first receiving module 820, configured to receive the target data sent by the first server through asynchronous RPC; A second synchronization cache module 830, configured to perform asynchronous compensation synchronization caching based on the target data sent by the first server through asynchronous RPC.

[0069] In a possible implementation manner, the target data sent by the first server through the transaction message carries first version information; the data cache synchronization device 800 further includes: A first judgment module, configured to judge whether the first version information is greater than the current version information in the cache database corresponding to the second server; A first execution module, configured to, when the first version information is greater than the current version information, execute the step of synchronously caching the target data sent by the first server through the transaction message.

[0070] In a possible implementation manner, the target data sent by the first server through asynchronous RPC carries second version information; the data cache synchronization device 800 further includes: A second judgment module, configured to judge whether the second version information is greater than the current version information in the cache database corresponding to the second server; A second execution module, configured to, when the second version information is greater than the current version information, execute the step of performing asynchronous compensation synchronization caching based on the target data sent by the first server through asynchronous RPC.

[0071] In a possible implementation manner, the data cache synchronization device 800 further includes: A second receiving module, configured to receive the first data verification request sent by the first server; A first sending module, configured to send, in response to the first data verification request, the first cached data to be verified in the cache database corresponding to the second server to the first server, so that the first server performs data verification based on the first cached data to be verified and the first data to be verified in the first database corresponding to the first server, and obtains a first data verification result; the data types and / or data verification scopes of the first cached data to be verified and the first data to be verified are consistent; and / or A second sending module, configured to send a second data verification request to the first server, so that the first server, in response to the second data verification request, sends the second data to be verified in the first database corresponding to the first server to the second server; A third receiving module, configured to receive the second data to be verified sent by the first server, and perform data verification based on the second data to be verified and the second cached data to be verified in the cache database corresponding to the second server, and obtain a second data verification result; the data types and / or data verification scopes of the second data to be verified and the second cached data to be verified are consistent.

[0072] In a possible implementation manner, the second data verification request includes a data online verification request; the second data to be verified includes all the data in the first database corresponding to the first server; the second cached data to be verified includes all the cached data in the cache database corresponding to the second server; the data cache synchronization device 800 further includes: A task generation module, configured to generate a cache verification task after the cached data in the cache database is updated; A task storage module, configured to store the cache verification task in the second database corresponding to the data bypass of the second server; A task execution module, configured to periodically extract and execute the cache verification tasks in the to-be-executed state from the second database, so as to trigger the step of sending the second data verification request to the first server.

[0073] In a possible implementation manner, the data cache synchronization device 800 further includes: An alarm module, configured to send a data cache alarm message when the second data verification result indicates that the second data to be verified is inconsistent with the second cached data to be verified.

[0074] The division of each module in the above data cache synchronization device is only for illustrative purposes. In other embodiments, the data cache synchronization device may be divided into different modules as needed to complete all or part of the functions of the above data cache synchronization device. In the embodiments of this specification, the implementation of each module in the data cache synchronization device may be in the form of a computer program. This computer program can run on a server. The program modules formed by this computer program can be stored in the memory of the server. When this computer program is executed by a processor, all or part of the steps of the data cache synchronization method described in the embodiments of this specification are implemented.

[0075] Next, please refer to Figure 9 , Figure 9 which is a schematic structural diagram of an electronic device provided by an exemplary embodiment of this specification. As Figure 9 shown, the electronic device 900 may include: at least one processor 910, at least one communication bus 920, a user interface 930, at least one network interface 940, and a memory 950. Among them, the communication bus 920 can be used to realize the connection and communication of the above-mentioned various components.

[0076] Among them, the user interface 930 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 930 may further include a standard wired interface and a wireless interface.

[0077] Among them, the network interface 940 may optionally include a Bluetooth module, a Near Field Communication (NFC) module, a Wireless Fidelity (Wi-Fi) module, etc.

[0078] Among them, the processor 910 may include one or more processing cores. The processor 910 connects various parts within the entire electronic device 900 through various interfaces and lines. By running or executing instructions, programs, code sets, or instruction sets stored in the memory 950, and by calling the data stored in the memory 950, it performs various functions of the routing electronic device 900 and processes data. Optionally, the processor 910 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). The processor 910 may integrate a combination of one or several of a central processing unit (CPU), a graphics processing unit (GPU), and a modem, etc. Among them, the CPU mainly processes the operating system, user interface, application programs, etc.; the GPU is responsible for the rendering and drawing of the content to be displayed on the display screen; the modem is used to process wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 910 and may be implemented separately by a single chip.

[0079] Among them, the memory 950 may include random access memory (RAM) and may also include read-only memory (ROM). Optionally, the memory 950 includes a non-transitory computer-readable medium. The memory 950 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 950 may include a program storage area and a data storage area. Among them, the program storage area may store instructions for implementing the operating system, instructions for at least one function (such as data cache synchronization function, data cache verification function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store the data involved in the above-mentioned various method embodiments. The memory 950 may optionally also be at least one storage device located far from the aforementioned processor 910. As Figure 9 shown, the memory 950 as a computer storage medium may include an operating system, a network communication module, a user interface module, and application programs.

[0080] Specifically, the above-mentioned electronic device 900 may be Figure 7 the data cache synchronization device 700 or the first server shown above. The above-mentioned processor 910 may be used to call the application programs stored in the memory 950 and specifically perform the following operations: After the above-mentioned first server has a target event, it sends the target data related to the above-mentioned target event to the second server across cities in the form of a transaction message, so that after the second server subscribes to the above-mentioned transaction message, it synchronizes and caches the target data sent by the first server through the transaction message.

[0081] After the above-mentioned first server has a target event, it generates an asynchronous cache synchronization task; the above-mentioned asynchronous cache synchronization task is to send the target data related to the above-mentioned target event to the above-mentioned second server through the asynchronous RPC method.

[0082] Execute the above-mentioned asynchronous cache synchronization task, so that the above-mentioned second server performs asynchronous compensation synchronization caching based on the target data sent by the first server through asynchronous RPC.

[0083] In some possible embodiments, the target data sent by the first server through the transaction message carries a first version information, which is used to decide whether to synchronize and cache the target data sent by the first server through the transaction message; the target data sent by the first server through asynchronous RPC carries a second version information, which is used to decide whether to perform asynchronous compensation synchronization caching on the target data sent by the first server through asynchronous RPC.

[0084] In some possible embodiments, after the above-mentioned processor 910 executes the above-mentioned generation of the asynchronous cache synchronization task and before executing the above-mentioned asynchronous cache synchronization task, it is further used to execute: Record the above-mentioned asynchronous cache synchronization task in the first database corresponding to the first server.

[0085] When the above-mentioned processor 910 executes the above-mentioned execution of the asynchronous cache synchronization task, it is specifically used to execute: Regularly extract and execute the asynchronous cache synchronization tasks in the to-be-executed state from the above-mentioned first database.

[0086] In some possible embodiments, the above-mentioned processor 910 is further used to execute: Send a first data verification request to the above-mentioned second server, so that in response to the above-mentioned first data verification request, the above-mentioned second server sends the first to-be-verified cache data in the cache database corresponding to the second server to the first server.

[0087] Receive the first to-be-verified cache data sent by the second server, and perform data verification based on the first to-be-verified cache data and the first to-be-verified data in the first database corresponding to the first server to obtain a first data verification result; the data types and / or data verification scopes of the first to-be-verified cache data and the first to-be-verified data are the same.

[0088] and / or Receive a second data verification request sent by the above-mentioned second server.

[0089] In response to the above-mentioned second data verification request, send the second data to be verified in the first database corresponding to the first server to the above-mentioned second server, so that the above-mentioned second server performs data verification based on the above-mentioned second data to be verified and the second data to be verified cached data in the cache database corresponding to the second server, and obtain a second data verification result; the data types and / or data verification ranges of the above-mentioned second data to be verified and the above-mentioned second data to be verified cached data are consistent.

[0090] In some possible embodiments, the above-mentioned first data verification request includes a data online verification request; the above-mentioned first data to be verified cached data includes all cached data in the cache database corresponding to the above-mentioned second server; the above-mentioned first data to be verified includes all data in the first database corresponding to the above-mentioned first server; the processor 910 is further configured to execute: After the above-mentioned first server has a target event, save the target data related to the above-mentioned target event to the first database corresponding to the above-mentioned first server.

[0091] After the data stored in the above-mentioned first database is updated, execute the step of sending the first data verification request to the above-mentioned second server.

[0092] In some possible embodiments, the above-mentioned first data verification request includes a data offline verification request; the above-mentioned data offline verification request carries the target data type and target data verification range to be verified; the above-mentioned target data type includes incremental data and / or all data; the above-mentioned target data verification range includes at least one target data verification time period; the processor 910 is further configured to execute: When the current time reaches the preset offline verification time or a data offline verification instruction is received, execute the step of sending the first data verification request to the above-mentioned second server.

[0093] In some possible embodiments, after the processor 910 executes the data verification based on the above-mentioned first data to be verified cached data and the first data to be verified in the first database corresponding to the first server to obtain a first data verification result, it is further configured to execute: In the case where the above-mentioned first data verification result is that the above-mentioned first data to be verified cached data is inconsistent with the above-mentioned first data to be verified, send out a data cache warning message.

[0094] In some possible embodiments, the above-mentioned electronic device 900 may be Figure 8For the data cache synchronization device 800 or the second server shown above, the above-mentioned processor 910 can be used to call the application program stored in the memory 950 and specifically perform the following operations: After subscribing to the transaction message of the above-mentioned first server, synchronously cache the target data sent by the above-mentioned first server through the transaction message; the above-mentioned target data is the data related to the target event that occurred in the above-mentioned first server.

[0095] Receive the target data sent by the above-mentioned first server through asynchronous RPC.

[0096] Perform asynchronous compensation synchronous caching based on the target data sent by the above-mentioned first server through asynchronous RPC.

[0097] In some possible embodiments, the target data sent by the above-mentioned first server through the transaction message carries the first version information; the above-mentioned processor 910 is further used to execute: Determine whether the above-mentioned first version information is greater than the current version information in the corresponding cache database of the above-mentioned second server.

[0098] In the case where the above-mentioned first version information is greater than the above-mentioned current version information, execute the step of synchronously caching the target data sent by the above-mentioned first server through the transaction message.

[0099] In some possible embodiments, the target data sent by the above-mentioned first server through asynchronous RPC carries the second version information; the above-mentioned processor 910 is further used to execute: Determine whether the above-mentioned second version information is greater than the current version information in the corresponding cache database of the above-mentioned second server.

[0100] In the case where the above-mentioned second version information is greater than the above-mentioned current version information, execute the step of performing asynchronous compensation synchronous caching based on the target data sent by the above-mentioned first server through asynchronous RPC.

[0101] In some possible embodiments, the above-mentioned processor 910 is further used to execute: Receive the first data verification request sent by the above-mentioned first server.

[0102] In response to the above-mentioned first data verification request, send the first cache data to be verified in the corresponding cache database of the above-mentioned second server to the above-mentioned first server, so that the above-mentioned first server performs data verification based on the above-mentioned first cache data to be verified and the first data to be verified in the corresponding first database of the above-mentioned first server, and obtains a first data verification result; the data types and / or data verification ranges of the above-mentioned first cache data to be verified and the above-mentioned first data to be verified are the same.

[0103] and / or Send a second data verification request to the first server above, so that in response to the second data verification request, the first server sends the second data to be verified in the first database corresponding to the first server to the second server above.

[0104] Receive the second data to be verified sent by the first server, and perform data verification based on the second data to be verified and the second cached data to be verified in the cache database corresponding to the second server to obtain a second data verification result; the data types and / or data verification scopes of the second data to be verified and the second cached data to be verified are consistent.

[0105] In some possible embodiments, the second data verification request includes a data online verification request; the second data to be verified includes all the data in the first database corresponding to the first server; the second cached data to be verified includes all the cached data in the cache database corresponding to the second server; the processor 910 is further configured to execute: After the cached data in the cache database is updated, generate a cache verification task and store the cache verification task in the second database corresponding to the data bypass of the second server.

[0106] Regularly extract and execute the cache verification tasks in the second database that are in a to-be-executed state to trigger the step of sending the second data verification request to the first server above.

[0107] In some possible embodiments, after the processor 910 performs the data verification based on the second data to be verified and the second cached data to be verified in the cache database corresponding to the second server to obtain a second data verification result, it is further configured to execute: In the case where the second data verification result is that the second data to be verified is inconsistent with the second cached data to be verified, send a data cache warning message.

[0108] The embodiments of this specification also provide a computer-readable storage medium, in which instructions are stored. When the instructions run on a computer or a processor, the computer or the processor is caused to execute one or more steps in the above embodiments. If each component module of the above data cache synchronization device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in the above computer-readable storage medium.

[0109] In the above embodiments, they can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, they can be implemented in whole or in part in the form of a computer program product. The above computer program product includes one or more computer instructions. When the above computer program instructions are loaded and executed on a computer, the processes or functions described above in the embodiments of this specification are generated in whole or in part. The above computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The above computer instructions can be stored in a computer-readable storage medium or transmitted through the above computer-readable storage medium. The above computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center in a wired manner, such as coaxial cable, optical fiber, Digital Subscriber Line (DSL), or wirelessly (such as infrared, wireless, microwave, etc.). The above computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more integrated available media. The above available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a Digital Versatile Disc (DVD)), or a semiconductor medium (for example, a Solid State Disk (SSD), etc.).

[0110] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above various methods. The foregoing storage media include: various media such as ROM, RAM, magnetic disks, or optical discs that can store program codes. Without conflict, the technical features in this embodiment and the implementation solutions can be combined arbitrarily.

[0111] The above-described embodiments are merely described in a preferred embodiment manner of this specification, and do not limit the scope of this specification. Without departing from the design spirit of this specification, various deformations and improvements made by those of ordinary skill in the art to the technical solutions of this specification should all fall within the protection scope determined by the claims.

[0112] The foregoing describes particular embodiments of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the acts or steps recited in the claims and the specification may be performed in a different order than in the embodiments described in the specification and still achieve the desired result. Additionally, the processes depicted in the figures do not necessarily require the particular order or sequential order shown to achieve the desired result. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

Claims

1. A data cache synchronization method, characterized in that, The method is applied to a first server, and the method includes: After a target event occurs on the first server, the target data related to the target event is sent across cities to a second server in the form of a transaction message, so that after subscribing to the transaction message, the second server synchronously caches the target data sent by the first server through the transaction message; After a target event occurs on the first server, an asynchronous cache synchronization task is generated; the asynchronous cache synchronization task is to send the target data related to the target event to the second server through asynchronous RPC; Execute the asynchronous cache synchronization task, so that the second server asynchronously compensates and synchronizes the cache based on the target data sent by the first server through asynchronous RPC.

2. The method according to claim 1, wherein The target data sent by the first server through the transaction message carries a first version information, and the first version information is used to decide whether to synchronously cache the target data sent by the first server through the transaction message; The target data sent by the first server through asynchronous RPC carries a second version information, and the second version information is used to decide whether to asynchronously compensate and synchronize the cache of the target data sent by the first server through asynchronous RPC.

3. The method according to claim 1, wherein After generating the asynchronous cache synchronization task and before executing the asynchronous cache synchronization task, the method further includes: Recording the asynchronous cache synchronization task in a first database corresponding to the first server; The execution of the asynchronous cache synchronization task includes: Regularly extracting and executing the asynchronous cache synchronization tasks in a pending execution state from the first database.

4. The method according to claim 1, wherein The method further includes: Sending a first data verification request to the second server, so that in response to the first data verification request, the second server sends first cached data to be verified in a cache database corresponding to the second server to the first server; Receiving the first cached data to be verified sent by the second server, and performing data verification based on the first cached data to be verified and first data to be verified in a first database corresponding to the first server to obtain a first data verification result; the data types and / or data verification scopes of the first cached data to be verified and the first data to be verified are consistent; and / or Receiving a second data verification request sent by the second server; In response to the second data verification request, sending second data to be verified in a first database corresponding to the first server to the second server, so that the second server performs data verification based on the second data to be verified and second cached data to be verified in a cache database corresponding to the second server to obtain a second data verification result; the data types and / or data verification scopes of the second data to be verified and the second cached data to be verified are consistent.

5. The method according to claim 4, wherein The first data verification request includes a data online verification request; the first cached data to be verified includes all cached data in a cache database corresponding to the second server; The first data to be verified includes all data in a first database corresponding to the first server; the method further includes: After the target event occurs on the first server, the target data related to the target event is saved to the first database; After the data stored in the first database is updated, the step of sending a first data verification request to the second server is executed.

6. The method according to claim 4, wherein, The first data verification request includes a data offline verification request; the data offline verification request carries the target data type and the target data verification range to be verified; the target data type includes incremental data and / or full data; The target data verification range includes at least one target data verification time period; the method further includes: When the current time reaches the preset offline verification time or a data offline verification instruction is received, the step of sending a first data verification request to the second server is executed.

7. The method according to claim 4, wherein After performing data verification based on the first data to be verified in the cache and the first data to be verified in the first database corresponding to the first server to obtain a first data verification result, the method further includes: In the case where the first data verification result is that the first data to be verified in the cache is inconsistent with the first data to be verified, a data cache warning message is issued.

8. A data cache synchronization method, characterized in that, The method is applied to a second server, and the method includes: After subscribing to the transaction message of the first server, the target data sent by the first server through the transaction message is synchronously cached; the target data is the data related to the target event that occurs on the first server; Receiving the target data sent by the first server through asynchronous RPC; Performing asynchronous compensation synchronous caching based on the target data sent by the first server through asynchronous RPC.

9. The method according to claim 8, wherein The target data sent by the first server through the transaction message carries a first version information; the method further includes: Judging whether the first version information is greater than the current version information in the cache database corresponding to the second server; In the case where the first version information is greater than the current version information, the step of synchronously caching the target data sent by the first server through the transaction message is executed.

10. The method according to claim 8, wherein The target data sent by the first server through asynchronous RPC carries a second version information; the method further includes: Judging whether the second version information is greater than the current version information in the cache database corresponding to the second server; In the case where the second version information is greater than the current version information, the step of performing asynchronous compensation synchronous caching based on the target data sent by the first server through asynchronous RPC is executed.

11. The method according to claim 8, wherein The method further includes: Receiving the first data verification request sent by the first server; In response to the first data verification request, sending the first data to be verified in the cache database corresponding to the second server to the first server, so that the first server performs data verification based on the first data to be verified in the cache and the first data to be verified in the first database corresponding to the first server to obtain a first data verification result; the data type and / or data verification range of the first data to be verified in the cache are consistent with those of the first data to be verified; and / or Send a second data verification request to the first server, so that the first server, in response to the second data verification request, sends the second data to be verified in the first database to the second server; Receive the second data to be verified sent by the first server, and perform data verification based on the second data to be verified and the second cached data to be verified in the corresponding cached database of the second server to obtain a second data verification result; the data types and / or data verification scopes of the second data to be verified and the second cached data to be verified are consistent.

12. The method according to claim 11, wherein The second data verification request includes a data online verification request; the second data to be verified includes all the data in the first database corresponding to the first server; The second cached data to be verified includes all the cached data in the cached database corresponding to the second server; the method further includes: After the cached data in the cached database is updated, generate a cache verification task and store the cache verification task in the second database corresponding to the data bypass of the second server; Regularly extract and execute the cache verification tasks in the to-be-executed state from the second database to trigger the step of sending the second data verification request to the first server.

13. The method according to claim 11, characterized in that After performing data verification based on the second data to be verified and the second cached data to be verified in the corresponding cached database of the second server to obtain a second data verification result, the method further includes: In the case where the second data verification result is that the second data to be verified is inconsistent with the second cached data to be verified, send a data cache warning message.

14. A data cache synchronization device, characterized in that, The device is applied to the first server, and the device includes: A first sending module, configured to, after a target event occurs on the first server, send the target data related to the target event to the second server across cities in the form of a transaction message, so that after the second server subscribes to the transaction message, synchronously cache the target data sent by the first server through the transaction message; A cache synchronization task generation module, configured to generate an asynchronous cache synchronization task after a target event occurs on the first server; the asynchronous cache synchronization task is to send the target data related to the target event to the second server through an asynchronous RPC method; A cache synchronization task execution module, configured to execute the asynchronous cache synchronization task, so that the second server performs asynchronous compensation synchronous caching based on the target data sent by the first server through asynchronous RPC.

15. A data cache synchronization device, characterized in that, The device is applied to the second server, and the device includes: A first synchronous cache module, configured to, after subscribing to the transaction message of the first server, synchronously cache the target data sent by the first server through the transaction message; the target data is the data corresponding to the target event that occurs on the first server; A first receiving module, configured to receive the target data sent by the first server through asynchronous RPC; A second synchronous cache module, configured to perform asynchronous compensation synchronous caching based on the target data sent by the first server through asynchronous RPC.

16. An electronic device, characterized in that, Includes: A processor and a memory; The processor is connected to the memory; The memory is used for storing executable program codes; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method according to any one of claims 1-13.

17. A computer storage medium, characterized in that, The computer storage medium stores a plurality of instructions, and the instructions are adapted to be loaded and executed by a processor to perform the method steps according to any one of claims 1-13.

18. A computer program product comprising instructions, characterized in that, When the computer program product runs on a computer or a processor, the computer or the processor is caused to execute the data cache synchronization method according to any one of claims 1-13.

Citation Information

Patent Citations

  • Call request processing method and device, electronic equipment and readable storage medium

    CN111638979A

  • Data backup method and device for virtual machine

    CN112988460A

  • Node.js-based RPC synchronous communication method and equipment

    CN113821355A

  • Database backup method and device, server and medium

    CN114153660A

  • Distributed service management method and device, server and storage medium

    CN117938928A