Data caching method and apparatus, electronic device, and computer-readable storage medium

By verifying data packets from the cache server using a verification server and combining this with encryption algorithms, a first-level cache and a second-level cache are constructed. This solves the problem of data loss and tampering in the cache before decentralized data storage, ensuring the security and integrity of the data.

CN116156003BActive Publication Date: 2026-07-21MASHANG CONSUMER FINANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
MASHANG CONSUMER FINANCE CO LTD
Filing Date
2022-09-22
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

When data is cached before being stored in a decentralized manner, there is a risk of data loss and tampering, and there is a lack of effective verification methods.

Method used

The system obtains the encapsulated data packet from the cache server through the verification server, generates a data verification request, and sends it to the application server for verification. If the verification is successful, the data packet is cached. The integrity of the data packet is ensured by combining the digest encryption algorithm and the timestamp. First-level cache and second-level cache are built to ensure the correctness of the data.

Benefits of technology

It prevents tampering during data transmission, ensures the correctness and security of cached data, and improves storage efficiency and data integrity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116156003B_ABST
    Figure CN116156003B_ABST
Patent Text Reader

Abstract

The application provides a data caching method and device, an electronic device and a computer readable medium, which are applied to a verification server and include the following steps: obtaining a packaged data packet corresponding to target data; generating a data verification request according to the packaged data packet and sending the data verification request to an application server, wherein the data verification request is used to request the application server to verify whether the packaged data packet is correct; and performing second caching processing on the target data according to the packaged data packet in the case that an authentication message returned by the application server and indicating that the packaged data packet is correct is received. According to the embodiment of the application, the target data can be efficiently cached and the correctness of the target data can be ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a data caching method and apparatus, electronic device, and computer-readable storage medium. Background Technology

[0002] With the continuous development of Internet technology, there is a great deal of reliance on decentralized storage protocols, such as Filecoin and Arweave, for decentralized data storage. At the same time, applications that can use these protocols have been developed. Therefore, to ensure data privacy and improve data acquisition speed, the data generated by these applications can usually be uploaded to the blockchain network for decentralized storage.

[0003] In related technologies, before storing data in a decentralized manner, the data is usually cached locally in the application or sent to a database for caching. This may result in data loss or tampering with the cached data. Summary of the Invention

[0004] This application provides a data caching method, apparatus, electronic device, and computer-readable storage medium to efficiently cache data and ensure data integrity.

[0005] Firstly, this application provides a data caching method applied to a verification server, the method comprising:

[0006] Obtain the encapsulated data packet corresponding to the target data;

[0007] The encapsulated data packet is obtained by the verification server from the cache server when the cache server detects that the target data is cached by the cache server. The cache server is used to perform a first caching process on the target data after receiving the encapsulated data packet sent by the application server. The application server is used to generate the target data to be cached and to generate an encapsulated data packet to reflect the changes in the target data.

[0008] Based on the encapsulated data packet, a data verification request is generated and sent to the application server, wherein the data verification request is used to request the application server to verify whether the encapsulated data packet is correct;

[0009] If an authentication message indicating that the encapsulated data packet is correct is received from the application server, then the target data is subjected to a second caching process based on the encapsulated data packet.

[0010] Secondly, this application provides another data caching method for application servers, the method comprising:

[0011] Obtain the target data to be cached, wherein the target data is the data generated after performing a preset data operation on the original data;

[0012] Based on the original data, the target data, and the current timestamp, an encapsulated data packet reflecting changes in the target data is generated, wherein the current timestamp represents the generation time of the encapsulated data packet;

[0013] The encapsulated data packet is sent to the cache server, wherein the encapsulated data packet is used to trigger the cache server to perform a first caching process on the target data.

[0014] Thirdly, this application provides yet another data caching method applied to a caching server, the method comprising:

[0015] Receive a data caching request sent by an application server, wherein the data caching request includes an encapsulated data packet, the encapsulated data packet including information reflecting changes to the target data, the target data being data to be cached generated by the application server;

[0016] In response to the data caching request, the target data is subjected to a first caching process based on the encapsulated data packet.

[0017] Fourthly, this application provides a data caching device for use in a verification server, the device comprising:

[0018] The acquisition unit is used to acquire the encapsulated data packet corresponding to the target data;

[0019] The encapsulated data packet is obtained by the verification server from the cache server when the cache server detects that the target data is cached by the cache server. The cache server is used to perform a first caching process on the target data after receiving the encapsulated data packet sent by the application server. The application server is used to generate the target data to be cached and to generate an encapsulated data packet to reflect the changes in the target data.

[0020] The verification unit is used to generate a data verification request based on the encapsulated data packet and send the data verification request to the application server, wherein the data verification request is used to request the application server to verify whether the encapsulated data packet is correct;

[0021] The storage unit is used to cache the target data according to the encapsulated data packet if an authentication message indicating that the encapsulated data packet is correct is received from the application server.

[0022] Fifthly, this application provides another data caching device for use in an application server, the device comprising:

[0023] The target data acquisition unit is used to acquire the target data to be cached, wherein the target data is the data generated after performing preset data operations on the original data;

[0024] The data generation unit is used to generate an encapsulated data packet that reflects changes in the target data based on the original data, the target data, and the current timestamp, wherein the current timestamp represents the generation time of the encapsulated data packet;

[0025] A sending unit is used to send an encapsulated data packet to a cache server, wherein the encapsulated data packet is used to trigger the cache server to perform a first caching process on the target data.

[0026] Sixthly, this application provides yet another data caching device for use in a caching server, the device comprising:

[0027] The receiving unit is used to receive the encapsulated data packet sent by the application server, wherein the encapsulated data packet includes information reflecting the changes in the target data, and the target data is the data to be cached generated by the application server;

[0028] A cache response unit is used to perform a first cache processing on the target data according to the encapsulated data packet.

[0029] In a seventh aspect, this application provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the data caching methods of the first, second, and third aspects described above.

[0030] Eighthly, this application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the data caching methods of the first, second, and third aspects described above.

[0031] In the embodiments provided in this application, when the verification server detects that the cache server is caching target data, it obtains the encapsulated data packet corresponding to the target data from the cache server, generates a data verification request based on the encapsulated data packet, and sends the data verification request to the application server to verify the correctness of the encapsulated data packet. Upon receiving an authentication message, it also caches the target data based on the encapsulated data packet. Because the cache server first directly caches the target data based on the encapsulated data packet corresponding to the target data received from the application server, it quickly responds to the application server's caching requests. The verification server then detects data changes on the cache server and verifies the encapsulated data packet received by the cache server to confirm that the encapsulated data packet has not been tampered with during transmission. After receiving the corresponding authentication message, the verification server caches the target data again. Thus, by constructing a first-level cache that quickly responds to application caching requests, and a second-level cache that verifies the correctness of the data stored in the first-level cache before storing it again, the correctness of the cached data can be guaranteed, and data tampering during transmission can be prevented.

[0032] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description

[0033] The accompanying drawings are provided to further illustrate the present application and form part of the specification. They are used together with the embodiments of the present application to explain the application and do not constitute a limitation thereof. The above and other features and advantages will become more apparent to those skilled in the art from the detailed example embodiments described with reference to the accompanying drawings, in which:

[0034] Figure 1 A flowchart illustrating a data caching method provided in this application embodiment;

[0035] Figure 2A A framework diagram of a data caching system provided in this application embodiment;

[0036] Figure 2B This is a schematic diagram of the interactive process for data caching processing provided in an embodiment of this application;

[0037] Figure 3 This is a flowchart for generating a data verification request provided in an embodiment of this application;

[0038] Figure 4 A flowchart for generating verification ciphertext provided in an embodiment of this application;

[0039] Figure 5A flowchart for caching target data provided in an embodiment of this application;

[0040] Figure 6 A flowchart of the rollback confirmation process provided in this application embodiment;

[0041] Figure 7 A flowchart illustrating another data caching method provided in this application embodiment;

[0042] Figure 8 A flowchart illustrating yet another data caching method provided in this application embodiment;

[0043] Figure 9 A block diagram of a data caching device provided in an embodiment of this application;

[0044] Figure 10 A block diagram of another data caching device provided in the embodiments of this application;

[0045] Figure 11 A block diagram of yet another data caching device provided in the embodiments of this application;

[0046] Figure 12 This is a block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0047] To enable those skilled in the art to better understand the technical solutions of this application, exemplary embodiments of this application are described below in conjunction with the accompanying drawings, including various details of the embodiments of this application to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0048] Where there is no conflict, the various embodiments of this application and the features thereof may be combined with each other.

[0049] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.

[0050] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application. As used herein, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded. Terms such as “connected” or “linked” are not limited to physical or mechanical connections but can include electrical connections, whether direct or indirect.

[0051] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this application, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so defined herein.

[0052] With the gradual implementation of the Web3.0 concept, decentralized storage, such as data storage based on blockchain networks, has been widely recognized and applied, especially in the financial sector. To ensure the privacy and security of user data, financial data generated by financial applications, such as user transaction data generated by financial lending applications, is uploaded to the blockchain network for storage. This not only protects the privacy of user data but also allows users to quickly access their data based on the decentralized storage of the blockchain network from any geographical location.

[0053] However, decentralized data storage, such as uploading data to a blockchain network for on-chain processing, typically involves steps like packaging, broadcasting, and confirmation from other storage nodes. This makes real-time decentralized storage of all application-generated data generally costly and inefficient. Furthermore, frequently changing or rapidly generated data is often unsuitable for decentralized storage; otherwise, even without considering storage costs, it can lead to congestion in decentralized storage networks, such as blockchain networks. Therefore, before decentralized storage of application-generated data, it's generally cached locally within the application or sent to a database for caching. In this caching process, caching locally carries the risk of data loss in case of application failure, while caching in a database carries the risk of data tampering if the database connection password is compromised, and there's a lack of verifiable methods to confirm data tampering.

[0054] To address the aforementioned issues and ensure the integrity of the data to be cached, preventing data tampering during transmission, this application provides a data caching method, please refer to... Figure 1 This is a flowchart illustrating a data caching method provided in an embodiment of this application. This method can be applied to a verification server, which can be a physical server or a virtual server; no special limitation is made here.

[0055] For ease of understanding, the following is a brief description of a data caching system capable of implementing the data caching method of this application. Please refer to... Figure 2A as well as Figure 2B These are, respectively, a framework diagram of the data caching system provided in the embodiments of this application, and a schematic diagram of the interaction flow of data caching processing. Figure 2A as well as Figure 2B As shown, the data caching system 100 provided in this application embodiment may include an application server 110, a cache server 210, and a verification server 310.

[0056] In the data caching system 100, the application server 110 can execute step S11, performing preset data operations on the original data to obtain the target data to be cached, and step S12, generating an encapsulated data packet reflecting the changes in the target data, and then executing step S13, sending the encapsulated data packet to the cache server 120. This encapsulated data packet can trigger the cache server 120 to perform a first caching process on the target data. This first caching process can be based on the encapsulated data packet, directly caching the target data. Furthermore, after generating the encapsulated data packet, the application server 110 can also execute step S14, using a preset digest encryption algorithm to encrypt the target data and the encapsulated data packet respectively, to obtain a first ciphertext of the target data and a second ciphertext of the encapsulated data packet, and then store the first and second ciphertexts locally and delete the target data and the encapsulated data packet from the local storage.

[0057] The cache server 210 receives the encapsulated data packet sent by the application server 110 and executes step S15 to perform the first cache processing on the target data according to the encapsulated data packet, that is, to directly cache the target data according to the encapsulated data packet.

[0058] The verification server 310 can be used to detect data changes in the cache server 210. When the cache server 210 is found to be caching the target data, step S16 is executed to obtain the encapsulated data packet corresponding to the target data from the cache server 210; and step S17 is executed to generate a data verification request based on the encapsulated data packet; and step S18 is executed to send the data verification request to the application server 110 to request the application server 110 to verify whether the encapsulated data packet is correct.

[0059] After receiving the data verification request, the application server 110 can execute step S19, which responds to the data verification request by performing verification processing on the encapsulated data packet, and if the verification passes, generates an authentication message corresponding to the data verification request, and executes step S20 to return the authentication message to the verification server 310.

[0060] If the verification server 310 receives an authentication message from the application server that corresponds to the data verification request and indicates that the encapsulated data packet is correct, it executes step S21 to perform a second caching process on the target data according to the encapsulated data packet. That is, if the encapsulated data packet passes the verification, the target data is cached according to the verified encapsulated data packet to complete the data synchronization with the caching server 210.

[0061] As can be seen, in this example, in the data caching system 100, if the verification server 310 verifies the encapsulated data packet corresponding to the target data and the verification passes, it can complete data synchronization with the caching server 210 by caching the target data. After completing the caching process, step S22 is executed to send a notification message of caching completion to the application server 110. Thus, when the application server 110 needs to store data in a decentralized manner, such as uploading it to a blockchain network for storage, it can execute step S23 to send a data retrieval request to the verification server 310, triggering the verification server 310 to execute step S24. In response to the data retrieval request, the verification server 310 provides the target data to the application server 110. After obtaining the target data, the application server 110 can execute step S25 to upload the target data to the blockchain network for storage. In this way, by using cache server 210 as a first-level cache, the target data can be cached quickly in response to data caching requests sent by application server 110. By using verification server 310 as a second-level cache, the encapsulated data packet corresponding to the target data to be cached is verified to confirm that the encapsulated data packet was generated by the application server. This ensures that the cached target data has not been tampered with, thus ensuring the security of the target data.

[0062] The above provides a brief description of a data caching system capable of implementing the data caching method provided in the embodiments of this application. The following, in conjunction with... Figure 1 and Figure 2B The data caching method provided in the embodiments of this application will be described in detail.

[0063] like Figure 1 As shown in the figure, a data caching method provided in this application embodiment may include the following steps S101-S103, which will be described in detail below.

[0064] Step S101: Obtain the encapsulated data packet corresponding to the target data; wherein, the encapsulated data packet is obtained by the verification server from the cache server when it detects that the cache server is caching the target data, the cache server is used to perform the first caching process on the target data after receiving the encapsulated data packet sent by the application server, and the application server is used to generate the target data to be cached, and to generate the encapsulated data packet to reflect the changes in the target data.

[0065] The target data can be any data generated by the application server. In some embodiments, to address the problems of high cost and low storage efficiency when storing high-frequency changing or large-scale, rapidly generated data in a decentralized manner in related technologies, the target data can be data with a change frequency of not less than a preset threshold. For example, it can be user transaction data generated periodically in financial consumer applications or commodity price data generated in e-commerce applications.

[0066] The encapsulated data packet may include a timestamp indicating the generation time of the encapsulated data packet, the original data, the target data, and the data change type. When the data operation type is "add", the value of the original data can be a preset value, such as "" or "null", indicating an empty value, and the target data is the data after the addition. When the preset data operation is "modify", the target data is the data obtained after modifying the original data. When the preset data operation is "delete", the value of the target data can be the aforementioned preset value, or, for example, "" or "null".

[0067] In some embodiments, the encapsulated data packet corresponding to the target data can be {'Generation Time': timestamp, 'Original Data': 'Data Before Modification', 'Target Data': 'Data After Modification', 'Data Operation Type': 'Add / Modify / Delete'}. For example, if the value of the data item identified as "data1" is "30", the target data can be {data1:30}, and the encapsulated data packet corresponding to the target data can be {'Generation Time': '1654941019472', 'Original Data': '', 'Target Data': 'data1:30', 'Data Operation Type': 'Add'}.

[0068] Step S102: Based on the encapsulated data packet, generate a data verification request and send the data verification request to the application server. The data verification request is used to request the application server to verify whether the encapsulated data packet is correct.

[0069] Please refer to Figure 3 The flowchart for generating a data verification request provided in this application embodiment includes the following steps: Step S301: Obtaining the generation time from the encapsulated data packet; Step S302: Encrypting the encapsulated data packet using a preset digest encryption algorithm to obtain a first verification ciphertext; Step S303: Generating the data verification request based on the generation time and the first verification ciphertext.

[0070] In this embodiment of the application, the preset digest encryption algorithm can be any algorithm used to encrypt data into irreversible ciphertext, such as MD5, SHA-1 and SHA-256, etc., without any special limitation.

[0071] In this process, after the cache server responds to the data caching request sent by the application server and directly caches the target data according to the encapsulated data packet, in order to ensure that the received encapsulated data packet is indeed generated by the application server and not generated by other third parties or tampered with during transmission, the verification server can, after storing the target data on the cache server, detect changes in the data on the cache server, obtain the encapsulated data packet and generate the first verification ciphertext, and send the generation time and the first verification ciphertext as a data verification request to the application server.

[0072] As can be seen in this example, since the ciphertext generated by the digest encryption algorithm is irreversible, the first verification ciphertext corresponding to the encapsulated data packet can be sent to the application server. Furthermore, since the data verification request includes the generation time of the encapsulated data packet, by sending this generation time to the application server, the application server can also obtain the locally stored ciphertext corresponding to that generation time based on the generation time. In this way, by comparing whether the locally stored ciphertext is consistent with the first verification ciphertext, it is possible to quickly determine whether the encapsulated data packet received by the cache server and the verification server is correct, that is, whether it was generated by the application server.

[0073] Please refer to Figure 4This is a flowchart for generating the first verification ciphertext provided in an embodiment of this application. As can be seen from the above description, the encapsulated data packet in this embodiment may include a data identifier, original data, target data, and a data operation type; the data identifier can be used to identify data items corresponding to the original data and target data, the original data is the data originally stored in the data item, the target data is the data stored in the data item after a preset change operation is performed on the original data, and the data operation type represents the operation type of the preset change operation, wherein the data operation type may include adding, modifying, and deleting;

[0074] In some embodiments, the encryption of the encapsulated data packet using a preset digest encryption algorithm to obtain the first verification ciphertext in step S302 above includes: step S401, obtaining a second verification ciphertext based on the data identifier and data operation type, wherein the second verification ciphertext is the verification ciphertext corresponding to the historical encapsulated data packet of the data item at the previous data change time, and when the data operation type is new, the second verification ciphertext is null, and the second verification ciphertext is generated and stored by the verification server at the previous data change time; step S402, concatenating the second verification ciphertext and the encapsulated data packet; and step S403, encrypting the data obtained after concatenation using a preset digest encryption algorithm to obtain the first verification ciphertext.

[0075] It should be noted that, in the embodiments of this application, the data identifier can be an identifier used to identify the data item corresponding to the original data and the target data. The original data is the data originally stored in the data item, and the target data is the data stored in the data item after a preset change operation is performed on the original data. The data change type can be used to represent the operation type of the preset change operation. The data identifier can exist in both the original data and the target data, or, if the target data is obtained after operating on the data of a data item, the data identifier can also be directly included in the encapsulated data packet. That is, in the embodiments of this application... For example, the encapsulated data packet can also be {'Data Identifier':'Identifier Content','Generation Time':Timestamp,'Original Data':'Data Before Modification','Target Data':'Data After Modification','Data Operation Type':'Add / Modify / Delete'}. In this implementation, the target data and original data can be directly the data before and after modification, for example, it can be {'Data Identifier':'data1','Generation Time':'1654941019472','Original Data':'','Target Data':'30','Data Operation Type':'Add'}.

[0076] In this embodiment, when the data change type in the encapsulated data packet is "addition," the value of the original data is a preset value; when the data change type is "deletion," the value of the target data is a preset value. The generation process of the first verification ciphertext corresponds to the generation processes of the first ciphertext and the second ciphertext, and its detailed processing procedure will not be described here. Furthermore, in this embodiment, the first ciphertext and the second ciphertext can be ciphertexts obtained by encrypting data obtained after processing the data to be encrypted using chain concatenation processing.

[0077] For example, regarding the first ciphertext of the target data, the third ciphertext corresponding to the historical target data at the previous data change time can be obtained based on the data identifier corresponding to the target data. This third ciphertext and the target data are then concatenated, and the concatenated data is encrypted to obtain the first ciphertext. That is, in the case where desnum represents the target data, token1_n represents the ciphertext corresponding to the target data "data1" at time n, and token1_n-1 represents the ciphertext corresponding to the historical target data "data1" at time n-1, token1_n = preset digest encryption algorithm (token1_n-1 + desnum). In this embodiment, the concatenation process can be concatenating token1_n-1 before, after, or between token1_n-1 and the target data with a preset ciphertext of a fixed value; no special limitation is made here.

[0078] For example, when obtaining the second ciphertext of a packaged data packet corresponding to the target data, the fourth ciphertext corresponding to the historical packaged data of the data item at the previous data change time can be obtained first based on the data identifier corresponding to the target data. This fourth ciphertext and the packaged data packet are then concatenated. The concatenated data is then encrypted to obtain the second ciphertext. That is, in the case where packnum represents the packaged data packet of the target data, token2_n represents the ciphertext corresponding to the packaged data packet of data item "data1" at time n, and token2_n-1 represents the ciphertext corresponding to the historical packaged data of data item "data1" at time n-1, token2_n = preset digest encryption algorithm (token2_n-1 + packnum). The preset digest encryption algorithm is used to encrypt the concatenated data to obtain the first verification ciphertext, which is then stored. In this embodiment, the concatenation process can correspond to the concatenation process described above when obtaining the first ciphertext, and will not be elaborated further here.

[0079] Step S103: If an authentication message indicating that the encapsulated data packet is correctly received from the application server, the target data is subjected to a second caching process based on the encapsulated data packet.

[0080] Please refer to Figure 5 This is a flowchart for caching target data provided in an embodiment of this application. For example... Figure 5 As shown, in some embodiments, the second caching process for the target data based on the encapsulated data packet, as described in step S103 above, if an authentication message indicating that the encapsulated data packet is correct is received from the application server, includes the following steps: Step S501, if the authentication message is received within a preset timeout period, the encapsulated data packet is determined to be correct, and the target data is cached based on the data identifier and the data operation type; and Step S502, if the authentication message is not received within the preset timeout period, a data rollback request is sent to the cache server based on the data rollback reference information received from the application server, wherein the data rollback request is used to request the cache server to perform rollback processing, and the rollback processing is used to at least restore the target data to the original data, the data rollback reference information includes reference ciphertext and the generation time corresponding to the reference ciphertext, and the reference ciphertext is the ciphertext of the latest encapsulated data packet corresponding to the data identifier stored locally by the application server.

[0081] The preset timeout can be set as needed, for example, it can be 1 second or 5 seconds, etc., without any special limitation.

[0082] That is, in this embodiment of the application application, after receiving a data verification request sent by the cache server, if the verification ciphertext in the data verification request is consistent with the ciphertext obtained from the local storage according to the generation time in the data verification request, the application server can generate authentication information indicating that the verification has passed, and after generating an authentication message based on the authentication information, send the authentication message to the verification server. If the verification server receives the authentication message within a preset timeout period, it can determine that the encapsulated data packet has passed the verification, that is, the encapsulated data packet has not been tampered with. At this time, the target data can be processed in the second caching process, that is, the target data is cached according to the verified encapsulated data packet to complete the data synchronization with the cache server, and when the application server needs to obtain the target data, the cached target data is provided to the application server.

[0083] It should be noted that, in some embodiments, after caching the target data, the verification server can also send a notification message to the application server indicating that the data verification and caching are complete. After receiving the notification message, the application server can determine that the target data has been cached, and retrieve the target data from the verification server when it needs to perform decentralized storage of the target data.

[0084] Additionally, if the verification server does not receive the authentication message within the preset timeout period, it indicates that the encapsulated data packet has failed verification in the application server. In this case, in this embodiment of the application, to ensure the correctness of the data, the application server can also send the ciphertext and generation time of the encapsulated data packet of the data item identified by the data identifier to the verification server at the latest moment in the application's local storage. After obtaining the data rollback reference information containing the ciphertext and the generation time, the verification server can generate a data rollback request based on the data rollback reference information and send the data rollback request to the cache server to request the cache server to perform rollback processing.

[0085] Since the ciphertext of the target data and the ciphertext of the encapsulated data packet in this embodiment include the ciphertext corresponding to the data at the previous moment, the data rollback process can be performed as follows after the cache server receives the data rollback reference information: according to the encapsulated data packet, the target data in the cache is iteratively subjected to reverse data operations until the ciphertext of the encapsulated data packet corresponding to the rollback data obtained after the reverse data operations is consistent with the ciphertext in the data rollback reference information. The iterative reverse data operations can be "add" to "delete", "delete" to "add", and "modify" is to reverse the operation between the original data and the target data in the encapsulated data packet.

[0086] Please refer to Figure 6 This is a flowchart of the rollback confirmation process provided in the embodiments of this application. For example... Figure 6 As shown in this embodiment, after the cache server completes the rollback process, the method further includes: step S601, receiving rollback data and a corresponding encapsulated data packet returned by the cache server, wherein the rollback data is data obtained by the cache server in response to the data rollback request and performing rollback processing on the cached target data according to the encapsulated data packet, and the ciphertext of the encapsulated data packet corresponding to the rollback data is consistent with the reference ciphertext and the generation time is consistent with the generation time corresponding to the reference ciphertext; step S602, encrypting the rollback data using a preset digest encryption algorithm to obtain a third verification ciphertext, and encrypting the encapsulated data packet corresponding to the rollback data using a preset digest encryption algorithm to obtain a fourth verification ciphertext; step S603, generating a restore confirmation request based on the third verification ciphertext and the fourth verification ciphertext; step S604, sending the restore confirmation request to the application server to request the application server to verify whether the rollback data correctly restores the target data; step S605, confirming the successful rollback process upon receiving an authentication message corresponding to the restore confirmation request.

[0087] That is, in this embodiment of the application, after the cache server completes the rollback process in response to the data rollback request, it can send the rollback data obtained after the rollback process and the encapsulated data packet corresponding to the rollback data back to the verification server. The verification server can generate corresponding third and fourth verification ciphertexts according to the preset digest encryption algorithm, and send the third and fourth verification ciphertexts and their corresponding generation times to the application server to request the application server to verify whether the third and fourth verification ciphertexts are consistent with the ciphertext stored locally at the corresponding generation time. If they are consistent, it means that the data rollback is successful. In this way, by locating the data tampering location and performing data rollback and confirmation processing through the data structure based on chain digest encryption, the correctness of the cached data can be fully guaranteed.

[0088] To further enhance data security and accuracy, in this embodiment, after the verification server sends a data verification request to the application server, the authentication information in the authentication message provided by the application server can be encrypted using a preset asymmetric encryption algorithm. Specifically, in this embodiment, the authentication message corresponding to the data verification request may include authentication information, which can be generated by the application server based on a private key. This private key can be the private key in a key pair pre-generated by the application server based on a preset asymmetric encryption algorithm, and the public key in this key pair is pre-provided by the application server to the verification server. In this implementation, after the verification server receives the authentication message, the above step S501, which states that if the authentication message is received within a preset timeout period, determines that the encapsulated data packet is correct, involves: obtaining the authentication information from the authentication message; decrypting the authentication information using the public key; and, if decryption is successful, determining that the encapsulated data packet is correct.

[0089] The above provides a detailed explanation of how the verification server verifies the encapsulated data packet corresponding to the target data and caches the target data when the caching server detects that the target data is cached. It should be noted that, in this embodiment, to save storage space, after the verification server performs a second caching process on the target data based on the encapsulated data packet, the method further includes: receiving a data acquisition request from the application server to obtain the target data; responding to the data acquisition request, providing the target data to the application server; and, after receiving a successful data upload notification message from the application server, deleting the target data and sending a data deletion request to the caching server, wherein the data deletion request is used to request the caching server to synchronously delete the target data, and the successful data upload notification message indicates that the target data has been uploaded to the blockchain network for storage by the application server.

[0090] As can be seen, in this embodiment, the cache server first caches the target data directly based on the encapsulated data packet corresponding to the target data received from the application server, so as to quickly respond to the application server's cache request. The verification server detects data changes on the cache server and verifies the encapsulated data packet received by the cache server to confirm that the encapsulated data packet has not been tampered with during transmission. After receiving the corresponding authentication message, the verification server caches the target data again. In this way, by constructing a first-level cache that quickly responds to application cache requests, and a second-level cache that verifies the correctness of the data stored in the first-level cache before storing it again, the correctness of the cached data can be guaranteed and the data can be prevented from being tampered with during transmission.

[0091] In addition, corresponding to the above-mentioned data caching method, this application embodiment also provides another data caching method, please refer to... Figure 7 This is a flowchart of another data caching method provided in an embodiment of this application. This data caching method is applied to an application server, which may be, for example, the application server 110 shown in Figure 2.

[0092] like Figure 7 As shown, the data caching method may include the following steps S701-S703.

[0093] Step S701: Obtain the target data to be cached, wherein the target data is the data generated after performing preset data operations on the original data.

[0094] Step S702: Based on the original data, the target data, and the current timestamp, generate an encapsulated data packet that reflects changes in the target data, wherein the timestamp indicates the generation time of the encapsulated data packet.

[0095] Step S703: Send the encapsulated data packet to the cache server, wherein the encapsulated data packet is used to trigger the cache server to perform the first caching process on the target data.

[0096] In some embodiments, after generating an encapsulated data packet reflecting changes to the target data, the method further includes: encrypting the target data using a preset digest encryption algorithm to obtain a first ciphertext, and encrypting the encapsulated data packet using the preset digest encryption algorithm to obtain a second ciphertext; storing the first ciphertext and the second ciphertext, and deleting the target data and the encapsulated data packet from local storage after sending the data caching request to the cache server.

[0097] In some embodiments, the first ciphertext and the second ciphertext can be obtained through the following steps: obtaining a data identifier corresponding to the target data, wherein the data identifier is used to identify the data item corresponding to the original data and the target data; obtaining a third ciphertext and a fourth ciphertext based on the data identifier, wherein the third ciphertext is the ciphertext corresponding to the historical target data of the data item at the previous data change time, and the fourth ciphertext is the ciphertext corresponding to the historical encapsulated data packet of the data item at the previous data change time. When the data operation type is "add", the values ​​of the third ciphertext and the fourth ciphertext are both preset values, and the third ciphertext and the fourth ciphertext are generated and stored by the application server at the previous data change time; concatenating the third ciphertext and the target data, and encrypting the concatenated data using a preset digest encryption algorithm to obtain the first ciphertext; and concatenating the fourth ciphertext and the encapsulated data packet, and encrypting the concatenated data using a preset digest encryption algorithm to obtain the second ciphertext.

[0098] In some embodiments, after storing the first ciphertext and the second ciphertext, the method further includes: receiving a data verification request sent by a verification server, wherein the data verification request is used to request an application server to verify whether the encapsulated data packet is correct; in response to the data verification request, performing verification processing on the encapsulated data packet, and generating an authentication message corresponding to the data verification request if the verification passes; and returning the authentication message to the verification server, wherein the authentication message indicates that the encapsulated data packet has passed verification.

[0099] In some embodiments, the verification process for the encapsulated data packet includes: obtaining the generation time and first verification ciphertext corresponding to the encapsulated data packet from the data verification request; obtaining a second ciphertext based on the generation time; and determining that the verification is successful if the second ciphertext and the first verification ciphertext are consistent.

[0100] In addition, if the second ciphertext and the first ciphertext are inconsistent, the method further includes: obtaining data rollback reference information, wherein the data rollback reference information includes reference ciphertext and the generation time corresponding to the reference ciphertext, wherein the reference ciphertext is the ciphertext corresponding to the latest time of the encapsulated data packet stored locally by the application server and corresponding to the data identifier in the encapsulated data packet; sending the data rollback reference information to the verification server, wherein the data rollback reference information is used to trigger the verification server to generate a data rollback request and send the data rollback request to the cache server to perform rollback processing on the cached target data.

[0101] Corresponding to the two data caching methods described above, this application also provides another data caching method, please refer to... Figure 8This is a flowchart of another data caching method provided in an embodiment of this application. The data caching method is applied to a cache server, which may be, for example, the cache server 210 shown in Figure 2.

[0102] like Figure 8 As shown, the data caching method may include the following steps S801-S802.

[0103] Step S801: Receive the encapsulated data packet sent by the application server, wherein the encapsulated data packet includes information reflecting changes in the target data, and the target data is the data to be cached generated by the application server.

[0104] Step S802: Perform the first buffering process on the target data according to the encapsulated data packet.

[0105] In some embodiments, after caching the target data, the method further includes: receiving a data rollback request sent by a verification server, wherein the data rollback request is used to request rollback processing of the target data, and the verification server is used to obtain the encapsulated data packet and perform correctness verification on the encapsulated data packet when it detects that the caching server has cached the target data, and cache the target data if the verification passes; obtaining data rollback reference information from the data rollback request, wherein the data rollback reference information includes reference ciphertext and the generation time corresponding to the reference ciphertext, and the reference ciphertext is the latest ciphertext of the encapsulated data packet corresponding to the data identifier in the encapsulated data packet stored locally by the application server; and performing rollback processing on the target data according to the data rollback reference information.

[0106] In some embodiments, after rolling back the target data, the method further includes: obtaining the rollback data obtained after the rollback process and the encapsulated data packet corresponding to the rollback data; and sending the rollback data and the encapsulated data packet corresponding to the rollback data to a verification server to verify whether the rollback process was successful.

[0107] It is understood that the various method embodiments mentioned above in this application can be combined with each other to form combined embodiments without violating the principle and logic. Due to space limitations, this application will not elaborate further. Those skilled in the art will understand that in the above methods of specific implementation, the specific execution order of each step should be determined by its function and possible internal logic.

[0108] In addition, this application also provides a data caching device, an electronic device, and a computer-readable storage medium, all of which can be used to implement any of the data caching methods provided in this application. The corresponding technical solutions and descriptions are described in the corresponding descriptions in the method section, and will not be repeated here.

[0109] Figure 9This is a block diagram of a data caching device provided in an embodiment of this application.

[0110] Reference Figure 9 This application provides a first data caching device 900, which can be applied to a verification server. The first data caching device 900 includes: an acquisition unit 901, a verification unit 902, and a storage unit 903.

[0111] The acquisition unit 901 is used to acquire the encapsulated data packet corresponding to the target data; wherein, the encapsulated data packet is obtained by the verification server from the cache server when the cache server detects that the target data is cached by the cache server, the cache server is used to perform the first cache processing on the target data after receiving the encapsulated data packet sent by the application server, and the application server is used to generate the target data to be cached, and to generate the encapsulated data packet to reflect the changes in the target data.

[0112] The verification unit 902 is used to generate a data verification request based on the encapsulated data packet and send the data verification request to the application server. The data verification request is used to request the application server to verify whether the encapsulated data packet is correct.

[0113] Storage unit 903 is used to perform a second buffering process on the target data based on the encapsulated data packet if an authentication message indicating that the encapsulated data packet is correctly returned by the application server is received.

[0114] In some embodiments, the encapsulated data packet includes the generation time of the encapsulated data packet. When generating a data verification request based on the encapsulated data packet, the verification unit 902 can be used to: obtain the generation time from the encapsulated data packet; encrypt the encapsulated data packet using a preset digest encryption algorithm to obtain a first verification ciphertext; and generate a data verification request based on the generation time and the first verification ciphertext.

[0115] In some embodiments, the encapsulated data packet further includes a data identifier, original data, target data, and a data operation type. The data identifier is used to identify the data item corresponding to the original data and the target data. The original data is the data originally stored in the data item. The target data is the data stored in the data item after a preset change operation is performed on the original data. The data operation type indicates the operation type of the preset change operation, wherein the data operation type includes addition, modification, and deletion. When the verification unit 902 encrypts the encapsulated data packet using a preset digest encryption algorithm to obtain the first verification ciphertext, it can be used to: obtain the second verification ciphertext according to the data identifier and the data operation type, wherein the second verification ciphertext is the verification ciphertext corresponding to the historical encapsulated data packet of the data item at the previous data change time, and when the data operation type is addition, the second verification ciphertext is null. The second verification ciphertext is generated and stored by the verification server at the previous data change time; concatenate the second verification ciphertext and the encapsulated data packet; encrypt the data obtained after concatenation using a preset digest encryption algorithm to obtain and store the first verification ciphertext.

[0116] In some embodiments, if an authentication message indicating that the encapsulated data packet is correctly returned by the application server is received, the storage unit 903, when caching the target data according to the encapsulated data packet, can be used to: if an authentication message is received within a preset timeout period, determine that the encapsulated data packet is correct, and cache the target data according to the data identifier and data operation type; if no authentication message is received within the preset timeout period, send a data rollback request to the cache server according to the data rollback reference information received from the application server. The data rollback request is used to request the cache server to perform data rollback processing, and the rollback processing is used to at least restore the target data to the original data. The data rollback reference information includes reference ciphertext and the generation time corresponding to the reference ciphertext. The reference ciphertext is the ciphertext of the encapsulated data packet corresponding to the latest time corresponding to the data identifier stored locally by the application server.

[0117] In some embodiments, the authentication message includes authentication information, which is generated by the application server based on a private key. The private key is the private key in a key pair generated by the application server in advance based on a preset asymmetric encryption algorithm, and the public key in the key pair is provided to the verification server in advance by the application server. If the authentication message is received within a preset timeout period, the storage unit 903, upon determining that the encapsulated data packet is correct, can be used to: obtain the authentication information from the authentication message; decrypt the authentication information according to the public key; and, if the decryption is successful, determine that the encapsulated data packet is correct.

[0118] In some embodiments, the apparatus 900 further includes a rollback confirmation unit, configured to: after sending a data rollback request to a cache server, receive rollback data and a corresponding encapsulated data packet returned by the cache server, wherein the rollback data is data obtained by the cache server in response to the data rollback request, performing rollback processing on the cached target data according to the encapsulated data packet; encrypt the rollback data using a preset digest encryption algorithm to obtain a third verification ciphertext, and encrypt the corresponding encapsulated data packet using a preset digest encryption algorithm to obtain a fourth verification ciphertext; generate a restore confirmation request based on the third and fourth verification ciphertexts; send the restore confirmation request to the application server to request the application server to verify whether the rollback data correctly restores the target data; and confirm the successful rollback processing upon receiving an authentication message corresponding to the restore confirmation request.

[0119] In some embodiments, the device 900 further includes a data providing unit, configured to: receive a data acquisition request sent by an application server for acquiring target data; provide the target data to the application server in response to the data acquisition request; and, after receiving a data successful on-chain notification message returned by the application server, delete the target data and send a data deletion request to a cache server, wherein the data deletion request is used to request the cache server to synchronously delete the target data, and the data successful on-chain message is a message indicating that the target data has been uploaded to the blockchain network for storage by the application server.

[0120] Figure 10 A block diagram of another data caching device provided in an embodiment of this application.

[0121] Reference Figure 10 This application provides a second data caching device 1000, which can be applied to an application server. The second data caching device 1000 includes: a target data acquisition unit 1001, a data generation unit 1002, and a sending unit 1003.

[0122] The target data acquisition unit 1001 is used to acquire the target data to be cached, wherein the target data is the data generated after performing preset data operations on the original data.

[0123] The data generation unit 1002 is used to generate an encapsulated data packet that reflects changes in the target data based on the original data, the target data, and the current timestamp, wherein the current timestamp represents the generation time of the encapsulated data packet.

[0124] The sending unit 1003 is used to send the encapsulated data packet to the cache server, wherein the encapsulated data packet is used to trigger the cache server to perform the first cache processing on the target data.

[0125] In some embodiments, the second data caching device 1000 further includes a ciphertext storage unit, configured to: after generating an encapsulated data packet reflecting changes in the target data, encrypt the target data using a preset digest encryption algorithm to obtain a first ciphertext, and encrypt the encapsulated data packet using a preset digest encryption algorithm to obtain a second ciphertext; store the first ciphertext and the second ciphertext, and delete the target data and the encapsulated data packet from local storage after sending a data caching request to the cache server.

[0126] In some embodiments, the second data caching device 1000 further includes a ciphertext storage unit, configured to: when generating the first ciphertext and the second ciphertext, may be configured to: obtain a data identifier corresponding to the target data, wherein the data identifier is used to identify the data item corresponding to the original data and the target data; obtain a third ciphertext and a fourth ciphertext based on the data identifier, wherein the third ciphertext is the ciphertext corresponding to the historical target data of the data item at the previous data change time, and the fourth ciphertext is the ciphertext corresponding to the historical encapsulated data packet of the data item at the previous data change time; when the data operation type is "add", the values ​​of the third ciphertext and the fourth ciphertext are both preset values, and the third ciphertext and the fourth ciphertext are respectively generated and stored by the application server at the previous data change time; concatenate the third ciphertext and the target data, and encrypt the data obtained after concatenation using a preset digest encryption algorithm to obtain the first ciphertext; and concatenate the fourth ciphertext and the encapsulated data packet, and encrypt the data obtained after concatenation using a preset digest encryption algorithm to obtain the second ciphertext.

[0127] In some embodiments, the second data caching device 1000 further includes a verification processing unit, configured to: receive a data verification request sent by a verification server, wherein the data verification request is used to request the application server to verify whether the encapsulated data packet is correct; in response to the data verification request, perform verification processing on the encapsulated data packet, and generate an authentication message corresponding to the data verification request if the verification passes; and return the authentication message to the verification server, wherein the authentication message indicates that the encapsulated data packet has passed verification.

[0128] In some embodiments, when performing verification processing on the encapsulated data packet, the verification processing unit may be used to: obtain the generation time and first verification ciphertext corresponding to the encapsulated data packet from the data verification request; obtain the second ciphertext according to the generation time; and determine that the verification is successful if the second ciphertext and the first verification ciphertext are consistent.

[0129] Figure 11 A block diagram of yet another data caching device provided in an embodiment of this application.

[0130] Reference Figure 11This application provides a third data caching device 1100, which can be applied to a cache server. The third data caching device 1100 includes a receiving unit 1101 and a response unit 1102.

[0131] The receiving unit 1101 is used to receive the encapsulated data packet sent by the application server, wherein the encapsulated data packet includes information reflecting the changes in the target data, and the target data is the data to be cached generated by the application server.

[0132] The response unit 1102 is used to perform a first buffering process on the target data according to the encapsulated data packet.

[0133] In some embodiments, the third data caching device 1100 further includes a rollback response unit, configured to: receive a data rollback request sent by a verification server, wherein the data rollback request is used to request rollback processing of target data, and the verification server is used to obtain an encapsulated data packet and perform correctness verification on the encapsulated data packet when it detects that the cache server has cached the target data, and cache the target data if the verification passes; obtain data rollback reference information from the data rollback request, wherein the data rollback reference information includes reference ciphertext and the generation time corresponding to the reference ciphertext, and the reference ciphertext is the latest ciphertext of the encapsulated data packet corresponding to the data identifier in the encapsulated data packet stored locally by the application server; and perform rollback processing on the target data according to the data rollback reference information.

[0134] In some embodiments, the third data caching device 1100 further includes a rollback confirmation unit, configured to: acquire the rollback data obtained after the rollback process and the encapsulated data packet corresponding to the rollback data; and send the rollback data and the encapsulated data packet corresponding to the rollback data to a verification server to verify whether the rollback process was successful.

[0135] Figure 12 This is a block diagram of an electronic device provided in an embodiment of this application.

[0136] Reference Figure 12 This application provides an electronic device 1200, which includes: at least one processor 1201; at least one memory 1202; and one or more I / O interfaces 1203 connected between the processor 1201 and the memory 1202; wherein the memory 1202 stores one or more computer programs that can be executed by the at least one processor 1201, and the one or more computer programs are executed by the at least one processor 1201 to enable the at least one processor 1201 to perform the above-described data caching method.

[0137] This application also provides a computer-readable storage medium storing a computer program thereon, wherein the computer program, when executed by a processor, implements the data caching method described above. The computer-readable storage medium can be volatile or non-volatile.

[0138] This application also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in the processor of an electronic device, the processor in the electronic device executes the above-described data caching method.

[0139] Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software can be distributed on a computer-readable storage medium, which may include computer storage media (or non-transitory media) and communication media (or transient media).

[0140] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable program instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is known to those skilled in the art that communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

[0141] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.

[0142] The computer program instructions used to perform the operations of this application may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuits, such as programmable logic circuits, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), are personalized by utilizing the status information of the computer-readable program instructions. These electronic circuits can execute the computer-readable program instructions to implement various aspects of this application.

[0143] The computer program product described herein can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.

[0144] Various aspects of this application are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0145] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0146] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0147] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0148] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for general illustrative purposes only and should not be construed as limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in conjunction with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in conjunction with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of this application as set forth by the appended claims.

Claims

1. A data caching method, characterized in that, Applied to a verification server, the method includes: Obtain the encapsulated data packet corresponding to the target data; The encapsulated data packet is obtained by the verification server from the cache server when the cache server detects that the target data is cached by the cache server. The cache server is used to perform a first caching process on the target data after receiving the encapsulated data packet sent by the application server. The application server is used to generate the target data to be cached and to generate an encapsulated data packet to reflect the changes in the target data. Based on the encapsulated data packet, a data verification request is generated and sent to the application server, wherein the data verification request is used to request the application server to verify whether the encapsulated data packet is correct; If an authentication message indicating that the encapsulated data packet is correct is received from the application server, then the target data is subjected to a second caching process based on the encapsulated data packet.

2. The method according to claim 1, characterized in that, The encapsulated data packet includes the generation time of the encapsulated data packet; The step of generating a data verification request based on the encapsulated data packet includes: The generation time is obtained from the encapsulated data packet; The encapsulated data packet is encrypted using a preset digest encryption algorithm to obtain the first verification ciphertext; The data verification request is generated based on the generation time and the first verification ciphertext.

3. The method according to claim 2, characterized in that, The encapsulated data packet also includes a data identifier, original data, target data, and a data operation type; the data identifier is used to identify the data item corresponding to the original data and the target data, the original data is the data originally stored in the data item, the target data is the data stored in the data item after a preset change operation is performed on the original data, and the data operation type indicates the operation type of the preset change operation, wherein the data operation type includes adding, modifying, and deleting; The step of encrypting the encapsulated data packet using a preset digest encryption algorithm to obtain the first verification ciphertext includes: According to the data identifier and the data operation type, a second verification ciphertext is obtained, wherein the second verification ciphertext is the verification ciphertext corresponding to the historical encapsulated data packet of the data item at the previous data change time, and when the data operation type is new, the value of the second verification ciphertext is a preset value, and the second verification ciphertext is generated and stored by the verification server at the previous data change time; The second verification ciphertext and the encapsulated data packet are concatenated. The data obtained after splicing is encrypted using the preset digest encryption algorithm to obtain the first verification ciphertext.

4. The method according to claim 3, characterized in that, If an authentication message indicating that the encapsulated data packet is correct is received from the application server, then the target data is subjected to a second caching process based on the encapsulated data packet, including: If the authentication message is received within the preset timeout period, it is determined that the encapsulated data packet is correct, and the target data is cached according to the data identifier and the data operation type; If the authentication message is not received within the preset timeout period, a data rollback request is sent to the cache server based on the data rollback reference information received from the application server. The data rollback request is used to request the cache server to perform rollback processing, which is used to at least restore the target data to the original data. The data rollback reference information includes reference ciphertext and the generation time corresponding to the reference ciphertext. The reference ciphertext is the ciphertext of the latest encapsulated data packet corresponding to the data identifier stored locally by the application server.

5. The method according to claim 4, characterized in that, The authentication message includes authentication information, which is generated by the application server after encryption based on a private key. The private key is the private key in a key pair generated by the application server in advance based on a preset asymmetric encryption algorithm, and the public key in the key pair is provided to the verification server in advance by the application server. The step of determining that the encapsulated data packet is correct if the authentication message is received within a preset timeout period includes: The authentication information is obtained from the authentication message; Decrypt the authentication information using the public key; If decryption is successful, the encapsulated data packet is confirmed to be correct.

6. The method according to claim 4, characterized in that, After sending the data rollback request to the cache server, the method further includes: The system receives rollback data and a corresponding encapsulated data packet returned by the cache server, wherein the rollback data is data obtained by the cache server in response to the data rollback request after performing rollback processing on the cached target data according to the encapsulated data packet; The rollback data is encrypted using the preset digest encryption algorithm to obtain a third verification ciphertext, and the encapsulated data packet corresponding to the rollback data is encrypted using the preset digest encryption algorithm to obtain a fourth verification ciphertext. A restoration confirmation request is generated based on the third and fourth verification ciphertexts. The restore confirmation request is sent to the application server to request the application server to verify whether the rollback data has correctly restored the target data; Upon receiving the authentication message corresponding to the restore confirmation request, the rollback process is confirmed to be successful.

7. The method according to claim 1, characterized in that, After performing the second buffering process on the target data according to the encapsulated data packet, the method further includes: Receive a data acquisition request sent by the application server for obtaining the target data; In response to the data acquisition request, the target data is provided to the application server; and, After receiving the data successfully uploaded to the blockchain notification message returned by the application server, the target data is deleted, and a data deletion request is sent to the cache server. The data deletion request is used to request the cache server to delete the target data synchronously. The data successfully uploaded to the blockchain message indicates that the target data has been uploaded to the blockchain network for storage by the application server.

8. A data caching method, characterized in that, Applied to an application server, the method includes: Obtain the target data to be cached, wherein the target data is the data generated after performing a preset data operation on the original data; Based on the original data, the target data, and the current timestamp, an encapsulated data packet reflecting changes in the target data is generated, wherein the current timestamp represents the generation time of the encapsulated data packet; The encapsulated data packet is sent to the cache server, wherein the encapsulated data packet is used to trigger the cache server to perform a first caching process on the target data, and to allow the verification server to verify the encapsulated data packet obtained from the cache server, and after the verification passes, the verification server performs a second caching process on the target data.

9. The method according to claim 8, characterized in that, After generating the encapsulated data packet reflecting changes in the target data, the method further includes: The target data is encrypted using a preset digest encryption algorithm to obtain a first ciphertext, and the encapsulated data packet is encrypted using the preset digest encryption algorithm to obtain a second ciphertext. The first ciphertext and the second ciphertext are stored, and after the data caching request is sent to the caching server, the target data and the encapsulated data packet are deleted from local storage.

10. The method according to claim 9, characterized in that, The method obtains the first ciphertext and the second ciphertext through the following steps: Obtain the data identifier corresponding to the target data, wherein the data identifier is used to identify the data item corresponding to the original data and the target data; Based on the data identifier, the third ciphertext and the fourth ciphertext are obtained. The third ciphertext is the ciphertext corresponding to the historical target data of the data item at the previous data change time, and the fourth ciphertext is the ciphertext corresponding to the historical encapsulated data packet of the data item at the previous data change time. When the data operation type in the encapsulated data packet is "add", the values ​​of the third ciphertext and the fourth ciphertext are both preset values. The third ciphertext and the fourth ciphertext are generated and stored by the application server at the previous data change time. The third ciphertext and the target data are concatenated, and the concatenated data is encrypted using the preset digest encryption algorithm to obtain the first ciphertext; and, The fourth ciphertext and the encapsulated data packet are concatenated, and the data obtained after concatenation is encrypted using the preset digest encryption algorithm to obtain the second ciphertext.

11. The method according to claim 9, characterized in that, After storing the first ciphertext and the second ciphertext, the method further includes: Receive a data verification request sent by a verification server, wherein the data verification request is used to request the application server to verify whether the encapsulated data packet is correct; In response to the data verification request, the encapsulated data packet is verified, and if the verification passes, an authentication message corresponding to the data verification request is generated. The authentication message is returned to the verification server, wherein the authentication message indicates that the encapsulated data packet has passed verification.

12. The method according to claim 11, characterized in that, The verification process for the encapsulated data packet includes: From the data verification request, obtain the generation time and the first verification ciphertext corresponding to the encapsulated data packet; Based on the generation time, obtain the second ciphertext stored locally; If the second ciphertext and the first ciphertext are consistent, the verification is deemed successful.

13. The method according to claim 12, characterized in that, If the second ciphertext and the first ciphertext are inconsistent, the method further includes: Obtain data rollback reference information, wherein the data rollback reference information includes reference ciphertext and the generation time corresponding to the reference ciphertext, and the reference ciphertext is the latest ciphertext of the encapsulated data packet stored locally by the application server and corresponding to the data identifier in the encapsulated data packet; The data rollback reference information is sent to the verification server, wherein the data rollback reference information is used to trigger the verification server to generate a data rollback request and send the data rollback request to the cache server.

14. A data caching method, characterized in that, Applied to a caching server, the method includes: Receive an encapsulated data packet sent by an application server, wherein the encapsulated data packet includes information reflecting changes in target data, and the target data is data to be cached generated by the application server; The target data is first cached according to the encapsulated data packet, so that the verification server can verify the encapsulated data packet obtained from the cache server, and after the verification passes, the verification server performs a second cached process on the target data.

15. The method according to claim 14, characterized in that, After performing the first buffering process on the target data according to the encapsulated data packet, the method further includes: Receive a data rollback request sent by the verification server, wherein the data rollback request is used to request rollback processing of the target data; Obtain data rollback reference information from the data rollback request, wherein the data rollback reference information includes reference ciphertext and the generation time corresponding to the reference ciphertext, and the reference ciphertext is the latest ciphertext of the encapsulated data packet corresponding to the data identifier in the encapsulated data packet stored locally by the application server; Based on the data rollback reference information, the target data is rolled back.

16. The method according to claim 15, characterized in that, After performing the rollback process on the target data, the method further includes: Obtain the rollback data and the encapsulated data packet corresponding to the rollback data after the rollback process; The rollback data and the corresponding encapsulated data packet are sent to the verification server to verify whether the rollback process was successful.

17. A data caching device, characterized in that, The device, used in a verification server, includes: The acquisition unit is used to acquire the encapsulated data packet corresponding to the target data; The encapsulated data packet is obtained by the verification server from the cache server when it detects that the cache server is caching the target data. The cache server is used to perform a first caching process on the target data after receiving the encapsulated data packet sent by the application server. The application server is used to generate the target data to be cached and to generate the encapsulated data packet to reflect the changes in the target data. The verification unit is used to generate a data verification request based on the encapsulated data packet and send the data verification request to the application server, wherein the data verification request is used to request the application server to verify whether the encapsulated data packet is correct; A storage unit is used to perform a second caching process on the target data based on the encapsulated data packet if an authentication message indicating that the encapsulated data packet is correct is received from the application server.

18. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs that can be executed by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the data caching method as described in any one of claims 1-16.

19. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the data caching method as described in any one of claims 1-16.