Data processing method and device, equipment and storage medium

CN117527902BActive Publication Date: 2026-10-27TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210894960.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-28
Publication Date
2026-10-27
Estimated Expiration
2042-07-28

AI Technical Summary

Technical Problem

由于区块链网络存储的业务数据的数量庞大或者数据查询请求的数量较多,从区块链网络查找业务数据的难度大,效率低、负载高

Benefits of technology

[0026]在本申请实施中,引入了缓存空间,当接收到数据查询设备发送的数据查询请求时,缓存处理设备可以从缓存空间查找到数据查询请求所请求的业务数据。避免每次在接收到数据查询设备发送的数据查询请求时均从区块链网络获取业务数据,可以降低数据查询的难度,提升数据查询的效率,降低区块链网络的负载。并且,缓存空间针对不同业务数据采用不同的缓存有效时长进行缓存管理,实现可变的缓存策略,可以有效提升缓存空间的利用率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117527902B_ABST
    Figure CN117527902B_ABST
Patent Text Reader

Abstract

The application discloses a data processing method and device, equipment and a storage medium, and can be applied to the technical field of blockchains. The method comprises the following steps: receiving a data query request comprising a first data identifier sent by a data query device, finding first business data corresponding to the first data identifier from a cache space, and sending the first business data to the data query device. The cache space stores at least one business data, each business data corresponds to a different cache validity duration, the cache validity duration corresponding to each business data is determined by an intelligent contract based on data information of the business data, and the at least one business data comprises the first business data. The application can reduce the difficulty of data query, improve the efficiency of data query, and reduce the load of the blockchain network. Moreover, by setting different cache validity durations for each business data in the cache space, the utilization rate of the cache space can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet technology, and in particular to a data processing method, apparatus, device and storage medium. Background Technology

[0002] With the rapid development of blockchain technology, it has been widely applied in various scenarios. For example, blockchain technology can be applied to public services, the Internet of Things and logistics, insurance, finance, and other fields closely related to people's lives. However, due to the massive amount of business data stored on blockchain networks or the large number of data query requests, retrieving business data from blockchain networks is difficult, inefficient, and load-intensive. Summary of the Invention

[0003] This application provides a data processing method, apparatus, device, and storage medium. By retrieving business data from a cache space, the difficulty of data querying can be reduced, the efficiency of data querying can be improved, and the load on the blockchain network can be reduced. Furthermore, by setting different cache validity periods for each piece of business data within the cache space, the utilization rate of the cache space can be effectively improved.

[0004] On one hand, embodiments of this application provide a data processing method, the method comprising:

[0005] Receive a data query request sent by a data query device, the data query request including a first data identifier;

[0006] The first business data corresponding to the first data identifier is found in the cache space. The cache space stores at least one business data. Each business data corresponds to a different cache validity period. The cache validity period corresponding to each business data is determined by the smart contract based on the data information of the business data. At least one business data includes the first business data.

[0007] The first business data is sent to the data query device.

[0008] On the other hand, embodiments of this application provide a data processing apparatus, which includes:

[0009] A receiving unit is configured to receive a data query request sent by a data query device, the data query request including a first data identifier;

[0010] The lookup unit is used to find the first business data corresponding to the first data identifier from the cache space. The cache space stores at least one business data. Each business data corresponds to a different cache validity period. The cache validity period corresponding to each business data is determined by the smart contract based on the data information of the business data. At least one business data includes the first business data.

[0011] The sending unit is used to send the first business data to the data query device.

[0012] Furthermore, embodiments of this application provide a node device, which includes an input interface and an output interface, and further includes:

[0013] A processor, adapted to implement one or more instructions; and,

[0014] A computer storage medium that stores one or more instructions, which are adapted to be loaded by a processor and executed as follows:

[0015] Receive a data query request sent by a data query device, the data query request including a first data identifier;

[0016] The first business data corresponding to the first data identifier is found in the cache space. The cache space stores at least one business data. Each business data corresponds to a different cache validity period. The cache validity period corresponding to each business data is determined by the smart contract based on the data information of the business data. At least one business data includes the first business data.

[0017] The first business data is sent to the data query device.

[0018] Furthermore, this application provides a computer program product including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the following steps:

[0019] Receive a data query request sent by a data query device, the data query request including a first data identifier;

[0020] The first business data corresponding to the first data identifier is found in the cache space. The cache space stores at least one business data. Each business data corresponds to a different cache validity period. The cache validity period corresponding to each business data is determined by the smart contract based on the data information of the business data. At least one business data includes the first business data.

[0021] The first business data is sent to the data query device.

[0022] In another aspect, embodiments of this application provide a computer storage medium storing one or more instructions, which are adapted to be loaded by a processor and executed as follows:

[0023] Receive a data query request sent by a data query device, the data query request including a first data identifier;

[0024] The first business data corresponding to the first data identifier is found in the cache space. The cache space stores at least one business data. Each business data corresponds to a different cache validity period. The cache validity period corresponding to each business data is determined by the smart contract based on the data information of the business data. At least one business data includes the first business data.

[0025] The first business data is sent to the data query device.

[0026] In this implementation, a cache space is introduced. When a data query request is received from a data query device, the cache processing device can retrieve the requested business data from the cache space. This avoids retrieving business data from the blockchain network every time a data query request is received, reducing the difficulty of data queries, improving data query efficiency, and reducing the load on the blockchain network. Furthermore, the cache space employs different cache validity periods for different business data to manage the cache, implementing a variable caching strategy, which can effectively improve the utilization rate of the cache space. Attached Figure Description

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

[0028] Figure 1 This is a schematic diagram of the architecture of a data processing system provided in an embodiment of this application;

[0029] Figure 2 This is a schematic diagram of the architecture of an electronic invoice system provided in an embodiment of this application;

[0030] Figure 3 This is a flowchart illustrating a data processing method provided in an embodiment of this application;

[0031] Figure 4 This is a flowchart illustrating another data processing method provided in an embodiment of this application;

[0032] Figure 5 This is a schematic diagram of the structure of a data processing device provided in an embodiment of this application;

[0033] Figure 6 This is a schematic diagram of the structure of a cache processing device provided in an embodiment of this application. Detailed Implementation

[0034] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0035] In one embodiment, the data processing method of this application can be applied to... Figure 1 The data processing system shown, or a similar system. Please refer to [link / reference]. Figure 1 , Figure 1 This is a schematic diagram of the architecture of a data processing system provided in an embodiment of this application. Figure 1 As shown, the data processing system may include a consensus blockchain network, a data query device, and a cache processing device.

[0036] This consensus blockchain network (or blockchain system or data sharing system, etc.) can include multiple consensus node devices (such as... Figure 1 The terminal devices shown include, but are not limited to, smartphones, tablets, laptops, smart voice interaction devices, smart home appliances, and aircraft. To ensure information exchange within the blockchain network, consensus nodes in the consensus blockchain network are connected to each other, and information can be transmitted between these connections.

[0037] Optionally, the consensus node devices in the consensus blockchain network can be peer-to-peer (P2P) network devices. This consensus blockchain network may not require a central node device to maintain its network state; instead, it can maintain the network state or the connection state between consensus node devices through broadcast interactions between adjacent consensus node devices based on a specific network protocol.

[0038] Optionally, consensus node devices can execute accounting consensus based on the blockchain consensus protocol. For example, when a consensus node device in a consensus blockchain network receives business data, other consensus node devices can obtain the business data according to the consensus algorithm and store it as data in the shared data, so that the data stored on all consensus node devices in the consensus blockchain network is consistent, thereby maintaining the blockchain.

[0039] The data query device can be any device that generates the data query request. Optionally, the data query device can be any consensus node device in the consensus blockchain network. Optionally, the data query device may not be a consensus node device in the consensus blockchain network. Figure 1 As shown, this data query device can also be any business node device in the witnessing blockchain network. This business node device in the witnessing blockchain network can perform business execution but does not participate in the ledger consensus. This business node device can be... Figure 1 The terminal device shown is an example. Because the nodes in a consensus blockchain network are peer-to-peer, when a data query device is a consensus node in the consensus blockchain network, the data query device is prone to exposing the business data stored in the consensus blockchain network, resulting in low data confidentiality and security. To effectively improve the confidentiality and security of data storage, unlike the aforementioned single-layer blockchain network with peer-to-peer nodes (i.e., the data query device is any consensus node in the consensus blockchain network), a two-layer blockchain network (i.e., a witness blockchain network and a consensus blockchain network) can be adopted. Business node devices are used for business execution and do not participate in ledger recording, while consensus node devices are used to execute ledger consensus. The business node devices in the witness blockchain network and the consensus node devices in the consensus blockchain network are not peer-to-peer (in other words, the data query device and the consensus node device are separated), which can effectively improve the confidentiality and security of data in the consensus blockchain network.

[0040] In one alternative implementation, Figure 1 The witness blockchain network and consensus blockchain network shown can reside in different network environments. For example, the witness blockchain network can be located in a public network, while the consensus blockchain network can be located in a private network. That is, the business node devices of the witness blockchain network are deployed in a public network, while the consensus node devices of the blockchain network are deployed in a private network. The business node devices deployed in the public network and the consensus node devices deployed in the private network interact through a routing network. It should be noted that because the consensus blockchain network is deployed in a private network, the consensus mechanism of the blockchain network can guarantee the information security of the interaction between the consensus node devices, and no additional identity authentication is required. Since the witness blockchain network is deployed in a public network, it may be accessed by any terminal device. To ensure the information security of the witness blockchain network, identity authentication is required for the accessing terminal devices.

[0041] The cache processing device refers to a device carrying cache space. It can be deployed between the blockchain network and the data query device. When the cache processing device receives a data query request from the data query device, it can retrieve the corresponding business data from the blockchain network and cache this data in the cache space for subsequent retrieval. Optionally, the cache space can be deployed within the cache processing device or independently of it; there are no limitations. It should be noted that the cache processing device can be either a terminal device or a server.

[0042] In one embodiment, the data processing method has a wide range of applications. For example, it can be applied in the fields of electronic bills or electronic transactions. For ease of explanation, this application will use the field of electronic bills as an example for detailed description. Figure 2 As shown, Figure 2 A schematic diagram of the architecture of an electronic ticketing system is shown. Figure 2 As shown, the electronic ticketing system may include a witnessing blockchain network, a routing network, a cache processing device, and a consensus blockchain network.

[0043] In one optional implementation, the business node device witnessing the blockchain network can also be a server. This server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, content delivery networks (CDNs), middleware services, domain name services, security services, and big data and artificial intelligence platforms. This application does not limit this specific implementation. Figure 2As shown, the business node device 210 may include, but is not limited to, a tax-dedicated network server 211 providing tax services, a public cloud server 212 providing invoicing services, reimbursement services, or KeyAccount (KA) services, and a private cloud server 213 providing payment services, transaction processing services, or KA services, etc. Optionally, the associated terminal device can access the witness blockchain network and initiate data query requests through the business node device in the witness blockchain network. For example, the e-tax bureau can complete registration on the witness blockchain network through the corresponding client on the associated terminal device 221, thereby possessing associated business node devices (such as a tax-dedicated network server providing tax services), and can initiate data query requests through the associated business node devices. As another example, an enterprise can complete registration on the witness blockchain network through the corresponding client on the associated terminal device 222, thereby possessing associated business node devices (such as a public cloud server providing invoicing services, reimbursement services, or KA services), and can initiate data query requests through the associated business node devices. For example, consumers can register on the blockchain network through the corresponding client on the associated terminal device 223, thereby owning the associated business node device (such as a private cloud server that provides payment services, transaction flow services or KA services), and can initiate data query requests through the associated business node device.

[0044] In one optional implementation, the routing network may include multiple proxy node devices 230, which can provide one or more of the following services: authentication, certificate caching, routing, and P2P. Optionally, the authentication service can be implemented based on a Public Key Infrastructure (PKI). The PKI may include a Certificate Authority (CA), certificates, public key cryptography, and private key cryptography. In a PKI system, the CA can issue certificates to prove the ownership of the public key and implement asymmetric encryption and digital signatures of information based on the public and private key cryptography.

[0045] In one optional implementation, the cache processing device 250 can be a standalone device. In another optional implementation, the cache processing device can also be deployed in a routing network, without limitation.

[0046] In one optional implementation, the consensus node device 270 of the consensus blockchain network may include multiple blockchains (such as...) Figure 2(Examples include core chains 1, 2, ..., N, etc.). Essentially, a blockchain is a decentralized database, a chain of data blocks linked using cryptographic methods. Each block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. Optionally, a blockchain can include a blockchain underlying platform, a platform product service layer, and an application service layer. The blockchain underlying platform can include user management, basic services, smart contracts, and operation management modules. The user management module is responsible for managing the identity information of all blockchain participants, including maintaining public and private key generation (account management), key management, and maintaining the correspondence between user real identities and blockchain addresses (access management). Under authorization, it monitors and audits transactions of certain real identities and provides risk control rule configuration (risk control audit). The basic service module is deployed on consensus node devices to verify the validity of on-chain requests and records the consensus on the on-chain request to storage. For a new on-chain request, the basic service first performs interface adaptation parsing and authentication (interface adaptation), and then encrypts the business data (such as electronic invoices) through a consensus algorithm (consensus algorithm). The blockchain manages blockchain applications, ensuring that encrypted data is transmitted consistently and completely to the shared ledger (network communication) and recorded. The smart contract module handles contract registration, issuance, triggering, and execution. Developers can define contract logic using a programming language and publish it to the blockchain (contract registration). Execution is triggered by calling keys or other events according to the contract terms, completing the contract logic. The module also provides contract upgrade and cancellation functionality. The operations management module is primarily responsible for deployment, configuration modification, contract settings, cloud adaptation, and real-time visualization of the product's operational status, such as alarms, network status monitoring, and node device health management. The platform's product service layer provides basic capabilities and implementation frameworks for typical applications. Developers can leverage these capabilities and add business characteristics to implement business logic on the blockchain. The application service layer provides blockchain-based application services to business stakeholders.

[0047] Please see Figure 3 , Figure 3 This is a flowchart illustrating a data processing method provided in an embodiment of this application. This method can be applied to the above-mentioned... Figure 1 or Figure 2 In the system architecture described above, the cache processing device in the system can be used to perform... Figure 3 The method flow is shown below. Figure 3 As shown, the data processing method may include S301-S303:

[0048] S301: Receive a data query request sent by a data query device, the data query request including a first data identifier.

[0049] The data identifier is used to uniquely identify business data. Optionally, the data identifier may include, but is not limited to, one or more of the following: characters (letters, numbers, and other symbols), bit values, and fields. For example, when the business data is an electronic invoice, the invoice number can be used to uniquely identify the electronic invoice.

[0050] In one feasible implementation, the data query request may include a first data identifier.

[0051] In another feasible implementation, the data query request may further include second indication information (i.e., the data query request may include a first data identifier and second indication information). The second indication information is used to indicate that business data should not be cached. Based on this, after receiving the data query request sent by the data query device in step S301, the method further includes: the cache processing device responding to the second indication information to obtain the first business data corresponding to the first data identifier from the blockchain network, and sending the first business data to the data query device, thus ending the step. It can be seen that in this embodiment, for a one-time data query request, after the cache processing device obtains the business data from the blockchain network in response to the data query request, it does not cache the business data. Avoiding the business data corresponding to a one-time data query request from occupying cache space can effectively save storage space and improve the utilization rate of cache space.

[0052] S302: Locate the first business data corresponding to the first data identifier in the cache space. The cache space stores at least one business data. Each business data corresponds to a different cache validity period. The cache validity period corresponding to each business data is determined by the smart contract based on the data information of the business data. The at least one business data includes the first business data.

[0053] The cache space stores at least one type of business data. Optionally, the at least one type of business data may include data of one business type; for example, at least one type of business data may consist entirely of electronic invoices. Optionally, the at least one type of business data may include data of multiple business types; for example, at least one type of business data may include both electronic invoices and electronic transaction data.

[0054] Each piece of business data has a corresponding data identifier. That is, the aforementioned data identifier can be used to uniquely identify business data. Therefore, it is clear that the cache space can also store the data identifiers corresponding to each piece of business data. Based on this, in a feasible implementation, the cache processing device finds the first business data corresponding to the first data identifier in the cache space by: matching the first data identifier with the data identifiers corresponding to each piece of business data in the cache space; if a match is successful, the business data corresponding to the successfully matched data identifier is determined as the first business data (i.e., the first business data corresponding to the first data identifier is found in the cache space). If all matches fail, it is determined that the first business data corresponding to the first data identifier is not found in the cache space. In this case, it is necessary to obtain the first business data corresponding to the first data identifier from the blockchain network.

[0055] Optionally, different business data within the cache space can correspond to different cache validity periods. For example, when the business data is an electronic invoice, the cache validity period for electronic invoice 1 might be 1 hour, while the cache validity period for electronic invoice 2 might be 3 hours. It should be noted that this cache validity period can also be called Adaptive Time-To-Live (TTL).

[0056] Optionally, the caching device can manage the caching of business data within the cache space based on the cache validity period corresponding to the business data. For example, if the cache validity period of business data in the cache space has not yet been reached, the cache space still stores the business data. When a data query request is received within the cache validity period, there is no need to retrieve the business data from the blockchain network; the business data can be retrieved directly from the cache space. When the cache validity period of business data in the cache space has been reached, the business data has been deleted from the cache space, and it is necessary to retrieve the business data from the blockchain network.

[0057] Optionally, the effective cache duration for each business data item can be determined by a smart contract based on the data information of the business data.

[0058] S303: Send the first business data to the data query device.

[0059] In one feasible implementation, the cache processing device can directly send the first business data to the data query device.

[0060] In another optional implementation, the data query device can be a Simplified Payment Verification (SPV) node device. Each business data includes at least one business unit data. In this case, step S303, which sends the first business data to the data query device, includes: obtaining the node device identifier of the SPV node device; searching for the target business unit data that matches the unit data type corresponding to the node device identifier from the first business data according to the correspondence between the node device identifier and the unit data type of the authorized business unit data; and returning the target business unit data to the SPV node device.

[0061] Among them, the authorized business unit data corresponding to the node device identifier refers to the business unit data that the node device with the node device identifier has the permission to view or obtain.

[0062] Optionally, the node device identifier has a corresponding unit data type for authorized business unit data. For example, suppose the business data is an electronic bill in the field of electronic bills. The unit data type of at least one business unit data included in this electronic bill includes: header, serial number, number of copies and purpose, customer name, bank account number, product name or business item, unit of measurement, quantity, unit price, amount, handler, company seal, and invoice date. For SPV node device a with node device identifier A, the unit data type of the authorized business unit data corresponding to node device identifier A may include: quantity, unit price, and amount. For SPV node device b with node device identifier B, the unit data type of the authorized business unit data corresponding to node device identifier B may include: quantity, unit price, amount, and handler. Then, the target business unit data can be determined based on the above correspondence between the node device identifier and the unit data type of the authorized business unit data. When the node device identifier is A, the business unit data corresponding to the unit data type "quantity", "unit price", and "amount" in the first electronic bill can be determined as the matching target business unit data. When the node device is identified as B, the business unit data corresponding to the "quantity," "unit price," "amount," and "handler" data types in the first electronic invoice can be identified as the target matching business unit data. Therefore, in this embodiment, the cache processing device can determine partially authorized visible business unit data based on the node device identifier and return this partially authorized visible business unit data to the data query device. The data query device can obtain the authorized visible business unit data from the business data but cannot obtain the unauthorized visible business unit data, effectively improving data security.

[0063] In this implementation, a cache space is introduced. When a data query request is received from a data query device, the cache processing device can retrieve the requested business data from the cache space. This avoids retrieving business data from the blockchain network every time a data query request is received, reducing the difficulty of data queries, improving data query efficiency, and reducing the load on the blockchain network. Furthermore, the cache space employs different cache validity periods for different business data to manage the cache, implementing a variable caching strategy, which can effectively improve the utilization rate of the cache space.

[0064] See above Figure 3 As can be seen from the relevant description of the method embodiments shown, Figure 3 In the data processing method shown, the cache processing device may not find the first business data corresponding to the first data identifier in the cache space. In this case, it is necessary to obtain the first business data corresponding to the first data identifier from the blockchain network. Figure 4 The illustrated embodiments and Figure 3 The difference compared to the illustrated embodiment is that, Figure 4 The illustrated embodiment not only describes how to obtain the first business data corresponding to the first data identifier from the blockchain network, but also how to perform cache management on the first business data obtained from the blockchain network. Based on this, as... Figure 4 As shown, the data processing method may further include S401-S406:

[0065] S401: The data query device sends a data query request to the cache processing device, and the cache processing device receives the data query request, which includes a first data identifier.

[0066] It should be noted that step S401 can be found in the relevant description of step S301, and will not be repeated here.

[0067] S402: If the first business data corresponding to the first data identifier is not found in the cache space, the data query device obtains the first business data corresponding to the first data identifier from the blockchain network, and obtains the smart contract from the blockchain network.

[0068] In one optional embodiment, if the first business data corresponding to the first data identifier is not found in the cache space, the cache processing device can send a data query request to the blockchain network based on the data query request sent by the data query device. The blockchain network can respond to the data query request sent by the cache processing device, obtain the first business data corresponding to the first data identifier, and return the first business data to the cache processing device. Optionally, when the blockchain network is a consensus blockchain network, obtaining the first business data corresponding to the first data identifier from the blockchain network can refer to obtaining the first business data corresponding to the first data identifier from the consensus blockchain network.

[0069] The business data is associated with a smart contract, which manages the caching strategy. The caching strategy included in the smart contract for the business data is used to manage the caching of the business data. This caching strategy includes at least one piece of data information and a corresponding cache validity period for each piece of data information. In other words, the smart contract includes at least one piece of data information and a corresponding cache validity period for each piece of data information. Optionally, any piece of data information may include one or more of the data type and generation duration of the business data. It should be noted that the generation duration of the business data can be determined based on the current time and the time the business data was generated. Optionally, the caching strategy included in the smart contract can be set based on experience or business needs, and is not limited.

[0070] Optionally, when the data information includes the data type of the business data, the smart contract includes the data type of the business data and the corresponding cache validity period. For example, when the business data is an electronic invoice, the electronic invoice can include three data types: value-added tax invoice, ordinary invoice, and special invoice. Different data types of electronic invoices can correspond to different cache validity periods. For example, the cache validity period for value-added tax invoices can be 1 hour, while the cache validity period for ordinary and special invoices can be 1 day.

[0071] Optionally, when the data information includes the generation time of the business data, the smart contract includes the generation time range of the business data and the corresponding cache validity period. For example, the cache validity period for electronic invoices with a generation time range of 3 to 6 months can be 1 month. The cache validity period for electronic invoices with a generation time range of less than 3 months can be 8 days.

[0072] Optionally, when the data information includes the data type and generation duration of the business data, the smart contract includes the data type and generation duration range of the business data, as well as the corresponding cache validity period. For example, the cache validity period for ordinary bills with a generation duration range of 3 to 6 months can be 10 days. The cache validity period for ordinary bills with a generation duration range of less than 3 months can be 5 days.

[0073] As can be seen, in this embodiment, the corresponding cache validity period can be set based on the data type and generation time range of the business data. Different cache validity periods can be set individually to achieve a variable caching strategy and effectively improve the utilization of cache space.

[0074] In one optional implementation, the smart contract can be deployed in a blockchain network, ensuring that any cache processing device obtains a consistent caching strategy from the blockchain network. For example, when the cache processing device is any cache processing device in a cache cluster, all cache processing devices in the cache cluster obtain a consistent caching strategy from the blockchain network. Based on this, the cache processing device can obtain the smart contract from the blockchain network simultaneously with obtaining the first business data.

[0075] Optionally, the blockchain network can store at least one smart contract, with different smart contracts corresponding to different business types. The step of obtaining smart contracts from the blockchain network can include: obtaining the smart contract corresponding to the business type of the first business data from the blockchain network. For example, smart contract A corresponds to electronic invoices, and smart contract A includes the data information of electronic invoices and the cache validity period corresponding to the data information of electronic invoices. Smart contract B corresponds to electronic transaction data, and smart contract B includes the data information of electronic transaction data and the cache validity period corresponding to the data information of electronic transaction data. Thus, it is beneficial to determine the cache validity period of electronic invoices based on the data information of electronic invoices included in smart contract A and the cache validity period corresponding to the data information of electronic invoices, and it is also beneficial to determine the cache validity period of electronic transaction data based on the data information of electronic transaction data included in smart contract B and the cache validity period corresponding to the data information of electronic transaction data. It can be seen that in this embodiment, different caching strategies can be set for business data of different business types, which is compatible with multiple application scenarios and has greater flexibility. At the same time, a variable caching strategy is also realized, improving the utilization rate of cache space.

[0076] S403: Invoke the smart contract and determine the cache validity period corresponding to the first business data based on the data information of the first business data through the smart contract.

[0077] In one embodiment, a smart contract is invoked, and the cache validity period corresponding to the data information of the first business data is found in the smart contract. The found cache validity period is then determined as the cache validity period of the first business data.

[0078] For example, following the example in S402 where the data information includes the generation duration of business data, if the generation duration of the first business data is 2 months and 29 days, it can be determined that the generation duration range corresponding to the generation duration of the first business data is within 3 months. The cache validity duration corresponding to the electronic invoice within 3 months can be found in the smart contract, and the cache validity duration of 8 days corresponding to the electronic invoice within 3 months is determined as the cache validity duration of the first business data.

[0079] S404: Add the first business data to the cache space.

[0080] Optionally, this also includes adding data associated with the first business data to the cache space. For example, the first data identifier corresponding to the first business data can be added to the cache space. This facilitates finding the first business data corresponding to the first data identifier in the cache space later. Another example is adding the cache validity period corresponding to the first business data to the cache space, which facilitates the execution of step S405.

[0081] S405: Perform cache management on the first business data in the cache space based on the cache validity period corresponding to the first business data.

[0082] In one optional implementation, the caching processing device obtains the caching duration of the first service data in the cache space. When the caching duration has not reached the effective caching duration of the first service data, the first service data is stored in the cache space. When the caching duration reaches the effective caching duration of the first service data, the first service data is deleted from the cache space.

[0083] In another optional implementation, the caching device obtains the caching duration of the first business data in the cache space. When the caching duration reaches the effective caching duration of the first business data, the generation duration of the first business data is updated to update the data information of the first business data, thus obtaining the updated data information of the first business data. A smart contract is invoked, and the effective caching duration corresponding to the updated data information of the first business data is found within the smart contract. The effective caching duration of the first business data is updated to the effective caching duration corresponding to the updated data information. The device also obtains the caching duration of the first business data in the cache space. If the currently obtained caching duration reaches the effective caching duration of the first business data, the first business data is deleted from the cache space.

[0084] For example, following the example of S403, the cache validity period for the first business data is 8 days. When the cache validity period reaches the first business data's cache validity period, the generation period of the first business data (2 months and 29 days) is updated to 3 months and 7 days. At this time, the generation period of the first business data falls within the generation period range of 3 to 6 months. The smart contract is called, and the smart contract searches for the corresponding cache validity period of 1 month for the generation period range of 3 to 6 months. The cache validity period of the first business data is then updated to 1 month. At this point, the currently obtained cache validity period of 8 days has not yet reached the first business data's cache validity period.

[0085] Subsequently, when the cache duration reaches the effective cache duration of the first business data again, the generation duration of the first business data (3 months and 7 days) is updated to 3 months and 29 days. At this time, the generation duration of the first business data is still within the range of 3 months to 6 months. The smart contract is invoked, and the smart contract searches for the effective cache duration corresponding to the generation duration range of 3 months to 6 months, which is still 1 month. If the effective cache duration of the first business data is still 1 month, then the first business data is deleted from the cache space.

[0086] It should be noted that, similar to adding the first business data to the cache space, deleting the first business data from the cache space also includes deleting the data associated with the first business data from the cache space. For example, the first data identifier corresponding to the first business data can be deleted from the cache space. Another example is deleting the cache validity period corresponding to the first business data from the cache space.

[0087] In an optional embodiment, when the cache space stores the first business data, the first business data can also be obtained from the blockchain network. Specifically, the data query request further includes first indication information, which is used to indicate that business data should be obtained from the blockchain network. The cache processing device can respond to the data query request including the first data identifier and the first indication information, and obtain the first business data corresponding to the first data identifier from the blockchain network based on the first indication information.

[0088] Furthermore, the first business data corresponding to the first data identifier in the cache space can be updated based on the first business data corresponding to the first data identifier obtained from the blockchain network. Specifically, the first business data corresponding to the first data identifier is searched in the cache space. If the first business data from the cache space is different from the first business data from the blockchain network, the first business data is deleted from the cache space, and the first business data from the blockchain network is added to the cache space.

[0089] It should be noted that the updated first business data within the cache space can be understood as newly added business data within the cache space. Therefore, referring to steps S403 and S405 above, a smart contract can be invoked, and the smart contract can determine the cache validity period corresponding to the first business data from the blockchain network based on the data information from the first business data from the blockchain network. Cache management based on this cache validity period will not be detailed here.

[0090] It should be noted that the first business data from the cache space can refer to the first business data corresponding to the first data identifier obtained from the cache space. The first business data from the blockchain network can refer to the first business data corresponding to the first data identifier found from the blockchain network.

[0091] S406: Send the first business data to the data query device.

[0092] In one feasible implementation, based on steps S402-S405, the first service data has been stored in the cache space. At this time, the first service data corresponding to the first data identifier can be found in the cache space, and the first service data is sent to the data query device. See [link to relevant documentation]. Figure 3 The relevant explanations will not be elaborated here.

[0093] As can be seen in this embodiment, when the requested business data is not found in the cache space, the business data and smart contract can be obtained from the blockchain network. Since the smart contract is deployed on the blockchain network, any cache processing device can synchronously obtain the same smart contract. Furthermore, the smart contract can determine a variable cache validity period based on the data information of different business data, allowing for different cache validity periods to be used for cache management, thus implementing a variable caching strategy and effectively improving the utilization rate of cache space.

[0094] Based on the description of the above data processing method embodiments, this application also discloses a data processing apparatus, which may be a computer program (including program code) running on the above-mentioned cache processing device. This data processing apparatus can execute... Figure 3 or Figure 4 The method shown. Please refer to [link / reference]. Figure 5 The data processing device can operate the following units:

[0095] The receiving unit 501 is used to receive a data query request sent by the data query device, the data query request including a first data identifier;

[0096] The lookup unit 502 is used to find the first business data corresponding to the first data identifier from the cache space. The cache space stores at least one business data. Each business data corresponds to a different cache validity period. The cache validity period corresponding to each business data is determined by the smart contract based on the data information of the business data. At least one business data includes the first business data.

[0097] The sending unit 503 is used to send the first service data to the data query device.

[0098] In one embodiment, after receiving a data query request sent by a data query device, the searching unit 502 is further configured to:

[0099] If the first business data corresponding to the first data identifier is not found in the cache space, then the first business data corresponding to the first data identifier is obtained from the blockchain network, and the smart contract is obtained from the blockchain network.

[0100] Invoke the smart contract, and determine the cache validity period corresponding to the first business data based on the data information of the first business data through the smart contract;

[0101] Add the first business data to the cache space;

[0102] The cache management of the first business data in the cache space is based on the cache validity period corresponding to the first business data.

[0103] In another implementation, the smart contract includes at least one piece of data information and a cache validity period corresponding to each piece of data information. Each piece of data information includes one or more of the data type and generation duration range of the business data. The lookup unit 502 is used to invoke the smart contract and determine the cache validity period corresponding to the first business data based on the data information of the first business data through the smart contract, including:

[0104] Call the smart contract and find the cache validity period corresponding to the data information of the first business data in the smart contract;

[0105] The cache validity period found is determined as the cache validity period of the first business data.

[0106] In another embodiment, the lookup unit 502 is used to perform cache management on the first business data in the cache space based on the cache validity period corresponding to the first business data, including:

[0107] Get the cache duration of the first business data in the cache space;

[0108] When the cache duration reaches the effective cache duration of the first business data, the generation duration of the first business data is updated to update the data information of the first business data and obtain the updated data information of the first business data.

[0109] Call the smart contract and find the cache validity period corresponding to the updated data information of the first business data in the smart contract;

[0110] Update the cache validity period of the first business data to the cache validity period corresponding to the updated data information;

[0111] Get the cache duration of the first business data in the cache space;

[0112] If the current cache duration reaches the effective cache duration of the first business data, then the first business data will be deleted from the cache space.

[0113] In another embodiment, the blockchain network stores at least one smart contract, with different smart contracts corresponding to different business types; the lookup unit 502 is used to retrieve smart contracts from the blockchain network, including:

[0114] The smart contract corresponding to the business type that obtains the first business data from the blockchain network.

[0115] In another embodiment, the data query request further includes first indication information, which is used to indicate the retrieval of business data from the blockchain network; the lookup unit 502 is also used to:

[0116] Based on the first instruction information, obtain the first business data corresponding to the first data identifier from the blockchain network.

[0117] In another embodiment, the lookup unit 502 is further configured to:

[0118] Search the cache space for the first business data corresponding to the first data identifier;

[0119] If the first business data from the cache space is different from the first business data from the blockchain network, then the first business data will be deleted from the cache space.

[0120] Add the first business data from the blockchain network to the cache space.

[0121] In another embodiment, the data query request further includes second indication information, which is used to indicate that the first business data should not be cached;

[0122] After receiving the data query request sent by the data query device, the searching unit 502 is further configured to: respond to the second instruction information and obtain the first business data corresponding to the first data identifier from the blockchain network;

[0123] The first business data is sent to the data query device.

[0124] In another embodiment, the data query device is any business node device in the witness blockchain network, the blockchain network is a consensus blockchain network, and the search unit 502 is further used for:

[0125] If the first business data corresponding to the first data identifier is not found in the cache space, then the first business data corresponding to the first data identifier is obtained from the consensus blockchain network.

[0126] In another embodiment, the data query device is an SPV node device, and each service data includes at least one service unit data; the sending unit 503 is used to send the first service data to the data query device, including:

[0127] Obtain the node device identifier of the SPV node device;

[0128] Based on the correspondence between the node device identifier and the unit data type of the authorized business unit data, the target business unit data that matches the unit data type corresponding to the node device identifier is searched from the first business data;

[0129] Return the target business unit data to the SPV node device.

[0130] According to one embodiment of this application, Figure 3 or Figure 4 Each step involved in the method shown can be performed by... Figure 5 The data processing apparatus shown is executed by each unit within it. According to another embodiment of this application, Figure 5 The data processing apparatus shown can be composed of individual or combined units into one or more other units, or some of the units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effects of the embodiments of this application. The above-mentioned units are divided based on logical functions. In practical applications, the function of one unit can be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of this application, the data processing apparatus may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.

[0131] According to another embodiment of this application, processing elements and storage elements, such as a central processing unit (CPU), random access storage medium (RAM), and read-only storage medium (ROM), can be used. For example, a general-purpose computing device such as a computer can run on a device capable of performing tasks such as... Figure 3 or Figure 4 The computer program (including program code) for each step involved in the corresponding method shown, to construct such... Figure 5 The data processing apparatus shown herein, and the data processing method for implementing the embodiments of this application, are described. A computer program may be recorded on, for example, a computer-readable recording medium, loaded onto the aforementioned buffer processing device via the computer-readable recording medium, and executed therein.

[0132] In this application, a cache space is introduced. When a data query request is received from a data query device, the data processing device can retrieve the requested business data from the cache space. This avoids retrieving business data from the blockchain network every time a data query request is received, reducing the difficulty of data queries, improving data query efficiency, and reducing the load on the blockchain network. Furthermore, the cache space employs different cache validity periods for different business data to manage caching, implementing a variable caching strategy, which can effectively improve the utilization rate of the cache space.

[0133] Based on the description of the above data processing method embodiments, this application also discloses a caching processing device. Please refer to... Figure 6 The cache processing device includes at least a processor 601, an input interface 602, an output interface 603, and a computer storage medium 604, which can be connected via a bus or other means.

[0134] The computer storage medium 604 is a memory device in the cache processing device, used to store programs and data. It is understood that the computer storage medium 604 here can include the built-in storage medium of the cache processing device, or it can include extended storage media supported by the cache processing device. The computer storage medium 604 provides storage space that stores the operating system of the cache processing device. Furthermore, this storage space also stores one or more instructions suitable for loading and execution by the processor 601. These instructions can be one or more computer programs (including program code). It should be noted that the computer storage medium here can be a high-speed RAM memory; optionally, it can also be at least one computer storage medium located remotely from the aforementioned processor. The processor can be called a Central Processing Unit (CPU), which is the core and control center of the cache processing device, suitable for implementing one or more instructions, specifically loading and executing one or more instructions to achieve the corresponding method flow or function.

[0135] In one embodiment, processor 601 may load and execute one or more instructions stored in computer storage medium 604 to perform, for example, Figure 3 or Figure 4In the specific implementation of the corresponding methods shown, one or more instructions in the computer storage medium 604 are loaded by the processor 601 and executed in the following steps:

[0136] Receive a data query request sent by a data query device, the data query request including a first data identifier;

[0137] The first business data corresponding to the first data identifier is found in the cache space. The cache space stores at least one business data. Each business data corresponds to a different cache validity period. The cache validity period corresponding to each business data is determined by the smart contract based on the data information of the business data. At least one business data includes the first business data.

[0138] The first business data is sent to the data query device.

[0139] In one embodiment, after receiving a data query request sent by the data query device, the processor 601 is further configured to:

[0140] If the first business data corresponding to the first data identifier is not found in the cache space, then the first business data corresponding to the first data identifier is obtained from the blockchain network, and the smart contract is obtained from the blockchain network.

[0141] Invoke the smart contract, and determine the cache validity period corresponding to the first business data based on the data information of the first business data through the smart contract;

[0142] Add the first business data to the cache space;

[0143] The cache management of the first business data in the cache space is based on the cache validity period corresponding to the first business data.

[0144] In another implementation, the smart contract includes at least one piece of data information and a cache validity period corresponding to each piece of data information. Each piece of data information includes one or more of the data type and generation duration range of the business data. The processor 601 is used to invoke the smart contract and determine the cache validity period corresponding to the first business data based on the data information of the first business data through the smart contract, including:

[0145] Call the smart contract and find the cache validity period corresponding to the data information of the first business data in the smart contract;

[0146] The cache validity period found is determined as the cache validity period of the first business data.

[0147] In another embodiment, the processor 601 is used to perform cache management on the first service data in the cache space based on the cache validity period corresponding to the first service data, including:

[0148] Get the cache duration of the first business data in the cache space;

[0149] When the cache duration reaches the effective cache duration of the first business data, the generation duration of the first business data is updated to update the data information of the first business data and obtain the updated data information of the first business data.

[0150] Call the smart contract and find the cache validity period corresponding to the updated data information of the first business data in the smart contract;

[0151] Update the cache validity period of the first business data to the cache validity period corresponding to the updated data information;

[0152] Get the cache duration of the first business data in the cache space;

[0153] If the current cache duration reaches the effective cache duration of the first business data, then the first business data will be deleted from the cache space.

[0154] In another embodiment, the blockchain network stores at least one smart contract, with different smart contracts corresponding to different business types; the processor 601 is used to retrieve smart contracts from the blockchain network, including:

[0155] The smart contract corresponding to the business type that obtains the first business data from the blockchain network.

[0156] In another embodiment, the data query request further includes first indication information, which is used to indicate obtaining business data from the blockchain network; the processor 601 is also used to:

[0157] Based on the first instruction information, obtain the first business data corresponding to the first data identifier from the blockchain network.

[0158] In another embodiment, the processor 601 is further configured to:

[0159] Search the cache space for the first business data corresponding to the first data identifier;

[0160] If the first business data from the cache space is different from the first business data from the blockchain network, then the first business data will be deleted from the cache space.

[0161] Add the first business data from the blockchain network to the cache space.

[0162] In another embodiment, the data query request further includes second indication information, which is used to indicate that the first business data should not be cached;

[0163] After receiving a data query request sent by the data query device, the processor 601 is further configured to: respond to the second instruction information and obtain the first business data corresponding to the first data identifier from the blockchain network;

[0164] The first business data is sent to the data query device.

[0165] In another embodiment, the data query device is any business node device in the witness blockchain network, the blockchain network is a consensus blockchain network, and the processor 601 is further used for:

[0166] If the first business data corresponding to the first data identifier is not found in the cache space, then the first business data corresponding to the first data identifier is obtained from the consensus blockchain network.

[0167] In another embodiment, the data query device is an SPV node device, and each service data includes at least one service unit data; the processor 601 is used to send the first service data to the data query device, including:

[0168] Obtain the node device identifier of the SPV node device;

[0169] Based on the correspondence between the node device identifier and the unit data type of the authorized business unit data, the target business unit data that matches the unit data type corresponding to the node device identifier is searched from the first business data;

[0170] Return the target business unit data to the SPV node device.

[0171] In this implementation, a cache space is introduced. When a data query request is received from a data query device, the cache processing device can retrieve the requested business data from the cache space. This avoids retrieving business data from the blockchain network every time a data query request is received, reducing the difficulty of data queries, improving data query efficiency, and reducing the load on the blockchain network. Furthermore, the cache space employs different cache validity periods for different business data to manage the cache, implementing a variable caching strategy, which can effectively improve the utilization rate of the cache space.

[0172] This application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a cache processing device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the cache processing device to perform the data processing method embodiment described above. Figure 3 or Figure 4 The steps performed in the process.

[0173] This application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, which includes program instructions. When executed by a processor, the program instructions can perform the data processing method embodiments described above. Figure 3 or Figure 4 The steps performed in the process.

[0174] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0175] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Those skilled in the art will understand that all or part of the processes for implementing the above embodiments and equivalent variations made in accordance with the claims of this application are still within the scope of this application.

Claims

1. A data processing method, characterized in that, The method includes: Receive a data query request sent by a data query device, wherein the data query request includes a first data identifier; The first business data corresponding to the first data identifier is found in the cache space. The cache space stores at least one business data. Each business data corresponds to a different cache validity period. The cache validity period corresponding to each business data is determined by the smart contract based on the data information of the business data. The at least one business data includes the first business data. Any data information includes one or more of the data type and generation time range of the business data. If the first business data corresponding to the first data identifier is not found in the cache space, then the first business data corresponding to the first data identifier is obtained from the blockchain network, and the smart contract is obtained from the blockchain network. The smart contract is invoked, and the cache validity period corresponding to the first business data is determined by the smart contract based on the data information of the first business data. Add the first business data and its corresponding cache validity period to the cache space; If the caching duration of the first business data reaches the effective caching duration, then based on the updated generation duration of the first business data, the smart contract is invoked to determine the updated effective caching duration. The first business data is sent to the data query device.

2. The method as described in claim 1, characterized in that, The smart contract includes at least one data information and a cache validity period corresponding to each data information; The step of invoking the smart contract and determining the cache validity period corresponding to the first business data based on the data information of the first business data through the smart contract includes: Invoke the smart contract and find the cache validity period corresponding to the data information of the first business data in the smart contract; The cache validity period found is determined as the cache validity period of the first business data.

3. The method as described in claim 2, characterized in that, If the caching duration of the first business data reaches the cache validity duration, then based on the updated generation duration of the first business data, the smart contract is invoked to determine the updated cache validity duration, including: Obtain the cache duration of the first service data in the cache space; When the cache duration reaches the effective cache duration of the first service data, the generation duration of the first service data is updated to update the data information of the first service data, and the updated data information of the first service data is obtained. Invoke the smart contract and find the cache validity period corresponding to the updated data information of the first business data in the smart contract; Update the cache validity period of the first business data to the cache validity period corresponding to the updated data information; Obtain the cache duration of the first service data in the cache space; If the currently obtained cache duration reaches the effective cache duration of the first business data, then the first business data will be deleted from the cache space.

4. The method according to any one of claims 1-3, characterized in that, The blockchain network stores at least one smart contract, with different smart contracts corresponding to different business types. The step of obtaining the smart contract from the blockchain network includes: The smart contract corresponding to the business type from which the first business data is obtained from the blockchain network.

5. The method according to any one of claims 1-3, characterized in that, The data query request also includes first indication information, which is used to indicate that business data should be obtained from the blockchain network; The method further includes: Based on the first indication information, the first business data corresponding to the first data identifier is obtained from the blockchain network.

6. The method as described in claim 5, characterized in that, The method further includes: Retrieve the first service data corresponding to the first data identifier from the cache space; If the first business data from the cache space is different from the first business data from the blockchain network, then the first business data is deleted from the cache space; The first business data from the blockchain network is added to the cache space.

7. The method as described in claim 1, characterized in that, The data query request also includes second indication information, which is used to indicate that the first business data should not be cached. After receiving the data query request sent by the data query device, the method further includes: In response to the second instruction information, obtain the first business data corresponding to the first data identifier from the blockchain network; The first business data is sent to the data query device.

8. The method according to any one of claims 1-3, characterized in that, The data query device is any business node device in the witness blockchain network, and the blockchain network is a consensus blockchain network; the method further includes: If the first business data corresponding to the first data identifier is not found in the cache space, then the first business data corresponding to the first data identifier is obtained from the consensus blockchain network.

9. The method as described in claim 8, characterized in that, The data query device is a simple payment verification SPV node device, and each business data includes at least one business unit data; sending the first business data to the data query device includes: Obtain the node device identifier of the SPV node device; Based on the correspondence between the node device identifier and the unit data type of the authorized business unit data, the target business unit data that matches the unit data type corresponding to the node device identifier is searched from the first business data; The target service unit data is returned to the SPV node device.

10. A data processing apparatus, characterized in that, The device includes: A receiving unit is configured to receive a data query request sent by a data query device, wherein the data query request includes a first data identifier; The lookup unit is used to find the first business data corresponding to the first data identifier from the cache space. The cache space stores at least one business data, and each business data corresponds to a different cache validity period. The cache validity period corresponding to each business data is determined by a smart contract based on the data information of the business data. The at least one business data includes the first business data, and any data information includes one or more of the data type and generation duration range of the business data. The search unit is further configured to: if the first business data corresponding to the first data identifier is not found in the cache space, obtain the first business data corresponding to the first data identifier from the blockchain network and obtain a smart contract from the blockchain network; invoke the smart contract and determine the cache validity period corresponding to the first business data based on the data information of the first business data through the smart contract; add the first business data and the corresponding cache validity period to the cache space; if the cache duration of the first business data reaches the cache validity period, invoke the smart contract to determine the updated cache validity period based on the updated generation duration of the first business data; The sending unit is used to send the first service data to the data query device.

11. A cache processing device, characterized in that, The device includes a processor and a memory connected together, wherein the memory is used to store program code, and the processor is used to call the program code to execute the data processing method as described in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the data processing method according to any one of claims 1 to 9.

13. A computer program product, characterized in that, The computer program product includes computer instructions stored in a computer-readable storage medium, which, when executed by a processor, implement the data processing method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Intelligent data caching method and device, computer equipment and storage medium

    CN111046070A

  • Data query method, device and equipment and readable medium

    CN114625767A