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

By employing a dual-link cache synchronization scheme combining cross-city transactional messages and asynchronous RPC, the problem of cached data consistency in internet finance scenarios was solved, achieving timely, accurate, and stable data synchronization and compensating for the shortcomings of single-link dependency.

CN120336047BActive Publication Date: 2025-10-28CHONGQING ANT CONSUMER FINANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In internet finance scenarios, existing technologies suffer from issues such as dirty data, data latency, and data loss in cached data consistency, leading to inconsistent cached data. Furthermore, solutions that rely on message middleware or RPC gateways for a single link are risky.

Method used

A dual-link cache synchronization scheme is adopted, which uses cross-city transaction messages and asynchronous RPC as a fallback compensation. The target data is sent across cities through transaction messages and an asynchronous cache synchronization task is generated. Asynchronous RPC is used to compensate for the cache synchronization, ensuring that the data is synchronized in a timely and accurate manner on the second server.

Benefits of technology

It improves the timeliness, accuracy and stability of data cache synchronization, avoids delays or loss caused by message middleware jitter, and ensures the reliability of cache synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120336047B_ABST
    Figure CN120336047B_ABST
Patent Text Reader

Abstract

This specification discloses a data cache synchronization method, apparatus, electronic device, medium, and program product. The method includes: after a target event occurs on a first server, the first server sends target data related to the target event across cities to a second server via a transaction message. Upon subscribing to the transaction message, the second server synchronously caches the target data sent by the first server via the transaction message. After the target event occurs on the first server, an asynchronous cache synchronization task can also be generated and executed. This asynchronous cache synchronization task sends the target data related to the target event to the second server via asynchronous RPC. The second server then performs asynchronous compensation synchronization caching based on the target data sent by the first server via asynchronous RPC. This mitigates the single-link failure risk of relying solely on message middleware or RPC gateways in the cache synchronization link, ensuring the timeliness, accuracy, and stability of data cache synchronization.
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 in particular to a data cache synchronization method, apparatus, electronic device, medium, and program product. Background Technology

[0002] In internet finance scenarios, in order to improve customer experience (such as payment scenarios), data caching solutions are often used in the technical architecture design. This greatly reduces the time spent on the link, thereby achieving a smooth customer experience. At the same time, it also reduces unnecessary link dependencies and system interactions to a certain extent, thus improving system stability. Summary of the Invention

[0003] This specification provides a data cache synchronization method, apparatus, electronic device, medium, and program product. Through a dual-link cache synchronization scheme using cross-city transaction messages and asynchronous RPC as fallback compensation, it mitigates the risk of single-link failures that rely solely on message middleware or RPC gateways for cache synchronization, ensuring the timeliness, accuracy, and stability of data cache synchronization. The above technical solution is as follows:

[0004] In a first aspect, embodiments of this specification provide a data cache synchronization method, which is applied to a first server, and the method includes:

[0005] After the 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 the second server can synchronously cache the target data sent by the first server through the transaction message after subscribing to the transaction message.

[0006] After the target event occurs on the first server, an asynchronous cache synchronization task is generated; the asynchronous cache synchronization task sends the target data related to the target event to the second server via asynchronous RPC.

[0007] The above asynchronous cache synchronization task is executed so that the second server performs asynchronous compensation synchronization cache based on the target data sent by the first server via asynchronous RPC.

[0008] Secondly, this specification provides another data cache synchronization method, which is applied to a second server. The method includes:

[0009] 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 data related to the target event that occurred on the first server.

[0010] Received the target data sent by the first server via asynchronous RPC;

[0011] Asynchronous compensation and synchronous caching are performed based on the target data sent by the first server via asynchronous RPC.

[0012] Thirdly, embodiments of this specification provide a data cache synchronization device, which is applied to a first server, and the device includes:

[0013] The first sending module is used to send the target data related to the target event across cities to the second server in the form of a transaction message after the first server has a target event, so that the second server can synchronously cache the target data sent by the first server in the transaction message after subscribing to the transaction message.

[0014] The cache synchronization task generation module is used to generate an asynchronous cache synchronization task after the target event occurs on the first server. The asynchronous cache synchronization task sends the target data related to the target event to the second server via asynchronous RPC.

[0015] The cache synchronization task execution module is used to execute the above-mentioned asynchronous cache synchronization task so that the second server performs asynchronous compensation synchronization caching based on the target data sent by the first server via asynchronous RPC.

[0016] Fourthly, embodiments of this specification provide another data cache synchronization device, which is applied to a second server, and the device includes:

[0017] The first synchronization cache module is used to synchronize and cache the target data sent by the first server through the transaction message after subscribing to the transaction message of the first server; the target data is the data corresponding to the target event that occurred on the first server.

[0018] The first receiving module is used to receive the target data sent by the first server via asynchronous RPC.

[0019] The second synchronous cache module is used to perform asynchronous compensation synchronous caching based on the target data sent by the first server via asynchronous RPC.

[0020] Fifthly, embodiments of this specification provide an electronic device, including: a processor and a memory;

[0021] The processor is connected to the memory.

[0022] The aforementioned memory is used to store executable program code;

[0023] The processor reads the executable program code stored in the memory to run a program corresponding to the executable program code, so as to execute the method provided in the first or second aspect of the embodiments of this specification.

[0024] Sixthly, embodiments of this specification provide a computer storage medium storing a plurality of instructions adapted for a processor to load and execute the method provided in the first or second aspect of embodiments of this specification.

[0025] In a seventh aspect, embodiments of this specification provide a computer program product containing instructions that, when run on a computer or processor, cause the computer or processor to execute the data cache synchronization method provided in the first or second aspect of embodiments of this specification.

[0026] In this embodiment, 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 via a transaction message. This allows the second server, upon subscribing to the transaction message, to synchronously cache the target data sent by the first server via the transaction message. After the target event occurs on the first server, the first server generates and executes an asynchronous cache synchronization task. This asynchronous cache synchronization task sends the target data related to the target event to the second server via asynchronous RPC. This allows the second server to perform asynchronous compensation synchronization caching based on the target data sent by the first server via asynchronous RPC. This dual-link cache synchronization scheme, using cross-city transaction messages and asynchronous RPC as fallback compensation, avoids the problem of message delays or loss due to message middleware jitter in extreme cases, which could lead to dirty data. It also mitigates the risk of single-link failures that rely solely on message middleware or RPC gateways in the cache synchronization link, ensuring the timeliness, accuracy, and stability of data cache synchronization. Attached Figure Description

[0027] To more clearly illustrate the technical solutions in the embodiments of this specification, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0028] Figure 1 A schematic diagram of the architecture of a data caching system provided for an exemplary embodiment of this specification;

[0029] Figure 2 A flowchart illustrating a data cache synchronization method provided as an exemplary embodiment of this specification;

[0030] Figure 3A schematic diagram of an implementation architecture for data cache synchronization provided as an exemplary embodiment of this specification;

[0031] Figure 4 A schematic diagram illustrating the implementation flow of a data cache verification method provided for an exemplary embodiment of this specification;

[0032] Figure 5 A schematic diagram of an implementation architecture for data cache verification provided as an exemplary embodiment of this specification;

[0033] Figure 6 A schematic diagram illustrating a data verification and inclusion relationship provided for an exemplary embodiment of this specification;

[0034] Figure 7 A schematic diagram of a data cache synchronization device provided for an exemplary embodiment of this specification;

[0035] Figure 8 A schematic diagram of another data cache synchronization device provided as an exemplary embodiment of this specification;

[0036] Figure 9 This is a schematic diagram of the structure of an electronic device provided as an exemplary embodiment of this specification. Detailed Implementation

[0037] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings.

[0038] The terms "first," "second," "third," etc., used in this specification, claims, and the foregoing drawings are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such processes, methods, products, or apparatus.

[0039] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used 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 related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the target data and data to be verified involved in this specification were obtained under full authorization.

[0040] In internet finance scenarios, while data caching solutions have greatly optimized the time consumption, they often face significant challenges in terms of cached data consistency. For example, dirty data, data latency, and data loss can all lead to cached data inconsistency.

[0041] Based on this, the embodiments of this specification provide a data cache synchronization method. Through a dual-link cache synchronization scheme with cross-city transaction messages and asynchronous RPC as a fallback, it makes up for the risk of single-link failures that rely solely on message middleware or RPC gateways on the cache synchronization link, and ensures the timeliness, accuracy and stability of data cache synchronization.

[0042] Please refer to the following. Figure 1 , Figure 1 This is a schematic diagram of the architecture of a data caching system provided for an exemplary embodiment of this specification. Figure 1 As shown, the data caching system may include: a first server 110 and a second server 120. Wherein:

[0043] The first server 110 may be, but is not limited to, the server corresponding to the first city data center. It is a core component of the first city data center, used to run applications and process user requests. Protocol signing applications may be installed on the first server 110 to provide protocol signing services to users. After a target event occurs on the first server, the first server 110 can send the target data related to the target event across cities to the second server 120 via transactional messages, and generate and execute an asynchronous cache synchronization task. The asynchronous cache synchronization task sends the target data related to the target event to the second server 120 via asynchronous RPC. The first server 110 may be, but is not limited to, a hardware server, a virtual server, a cloud server, etc.

[0044] The second server 120 can be a server corresponding to the second city data center that can provide various data caching methods. After subscribing to transaction messages from the first server 110, it can synchronously cache the target data sent by the first server 110 through transaction messages; and upon receiving target data sent by the first server 110 through asynchronous RPC, it can asynchronously compensate and synchronously cache the target data sent by the first server 110 through asynchronous RPC. The second server 120 can be, but is not limited to, a hardware server, a virtual server, a cloud server, etc.

[0045] The network can be a medium that provides a communication link between the second server 120 and the first server 110, or it can be the Internet, which includes network equipment and transmission media, and is not limited thereto. The transmission media can be a wired link, such as, but not limited to, coaxial cable, fiber optic cable, and digital subscriber line (DSL), or a wireless link, such as, but not limited to, wireless fidelity (WIFI), Bluetooth, and mobile device networks.

[0046] Understandably, Figure 1 The number of first servers 110 and second servers 120 in the data caching system shown is merely an example. In a specific implementation, the data caching system can contain any number of first servers 110 and second servers 120. This specification does not specifically limit this. For example, but not limited to, the first server 110 can be a first server cluster composed of multiple first servers, and the second server 120 can be a second server cluster composed of multiple second servers.

[0047] Next, combine Figure 1 This document describes the data cache synchronization method provided in the embodiments of this specification. Please refer to [link / reference needed] for details. Figure 2 This is a flowchart illustrating a data cache synchronization method provided in an exemplary embodiment of this specification. Figure 2 As shown, this data cache synchronization method includes the following steps:

[0048] S201, after the target event occurs, the first server sends the target data related to the target event to the second server across cities in the form of a transaction message.

[0049] Specifically, the aforementioned target events may include, but are not limited to, agreement signing events or other events requiring data cache synchronization. The agreement signing event refers to the process by which a user and the service provider corresponding to the first server establish a legally binding service agreement through electronic signatures, API calls, or user interface operations, such as, but not limited to, a user signing an online loan contract. When the first server detects a target event, it may, but is not limited to, encapsulate the target data related to that event (such as, but not limited to, the agreement identifier, user information, timestamps, etc.) into a transaction message and send it to the second server via a message queue supporting the XA protocol. This ensures that the target data related to the target event is not lost during cross-city cache synchronization and guarantees the atomicity of message transmission and the local transaction on the first server. The aforementioned transaction message refers to a message sent by the application system publishing the message within 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 is delivered to the subscribers; when the transaction state is rolled back, the message is not delivered to the subscribers.

[0050] Optionally, while encapsulating the target data related to the target event (such as, but not limited to, the signed agreement identifier, user information, timestamp, etc.) into a transactional message, first version information may also be generated based on, but is not limited to, the Lamport clock algorithm. The target data sent by the first server via the transactional message carries this first version information. This first version information is used to identify the freshness of the target data sent by the first server via the transactional message, supporting the second server receiving the target data in deciding whether it needs to synchronously cache the target data sent by the first server via the transactional message. The aforementioned first version information may include, but is not limited to, the first version number of the target data sent by the first server via the transactional message.

[0051] S202, after subscribing to the transaction message, the second server synchronously caches the target data sent by the first server through the transaction message.

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

[0053] Optionally, the target data sent by the first server via transaction messages carries first version information. After subscribing to the transaction messages, the second server can first determine whether the first version information is greater than the current version information in the second server's corresponding cache database (i.e., the latest version information cached locally by the second server). Then, if the first version information is greater than the current version information, it means that the second server has not synchronously cached the target data corresponding to the first version information, and the target data sent by the first server via transaction messages has been updated. In this case, the step of synchronizing and caching the target data sent by the first server via transaction messages can be executed. This avoids the second server from repeatedly synchronizing caches or caching outdated invalid data through version comparison, thereby improving the utilization and effectiveness of cache synchronization.

[0054] S203, after the target event occurs, the first server generates an asynchronous cache synchronization task.

[0055] Specifically, after a target event occurs on the first server, in addition to sending the target data related to the target event across cities to the second server via transactional messages, it also asynchronously generates a compensation task (i.e., an asynchronous cache synchronization task) to encapsulate the same target data for the same target event. This embodiment of the specification can both asynchronously handle deletion scenarios where messages are lost or synchronization fails during data cache synchronization through the aforementioned asynchronous cache synchronization task, and reduce the latency impact on the core transactions of the first server through asynchronous processing.

[0056] Optionally, the aforementioned asynchronous cache synchronization tasks can be scheduled through a distributed task queue, with appropriate initial delays and retry strategies set.

[0057] S204, the first server executes an asynchronous cache synchronization task, which involves sending target data related to the target event to the second server via asynchronous RPC.

[0058] Specifically, the first server can, but is not limited to, executing asynchronous cache synchronization tasks according to a scheduling policy, that is, sending target data related to the target event to the second server via asynchronous RPC. The aforementioned asynchronous RPC is a non-blocking remote service call mechanism that allows the first server to continue performing other operations after sending the target data related to the target event.

[0059] Optionally, the target data sent by the first server via asynchronous RPC carries second version information. This second version information is used to determine whether to asynchronously compensate for synchronous caching of the target data sent by the first server via asynchronous RPC. The second version information is used to identify the freshness of the target data sent by the second server via asynchronous RPC, enabling the second server receiving the target data to decide whether it needs to synchronously cache the target data sent by the first server via 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 via asynchronous RPC.

[0060] Optionally, after generating an asynchronous cache synchronization task, but before executing it, the first server may, but is not limited to, record the asynchronous cache synchronization task in the first database corresponding to the first server. Then, it periodically retrieves and executes asynchronous cache synchronization tasks in the pending execution state from the first database.

[0061] S205, the second server performs asynchronous compensation synchronous caching based on the target data sent by the first server via asynchronous RPC.

[0062] Specifically, the target data sent by the first server via asynchronous RPC carries second version information. After receiving the target data sent by the first server via asynchronous RPC, the second server first determines whether the second version information is greater than the current version information in the corresponding cache database of the second server. If the second version information is greater than the current version information, it means that the second server has not synchronously cached the target data corresponding to the second version information, and the target data sent by the first server via asynchronous RPC has been updated. In this case, the target data sent by the first server via asynchronous RPC can be asynchronously compensated and synchronously cached. This can handle the deletion scenario of message loss or synchronization failure during data cache synchronization through asynchronous compensation and synchronous caching, and avoid the second server from repeatedly synchronizing the cache or caching outdated invalid data through version comparison, thereby improving the utilization and effectiveness of cache synchronization.

[0063] For example, such as Figure 3As shown, the first server has a protocol center program installed. When a user completes the protocol signing through this program, the first server not only caches and synchronizes the target data related to the target event in the protocol center program to the second server in the form of cross-city transaction messages, but also generates corresponding asynchronous cache synchronization tasks and records them in the first database. Then, it periodically polls, retrieves, and executes the asynchronous cache synchronization tasks in the first database that are in a pending state to perform asynchronous RPC compensation cache synchronization. After the data view application installed on the second server subscribes to the cross-city transaction message, it can refer to a process similar to S202 above to synchronize and cache the corresponding target data in its cache database. After the second server receives the target data sent by the first server via asynchronous RPC, it can refer to a process similar to S205 above to perform compensation synchronization caching of the corresponding target data in its cache database.

[0064] In this embodiment, 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 via a transaction message. This allows the second server, upon subscribing to the transaction message, to synchronously cache the target data sent by the first server via the transaction message. After the target event occurs on the first server, the first server generates and executes an asynchronous cache synchronization task. This asynchronous cache synchronization task sends the target data related to the target event to the second server via asynchronous RPC. This allows the second server to perform asynchronous compensation synchronization caching based on the target data sent by the first server via asynchronous RPC. This dual-link cache synchronization scheme, using cross-city transaction messages and asynchronous RPC as fallback compensation, avoids the problem of message delays or loss due to message middleware jitter in extreme cases, which could lead to dirty data. It also mitigates the risk of single-link failures that rely solely on message middleware or RPC gateways in the cache synchronization link, ensuring the timeliness, accuracy, and stability of data cache synchronization.

[0065] In related data cache synchronization schemes, after synchronizing data caches via transactional messages, proactive real-time verification is also used to detect cache synchronization consistency issues. However, this proactive real-time cache verification scheme is singular and cannot cover all verification scenarios, potentially leading to omissions and the generation of dirty cached data.

[0066] Based on this, the embodiments in this specification propose a more comprehensive data cache verification method after data cache synchronization. Please refer to the following... Figure 4 This is a schematic diagram illustrating the implementation flow of a data cache verification method provided in an exemplary embodiment of this specification. For example... Figure 4 As shown, this data cache verification method may include, but is not limited to, the following steps:

[0067] S401, the first server sends the first data verification request to the second server.

[0068] Specifically, the aforementioned 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, and full verification. The triggering conditions for online data verification and offline data verification are different.

[0069] The online data verification methods described above may include, but are not limited to, active verification and passive verification. Active verification refers to the consistency verification initiated by the data updater (i.e., the first server) between the cached data in the second server's corresponding cache database and the data in the first database corresponding to the first server. Its implementation process is similar to S401-S403. Passive verification refers to the consistency verification initiated when the second server's corresponding cache database is refreshed, between the cached data in the cache database and the data in the first database corresponding to the first server. Its implementation process is similar to S404-S406.

[0070] Optionally, the aforementioned first data verification request may include, but is not limited to, an online data verification request; the aforementioned first cached data to be verified may include, but is not limited to, the full cached data in the cache database corresponding to the second server; and the aforementioned first data to be verified may include, but is not limited to, the full data in the first database corresponding to the first server. After a target event occurs on the first server, the first server can save the target data related to the target event to the first database corresponding to the first server. Furthermore, when the data stored in the first database is updated (changed), the aforementioned step of sending the first data verification request to the second server will be triggered, that is, triggering online active data cache verification. The aforementioned full data may include, but is not limited to, the data related to the target event corresponding to the target user who has currently completed the agreement signing in the first database, thereby ensuring that efficient and real-time cached data verification can be achieved for the target user who has currently signed the agreement, and timely ensuring the consistency of its data cache synchronization.

[0071] Optionally, the aforementioned first data verification request may also include, but is not limited to, an offline data verification request. This offline data verification request carries the target data type and 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 past week, the past month, the past three months, etc. The incremental data refers to newly generated data within the target data verification time period. Upon reaching the preset offline verification time (e.g., but not limited to, 24:00 every weekend, the 1st of every month, etc.) or upon receiving a data offline verification instruction, the step of sending the first data verification request to the second server will be triggered. The full data may include, but is not limited to, data related to the target event for all users who have completed the agreement signing in the first database.

[0072] S402, in response to the first data verification request, the second server sends the first cached data to be verified in the corresponding cache database of the second server to the first server.

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

[0074] Optionally, when the aforementioned first data verification request is an offline data verification request, the offline data verification request may, but is not limited to, carry the target data type and 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 cache database based on the target data type and target data verification range, and then return the first cached data to be verified to the first server.

[0075] S403, 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 the first data verification result.

[0076] Specifically, the data type and / or data verification range of the first cached data to be verified are consistent with those of the first data to be verified. After receiving the first cached data to be verified returned by the second server, the first server will perform a data verification based on the first cached data to be verified and the corresponding first data to be verified in its first data. For example, but not limited to, verifying whether the field information corresponding to the first cached data to be verified and the first data to be verified are consistent, to obtain the first data verification result.

[0077] Optionally, if the first data verification result shows that the first cached data to be verified is inconsistent with the first data to be verified, a data cache alarm message is issued to promptly remind relevant personnel of the abnormal situation of data cache inconsistency and prompt them to check whether there is a problem with the data cache link.

[0078] and / or

[0079] Please continue to refer to the following. Figure 4 ,like Figure 4 As shown, this data cache verification method may also include, but is not limited to, the following steps:

[0080] S404, the second server sends a second data verification request to the first server.

[0081] Specifically, the aforementioned second data verification request may include, but is not limited to, online data verification requests. After the cached data in the second server's corresponding cache database is updated (changed), the second server generates a cache verification task and stores it in the second database corresponding to the second server's data bypass. Then, cache verification tasks in a pending state are periodically retrieved from the second database and executed to trigger the sending of a second data verification request to the first server.

[0082] S405, the first server responds to the second data verification request by sending the second data to be verified in the first database corresponding to the first server to the second server.

[0083] Optionally, the aforementioned second data verification request may, but is not limited to, carry a user identifier whose corresponding cached data to be verified has been updated (changed). After receiving the second data verification request, the first server may first query the first database based on the user identifier to obtain the corresponding second data to be verified, 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.

[0084] 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, and obtains the second data verification result.

[0085] Specifically, the data types and / or data verification ranges corresponding to the 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 described again here.

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

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

[0088] Optionally, if the second data verification result shows that the second cached data to be verified is inconsistent with the second cached data to be verified, a data cache alarm message is issued to promptly remind relevant personnel of the abnormal situation of data cache inconsistency and prompt them to check whether there is a problem with the data cache link.

[0089] For example, such as Figure 5 As shown, the first server has a protocol center program installed. When the data in the first database corresponding to the protocol center changes, the first server triggers an active verification (online verification), that is, it requests the corresponding first cached data to be verified from the second server's data bypass to verify its own first data to be verified, and obtains the first data verification result. When the current time reaches the preset offline verification time (e.g., but not limited to 24:00 every weekend, the 1st of every month, etc.) or when it receives a data offline verification instruction, the first server also triggers an active verification (offline verification), that is, it requests the corresponding first cached data to be verified from the second server's data bypass to verify its own first data to be verified, and obtains the first data verification result. At this time, if an offline incremental cache verification is triggered, the first data to be verified may be, but is not limited to, the incremental dataset obtained after offline processing of the changed protocol data within the target time period; if an offline full cache verification is triggered, the first data to be verified may be, but is not limited to, the full dataset obtained after offline processing of all protocol data in the first database. When the cached data in the cache 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 and verify it with its own second cached data to obtain the second data verification result.

[0090] The data verification scope relationships among the above-mentioned online cache verification, incremental verification, and full verification are as follows: Figure 6 As shown. In the embodiments of this specification, by Figure 6The three-level cache verification system shown can cover, but is not limited to, verification mechanisms with three different time-sensitive dimensions: online second-level verification, offline daily incremental verification, and monthly full verification. It also covers two verification directions: active verification and passive verification, avoiding the risk of missed verification. Thus, through a verification scheme with multiple time-sensitive periods and multiple directions, it can detect cache synchronization inconsistency issues 100% and handle them in a timely manner, effectively ensuring cache consistency.

[0091] Please refer to the following. Figure 7 , Figure 7 This is a schematic diagram of a data cache synchronization device provided for an exemplary embodiment of this specification. The aforementioned data cache synchronization device is applied to a first server, such as... Figure 7 As shown, the data cache synchronization device 700 includes:

[0092] The first sending module 710 is used to send target data related to the target event across cities to the second server in the form of a transaction message after the first server has a target event, so that the second server can synchronously cache the target data sent by the first server in the transaction message after subscribing to the transaction message.

[0093] The cache synchronization task generation module 720 is used to generate an asynchronous cache synchronization task after the target event occurs on the first server; the asynchronous cache synchronization task sends the target data related to the target event to the second server via asynchronous RPC.

[0094] The cache synchronization task execution module 730 is used to execute the above-mentioned asynchronous cache synchronization task so that the second server performs asynchronous compensation synchronization caching based on the target data sent by the first server via asynchronous RPC.

[0095] In one possible implementation, the target data sent by the first server via a transactional message carries first version information, which is used to decide whether to synchronously cache the target data sent by the first server via the transactional message; the target data sent by the first server via asynchronous RPC carries second version information, which is used to decide whether to asynchronously compensate for synchronous caching of the target data sent by the first server via asynchronous RPC.

[0096] In one possible implementation, the data cache synchronization device 700 further includes:

[0097] The recording module is used to record the above asynchronous cache synchronization tasks to the first database corresponding to the first server.

[0098] The aforementioned cache synchronization task execution module 730 is specifically used for:

[0099] Periodically extract and execute asynchronous cache synchronization tasks that are in a pending state from the first database mentioned above.

[0100] In one possible implementation, the data cache synchronization device 700 further includes:

[0101] The second sending module is used to send a first data verification request to the second server, so that the second server responds to the first data verification request and sends the first cached data to be verified in the cache database corresponding to the second server.

[0102] The first receiving module is used to receive the first cached data to be verified sent by the second server, and to perform 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, to obtain a first data verification result; the data type and / or data verification range of the first cached data to be verified are consistent with those of the first data to be verified.

[0103] and / or

[0104] The second receiving module is used to receive the second data verification request sent by the second server mentioned above.

[0105] The third sending module is used to respond to the second data verification request and 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 data to be verified cached in the cache database corresponding to the second server, and obtains the second data verification result; the data type and / or data verification range of the second data to be verified are consistent with those of the second data to be verified cached.

[0106] In one possible implementation, the first data verification request includes an online data verification request; the first cached data to be verified includes the full cached data in the cache database corresponding to the second server; the first data to be verified includes the full data in the first database corresponding to the first server; the data cache synchronization device 700 further includes:

[0107] The storage module is used to save the target data related to the target event to the first database corresponding to the first server after the target event occurs on the first server.

[0108] The first execution module is used to execute the step of sending a first data verification request to the second server after the data stored in the first database is updated.

[0109] In one possible implementation, the first data verification request includes an offline data verification request; the offline data verification request carries the target data type and 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 data cache synchronization device 700 further includes:

[0110] The second execution module is used to execute the above-mentioned step of sending the first data verification request to the second server after the current time reaches the preset offline verification time or after receiving the data offline verification instruction.

[0111] In one possible implementation, the data cache synchronization device 700 further includes:

[0112] The alarm module is used to issue a data cache alarm message when the first data verification result is inconsistent with the first cached data to be verified.

[0113] Please refer to the following. Figure 8 , Figure 8 This is a schematic diagram illustrating the structure of another data cache synchronization device provided as an exemplary embodiment of this specification. The aforementioned data cache synchronization device is applied to a second server, such as... Figure 8 As shown, the data cache synchronization device 800 includes:

[0114] The first synchronization cache module 810 is used to synchronize and cache the target data sent by the first server through the transaction message after subscribing to the transaction message of the first server; the target data is the data corresponding to the target event that occurred on the first server.

[0115] The first receiving module 820 is used to receive the target data sent by the first server via asynchronous RPC.

[0116] The second synchronous cache module 830 is used to perform asynchronous compensation synchronous caching based on the target data sent by the first server via asynchronous RPC.

[0117] In one possible implementation, the target data sent by the first server via a transaction message carries first version information; the data cache synchronization device 800 further includes:

[0118] The first judgment module is used to determine whether the first version information is greater than the current version information in the cache database corresponding to the second server.

[0119] The first execution module is used to perform the step of synchronously caching the target data sent by the first server through transaction messages when the first version information is greater than the current version information.

[0120] In one possible implementation, the target data sent by the first server via asynchronous RPC carries second version information; the data cache synchronization device 800 further includes:

[0121] The second judgment module is used to determine whether the above second version information is greater than the current version information in the cache database corresponding to the above second server;

[0122] The second execution module is used to execute the above-mentioned steps of asynchronous compensation and synchronous caching based on the target data sent by the first server via asynchronous RPC when the second version information is greater than the current version information.

[0123] In one possible implementation, the data cache synchronization device 800 further includes:

[0124] The second receiving module is used to receive the first data verification request sent by the first server.

[0125] The first sending module is configured to respond to the first data verification request by sending 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 the first data verification result; the data type and / or data verification range of the first cached data to be verified are consistent with those of the first data to be verified.

[0126] and / or

[0127] The second sending module is used to send a second data verification request to the first server, so that the first server responds to the second data verification request and sends the second data to be verified in the first database corresponding to the first server.

[0128] The third receiving module is used to receive the second data to be verified sent by the first server, and to perform data verification based on the second data to be verified and the second data to be verified cached in the cache database corresponding to the second server, so as to obtain the second data verification result; the data type and / or data verification range of the second data to be verified are consistent with those of the second data to be verified cached.

[0129] In one possible implementation, the second data verification request includes an online data verification request; the second data to be verified includes all data in the first database corresponding to the first server; the second cached data to be verified includes all cached data in the cache database corresponding to the second server; the data cache synchronization device 800 further includes:

[0130] The task generation module is used to generate cache verification tasks after the cached data in the cache database is updated.

[0131] The task storage module is used to store the above-mentioned cache verification tasks in the second database corresponding to the data bypass of the second server.

[0132] The task execution module is used to periodically extract and execute cache verification tasks that are in a pending state from the second database, so as to trigger the step of sending a second data verification request to the first server.

[0133] In one possible implementation, the data cache synchronization device 800 further includes:

[0134] The alarm module is used to issue a data cache alarm message when the second data verification result is inconsistent between the second data to be verified and the second cached data to be verified.

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

[0136] Please refer to the following. Figure 9 , Figure 9 This is a schematic diagram of the structure of an electronic device provided as an exemplary embodiment of this specification. For example... Figure 9 As 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. The communication bus 920 can be used to enable communication between the aforementioned components.

[0137] The user interface 930 may include a display screen and a camera. Optionally, the user interface 930 may also include a standard wired interface and a wireless interface.

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

[0139] The processor 910 may include one or more processing cores. The processor 910 connects to various parts within the electronic device 900 using various interfaces and lines, and performs various functions and processes data of the routing electronic device 900 by running or executing instructions, programs, code sets, or instruction sets stored in the memory 950, and by calling data stored in the memory 950. Optionally, the processor 910 may be implemented using 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 one or a combination of several of the following: a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), and a modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 910 and may be implemented as a separate chip.

[0140] The memory 950 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 950 may include a non-transitory computer-readable medium. The memory 950 may 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, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as data cache synchronization function, data cache verification function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 950 may also be at least one storage device located remotely from the aforementioned processor 910. Figure 9 As shown, the memory 950, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and application programs.

[0141] Specifically, the aforementioned electronic device 900 can be Figure 7 The data cache synchronization device 700 or the first server shown above, wherein the processor 910 can be used to call the application stored in the memory 950 and specifically perform the following operations:

[0142] After the 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 the second server can synchronously cache the target data sent by the first server through the transaction message after subscribing to the transaction message.

[0143] After the target event occurs on the first server, an asynchronous cache synchronization task is generated; the asynchronous cache synchronization task sends the target data related to the target event to the second server via asynchronous RPC.

[0144] The above asynchronous cache synchronization task is executed so that the second server performs asynchronous compensation synchronization cache based on the target data sent by the first server via asynchronous RPC.

[0145] In some possible embodiments, the target data sent by the first server via a transaction message carries first version information, which is used to decide whether to synchronously cache the target data sent by the first server via a transaction message; the target data sent by the first server via asynchronous RPC carries second version information, which is used to decide whether to asynchronously compensate for synchronous caching of the target data sent by the first server via asynchronous RPC.

[0146] In some possible embodiments, after the processor 910 executes the asynchronous cache synchronization task, and before executing the asynchronous cache synchronization task, it is further configured to execute:

[0147] The above asynchronous cache synchronization tasks are recorded in the first database corresponding to the first server.

[0148] When the processor 910 executes the asynchronous cache synchronization task, it specifically performs the following:

[0149] Periodically extract and execute asynchronous cache synchronization tasks that are in a pending state from the first database mentioned above.

[0150] In some possible embodiments, the processor 910 described above is also used to perform:

[0151] A first data verification request is sent to the second server, so that the second server responds to the first data verification request by sending the first cached data to be verified in the cache database corresponding to the second server.

[0152] The system receives the first cached data to be verified sent by the second server, and 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 to obtain a first data verification result; the data type and / or data verification range of the first cached data to be verified are consistent with those of the first data to be verified.

[0153] and / or

[0154] Receive the second data verification request sent by the second server.

[0155] In response to the second data verification request, the second data to be verified in the first database corresponding to the first server is sent to the second server, so that 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, and obtains the second data verification result; the data type and / or data verification range of the second data to be verified are consistent with those of the second cached data to be verified.

[0156] In some possible embodiments, the first data verification request includes an online data verification request; the first cached data to be verified includes the full cached data in the cache database corresponding to the second server; the first data to be verified includes the full data in the first database corresponding to the first server; the processor 910 is further configured to perform:

[0157] After the target event occurs on the first server, the target data related to the target event is saved to the first database corresponding to the first server.

[0158] After the data stored in the first database is updated, the step of sending the first data verification request to the second server is executed.

[0159] In some possible embodiments, the first data verification request includes an offline data verification request; the offline data verification request carries the target data type and 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 processor 910 is further configured to perform:

[0160] Once the preset offline verification time is reached or a data offline verification instruction is received, the above-mentioned steps of sending the first data verification request to the second server are executed.

[0161] In some possible embodiments, after the processor 910 performs the 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 the first data verification result, it is further configured to perform:

[0162] If the result of the first data verification is that the first cached data to be verified is inconsistent with the first cached data to be verified, a data cache alarm message is issued.

[0163] In some possible embodiments, the above-described electronic device 900 may be Figure 8 The data cache synchronization device 800 or the second server shown above, wherein the processor 910 can be used to call the application stored in the memory 950 and specifically perform the following operations:

[0164] 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 data related to the target event that occurred on the first server.

[0165] The target data was received from the first server via asynchronous RPC.

[0166] Asynchronous compensation and synchronous caching are performed based on the target data sent by the first server via asynchronous RPC.

[0167] In some possible embodiments, the target data sent by the first server via a transaction message carries first version information; the processor 910 is also configured to perform:

[0168] Determine whether the first version information is greater than the current version information in the cache database corresponding to the second server.

[0169] If the first version information is greater than the current version information, perform the step of synchronously caching the target data sent by the first server via transaction messages.

[0170] In some possible embodiments, the target data sent by the first server via asynchronous RPC carries second version information; the processor 910 is also used to perform:

[0171] Determine whether the second version information is greater than the current version information in the cache database corresponding to the second server.

[0172] If the second version information is greater than the current version information, perform the asynchronous compensation synchronous caching step based on the target data sent by the first server via asynchronous RPC.

[0173] In some possible embodiments, the processor 910 described above is also used to perform:

[0174] Receive the first data verification request sent by the first server.

[0175] In response to the first data verification request, the first cached data to be verified in the cache database corresponding to the second server is sent 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 the first data verification result; the data type and / or data verification range of the first cached data to be verified are consistent with those of the first data to be verified.

[0176] and / or

[0177] A second data verification request is sent to the first server, so that the first server responds to the second data verification request by sending the second data to be verified in the first database corresponding to the first server.

[0178] The system receives the second data to be verified sent by the first server and performs data verification based on the second data to be verified and the second data to be verified cached in the corresponding cache database of the second server to obtain a second data verification result; the data type and / or data verification range of the second data to be verified are consistent with those of the second data to be verified cached.

[0179] In some possible embodiments, the second data verification request includes an online data verification request; the second data to be verified includes all data in the first database corresponding to the first server; the second cached data to be verified includes all cached data in the cache database corresponding to the second server; the processor 910 is further configured to perform:

[0180] After the cached data in the aforementioned cache database is updated, a cache verification task is generated and stored in the second database corresponding to the data bypass of the aforementioned second server.

[0181] Periodically extract and execute cache verification tasks that are in a pending state from the second database to trigger the step of sending a second data verification request to the first server.

[0182] 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, and obtains the second data verification result, it is further used to perform:

[0183] If the result of the second data verification is that the second data to be verified is inconsistent with the second cached data to be verified, a data cache alarm message will be issued.

[0184] This specification also provides a computer-readable storage medium storing instructions that, when executed on a computer or processor, cause the computer or processor to perform one or more steps in the above embodiments. If the constituent modules of the above-described data cache synchronization device are implemented as software functional units and sold or used as independent products, they can be stored in the above-described computer-readable storage medium.

[0185] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this specification are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired means, such as coaxial cable, fiber optic cable, Digital Subscriber Line (DSL), or wireless means (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The aforementioned available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., Digital Versatile Discs, DVDs), or semiconductor media (e.g., Solid State Disks, SSDs).

[0186] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks. Unless otherwise specified, the technical features of this embodiment and its implementation can be combined arbitrarily.

[0187] The embodiments described above are merely preferred embodiments of this specification and are not intended to limit the scope of this specification. Any modifications and improvements made by those skilled in the art to the technical solutions of this specification without departing from the spirit of this specification should fall within the protection scope defined by the claims.

[0188] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims and specification may be performed in a different order than in the embodiments described in the specification and still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some 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 the first server experiences a target event, it sends the target data related to the target event across cities to the second server in the form of a transaction message, so that the second server can synchronously cache the target data sent by the first server through the transaction message after subscribing to the transaction message; After the target event occurs on the first server, an asynchronous cache synchronization task is generated; the asynchronous cache synchronization task sends the target data related to the target event to the second server via asynchronous RPC. The asynchronous cache synchronization task is executed so that the second server performs asynchronous compensation synchronization caching based on the target data sent by the first server via asynchronous RPC; the asynchronous compensation synchronization caching includes caching the target data sent by the first server via asynchronous RPC in the case that the second server does not have the target data sent by the first server via asynchronous RPC synchronized in the cache.

2. The method as described in claim 1, characterized in that, The first server sends target data via transaction messages, which carries first version information. The first version information is used to decide whether to synchronously cache the target data sent by the first server via transaction messages. The target data sent by the first server via asynchronous RPC carries second version information, which is used to decide whether to asynchronously compensate for the synchronous cache of the target data sent by the first server via asynchronous RPC.

3. The method as described in claim 1, characterized in that, After generating the asynchronous cache synchronization task and before executing the asynchronous cache synchronization task, the method further includes: The asynchronous cache synchronization task is recorded in the first database corresponding to the first server; The execution of the asynchronous cache synchronization task includes: Periodically extract and execute asynchronous cache synchronization tasks that are in a pending state from the first database.

4. The method as described in claim 1, characterized in that, The method further includes: Send a first data verification request to the second server, so that the second server responds to the first data verification request by sending the first cached data to be verified in the cache database corresponding to the second server; The system receives the first cached data to be verified sent by the second server, and 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 to obtain a first data verification result; the data type and / or data verification range of the first cached data to be verified are consistent with those of the first data to be verified. and / or Receive the second data verification request sent by the second server; In response to the second data verification request, the second data to be verified in the first database corresponding to the first server is sent to the second server, so that 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, and obtains the second data verification result; the data type and / or data verification range of the second data to be verified are consistent with those of the second cached data to be verified.

5. The method as described in claim 4, characterized in that, The first data verification request includes an online data verification request; the first cached data to be verified includes the full cached data in the cache database corresponding to the second server; The first data to be verified includes all data in the 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 as described in claim 4, characterized in that, The first data verification request includes an offline data verification request; the offline data verification request carries the target data type to be verified and the target data verification range; 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: Once the preset offline verification time is reached or a data offline verification instruction is received, the step of sending the first data verification request to the second server is executed.

7. The method as described in claim 4, characterized in that, After performing 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 to obtain the first data verification result, the method further includes: If the result of the first data verification is that the first cached data to be verified is inconsistent with the first cached data to be verified, a data cache alarm 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 from the first server, the target data sent across cities by the first server through the transaction message is synchronously cached; the target data is data related to the target event that occurred on the first server; Received the target data sent by the first server via asynchronous RPC; Asynchronous compensation synchronous caching is performed based on the target data sent by the first server via asynchronous RPC; the asynchronous compensation synchronous caching includes caching the target data sent by the first server via asynchronous RPC synchronously when the second server does not synchronously cache the target data sent by the first server via asynchronous RPC.

9. The method as described in claim 8, characterized in that, The first server sends target data via transaction messages that carries first version information; the method further includes: Determine whether the first version information is greater than the current version information in the cache database corresponding to the second server; If 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 transaction messages is executed.

10. The method as described in claim 8, characterized in that, The first server sends target data via asynchronous RPC carrying second version information; the method further includes: Determine whether the second version information is greater than the current version information in the cache database corresponding to the second server; If the second version information is greater than the current version information, the step of asynchronously compensating for synchronous caching based on the target data sent by the first server via asynchronous RPC is executed.

11. The method as described in claim 8, characterized in that, The method further includes: Receive the first data verification request sent by the first server; In response to the first data verification request, the first cached data to be verified in the cache database corresponding to the second server is sent 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 type and / or data verification range of the first cached data to be verified 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 responds to the second data verification request by sending the second data to be verified from the first database to the second server; The system receives the second data to be verified sent by the first server, and performs data verification based on the second data to be verified and the second cached data to be verified in the corresponding cache database of the second server to obtain a second data verification result; the data type and / or data verification range of the second data to be verified are consistent with those of the second cached data to be verified.

12. The method as described in claim 11, characterized in that, The second data verification request includes an online data verification request; the second data to be verified includes all data in the first database corresponding to the first server; The second cached data to be verified includes the full cached data in the cache database corresponding to the second server; the method further includes: After the cached data in the cache database is updated, a cache verification task is generated and the cache verification task is stored in the second database of the second server corresponding to the data bypass. Periodically extract and execute cache verification tasks that are in a pending state from the second database to trigger the step of sending a second data verification request to the first server.

13. The method as described in 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 cache database of the second server to obtain the second data verification result, the method further includes: If the second data verification result shows that the second data to be verified is inconsistent with the second cached data to be verified, a data cache alarm message is issued.

14. A data cache synchronization device, characterized in that, The device is applied to a first server, and the device includes: The first sending module is used to send target data related to the target event across cities to the second server in the form of a transaction message after the first server experiences a target event, so that the second server can synchronously cache the target data sent by the first server through the transaction message after subscribing to the transaction message; A cache synchronization task generation module is used to generate an asynchronous cache synchronization task after a target event occurs on the first server; the asynchronous cache synchronization task sends the target data related to the target event to the second server via asynchronous RPC. A cache synchronization task execution module is used to execute the asynchronous cache synchronization task so that the second server performs asynchronous compensation synchronization caching based on the target data sent by the first server via asynchronous RPC; the asynchronous compensation synchronization caching includes caching the target data sent by the first server via asynchronous RPC in the case that the second server does not have the target data sent by the first server via asynchronous RPC synchronously cached.

15. A data cache synchronization device, characterized in that, The device is used in a second server, and the device includes: The first synchronization cache module is used to synchronize and cache the target data sent across cities by the first server through the transaction message after subscribing to the transaction message of the first server; the target data is the data corresponding to the target event that occurred on the first server. The first receiving module is used to receive target data sent by the first server via asynchronous RPC. The second synchronous caching module is used to perform asynchronous compensation synchronous caching based on the target data sent by the first server via asynchronous RPC; the asynchronous compensation synchronous caching includes caching the target data sent by the first server via asynchronous RPC in the case that the second server does not synchronously cache the target data sent by the first server via asynchronous RPC.

16. An electronic device, characterized in that, include: Processor and memory; The processor is connected to the memory; The memory is used to store executable program code; The processor runs a program corresponding to the executable program code stored in the memory to perform the method as described in any one of claims 1-13.

17. A computer storage medium, characterized in that, The computer storage medium stores a plurality of instructions adapted for loading by a processor and executing the steps of the method as described in any one of claims 1-13.

18. A computer program product containing instructions, characterized in that, When the computer program product is run on a computer or processor, it causes the computer or processor to perform the data cache synchronization method as described in any one of claims 1-13.

Citation Information

Patent Citations

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

    CN111638979A

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

    CN113821355A