Data caching method and device, computer equipment, storage medium and program product

By setting up local caching and verifying version numbers on business nodes, the network congestion problem in traditional caching architectures is solved, achieving high concurrency, low latency data access efficiency and system stability.

CN121579543APending Publication Date: 2026-02-27CHINA LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511786602.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-01
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

In business scenarios involving high-frequency data queries, traditional caching architectures lead to network congestion and slow response times, failing to meet the needs of high-concurrency, low-latency business operations.

Method used

By setting up a local cache on the business node, the local data is first queried and the version number is verified. Data is only requested from the distributed cache node when the local cache is missing or the version is inconsistent, thus ensuring data accuracy and reducing access pressure.

Benefits of technology

It improves data access efficiency and system stability in high-concurrency scenarios, reduces cache read/write response latency, and ensures data accuracy and consistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121579543A_ABST
    Figure CN121579543A_ABST
Patent Text Reader

Abstract

The invention relates to a data caching method and device, computer equipment, a storage medium and a program product. The method comprises the steps that after a service request is received, service data corresponding to the service request and a corresponding local version number are inquired in a local cache; if the service data and the corresponding local version number are obtained, sending a version number query request to a distributed cache node; the version number query request is used for querying a distributed version number corresponding to the service request; if the service data does not exist in the local cache and / or the local version number is different from the distributed version number, sending a data query request for the service data to the distributed cache node, and storing the service data returned by the distributed cache node and the corresponding distributed version number to the local cache; and returning the service data to the requester of the service request. In this way, the access pressure of the database and the distributed cache nodes is reduced, and the data access efficiency and the overall stability of the system under the high-concurrency scene are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and in particular to a data caching method and device, a computer device, a computer readable storage medium, and a computer program product. BACKGROUND

[0002] In a business scenario of high-frequency data query, data reading and writing operations need to be frequently performed on a database, so that the system transaction processing capacity during a business peak period is difficult to meet the demand, and the overall stability of the system is adversely affected.

[0003] To alleviate the pressure on the database, the data access efficiency can be improved through a caching technology. In a traditional simple caching architecture, a large number of read and write requests of each application node need to access a cache node through a network, so as to easily cause network congestion or even fullness, so that the cache read and write response is blocked, and the business demand for high concurrency and low latency cannot be met. SUMMARY

[0004] Therefore, it is necessary to provide a data caching method, device, computer device, computer readable storage medium, and computer program product to meet the business demand for high concurrency and low latency.

[0005] In a first aspect, the present application provides a data caching method applied to a business node, wherein: After receiving a business request, the business data corresponding to the business request and a corresponding local version number are queried in a local cache; If the business data and the corresponding local version number are obtained, a version number query request is sent to a distributed cache node, and the version number query request is used to query a distributed version number corresponding to the business request; If the business data does not exist in the local cache, and / or the local version number is different from the distributed version number, a data query request for the business data is sent to the distributed cache node, and the business data returned by the distributed cache node and a corresponding distributed version number are stored to the local cache; The business data is returned to a requester of the business request.

[0006] In one of the embodiments, the method further comprises: If the local version number is the same as the distributed version number, the business data is returned to the requester.

[0007] In one of the embodiments, the method further comprises: If the business data is not obtained from the distributed cache node, the business data is requested from a preset database.

[0008] In one of the embodiments, the requesting the service data from the preset database comprises: reading the service data from the preset database, and generating a distributed version number of the service data; storing the service data and the distributed version number to the distributed cache node and the local cache.

[0009] In one of the embodiments, the method further comprises: storing target data to the preset database; after the target data is updated, updating the target data stored in the preset database based on the updated target data.

[0010] In one of the embodiments, the method further comprises: if the target data has been stored to the distributed cache node, after the target data is updated, updating the target data and the corresponding target version number stored in the distributed cache node.

[0011] In a second aspect, the application provides a data caching device applied to a service node, the device comprising: a querying module, configured to query service data corresponding to a service request and a corresponding local version number in a local cache after receiving the service request; a first requesting module, configured to send a version number querying request to a distributed cache node if the service data and the corresponding local version number are obtained, the version number querying request being used to query a distributed version number corresponding to the service request; a second requesting module, configured to send a data querying request for the service data to the distributed cache node if the service data does not exist in the local cache, and / or the local version number is different from the distributed version number, and store the service data and the corresponding distributed version number returned by the distributed cache node to the local cache; a returning module, configured to return the service data to a requester of the service request.

[0012] In a third aspect, the application further provides a computer device comprising a memory and a processor, the memory storing a computer program, and the processor realizing the steps in any of the above method embodiments when executing the computer program.

[0013] In a fourth aspect, the application further provides a computer readable storage medium storing a computer program, the computer program being executed by a processor to realize the steps in any of the above method embodiments.

[0014] In a fifth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of any of the method embodiments described above.

[0015] The data caching method, device, computer device, computer readable storage medium and computer program product described above, by setting up a local cache at the service node, enables a service request to first perform data query locally when arriving, and if there is service data locally, only needs to request a distributed version number from the distributed cache node to verify the validity of the locally stored service data; only when there is no corresponding service data in the local cache or the local version number is inconsistent with the distributed version number, sends a data query request to the distributed cache node and updates the local cache; in this way, both the accuracy of service data is ensured and the access pressure of the database and the distributed cache node is reduced, the response delay of cache read and write is reduced, and the efficiency of data access and the overall stability of the system in a high concurrency scenario are improved. BRIEF DESCRIPTION OF DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the drawings needed to be used in the description of the embodiments of the present application or the related art will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.

[0017] Figure 1 Flow chart of the data caching method in the service node in an embodiment; Figure 2 Flow chart of the data caching method in the distributed cache node in an embodiment; Figure 3 Architecture diagram of the data caching system in an embodiment; Figure 4 Structural block diagram of the data caching device in the service node in an embodiment; Figure 5 Structural block diagram of the data caching device in the distributed cache node in an embodiment; Figure 6 Internal structure diagram of the computer device in an embodiment. DETAILED DESCRIPTION

[0018] In order to make the purpose, technical solutions and advantages of the present application more clear, the present application will be further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not to limit the present application.

[0019] It should be noted that the terms "first", "second", etc. used in the present application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "include" and "have" and any variations thereof used in the present application are intended to cover non-exclusive inclusion. The term "a plurality of" used in the present application refers to two or more. The term "and / or" used in the present application refers to one of the options or any combination of multiple options.

[0020] In the business scenario of high-frequency data query, data reading and writing operations need to be frequently performed on the database or cache node, which may cause network congestion and even full occupation, resulting in cache reading and writing response lag, and failing to meet the business requirements of high concurrency and low delay. Based on this, the present application provides a data caching method to solve the above problems.

[0021] The data caching method can be applied to a three-level cache system including a business node, a distributed cache node and a preset database.

[0022] The business node can be a terminal or a server with data storage and processing capabilities. The terminal includes but is not limited to various personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices, etc. The server can be a standalone physical server, a server cluster or a distributed system composed of multiple physical servers, a cloud server providing cloud computing services, a cloud database, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms, etc. Basic cloud computing services of cloud servers. Alternatively, the business node can also be a virtual node in a distributed system, which is not specifically limited.

[0023] The distributed cache node is an intermediate layer of the three-level cache system, which is usually a clustered memory data storage layer, and undertakes the high-speed buffering responsibility between the business node and the preset database. The preset database is used for persistent storage, which can be a relational database, a NoSQL database or a time series database, etc. Structured storage system, usually deployed in a standalone data server cluster, supporting massive data storage requirements. The distributed cache node and the preset database can be independent physical devices, such as terminals or servers with data storage and processing capabilities, or virtual nodes in a distributed system, which are not specifically limited.

[0024] Specifically, as shown in Figure 1 In the business node, the data caching method can implement the following process: Step 101, after receiving the service request, the service data corresponding to the service request and the corresponding local version number are queried in the local cache.

[0025] The service node can directly interface the service request, undertake specific service logic processing, and has a local cache storage capability, can directly store service data and the corresponding local version number and provide fast query service.

[0026] After receiving the service request, the service node will first query in its local cache to obtain the service data corresponding to the service request and the local version number attached to the service data. The local version number is a version label of the service data stored in the local cache of the service node. Each time the service data in the local cache is updated, the corresponding local version number is also updated synchronously. Therefore, the local version number can be used to quickly determine whether the service data in the local cache is valid data, and to provide a basis for determining whether to request the service data from the distributed cache node subsequently.

[0027] This priority query design based on the local cache enables a large number of service requests to be processed locally in the service node, avoiding a large number of network calls to the distributed cache node in the initial stage, and laying a foundation for fast response to requests.

[0028] Step 102, if the service data and the corresponding local version number are obtained, a version number query request is sent to the distributed cache node; the version number query request is used to query the distributed version number corresponding to the service request.

[0029] The service node can interact with the distributed cache node. Specifically, if the service node successfully obtains the service data and the corresponding local version number from the local cache, it can send a version number query request to the distributed cache node.

[0030] After receiving the version number query request, the distributed cache node can query the distributed version number of the service data stored in itself and return it to the service node. The service node can judge the validity of the service data obtained from the local cache based on the comparison of the distributed version number and the local version number.

[0031] It can be understood that the version number query request only requests an identification information, i.e., the distributed version number of the service data corresponding to the service request stored in the distributed cache node. Therefore, the amount of data transmitted between the service node and the distributed cache is small, and compared with directly transmitting a large amount of service data, the network bandwidth can be saved to the greatest extent.

[0032] If the service data does not exist in the local cache and / or the local version number is different from the distributed version number, a data query request for the service data is sent to the distributed cache node, and the service data returned by the distributed cache node and the corresponding distributed version number are stored in the local cache.

[0033] When the service data is not queried in the local cache, it indicates that the service data is not stored in the local cache of the service node or the service data is damaged, or when the local version number queried by the service node is inconsistent with the distributed version number obtained from the distributed cache node, it indicates that the service data in the local cache has expired and loses validity.

[0034] As long as any of the above conditions is met, the service node can initiate a data query request to the distributed cache node to request the service data from the distributed cache node. Correspondingly, the distributed cache node can return the service data and the corresponding distributed version number to the service node after receiving the data query request.

[0035] The service data returned by the distributed cache node is stored in the storage space of the distributed cache node itself, which means that the service data is synchronously backed up in the distributed storage node in advance, and the service data in the preset database is synchronized to the distributed storage node. The service data uploaded by each service node in the business system is stored in the preset database. In this way, the query can be completed directly in the distributed cache node for high-speed response, without the need to continue to request the service data from the database.

[0036] After obtaining the service data and the corresponding distributed version number returned by the distributed cache node, the service node can update its local cache to store the service data and the distributed version number, and return the stored service data when receiving a service request for the service data next time, and use the stored distributed version number as the local version number to verify the validity of the service data.

[0037] In this way, the problem of missing service data in the local cache of the service node can be solved, and an efficient data synchronization mechanism is established to avoid the use of invalid service data in the local cache by the business system, resulting in errors in the business.

[0038] In step 104, the service data is returned to the requester of the service request.

[0039] After the service data obtained from the local cache is verified for validity or the service data obtained from the distributed cache node, the service node can return the obtained service data to the requester of the service request. Thus, the entire method completes a service closed loop that pursues both extremely high response speed and data accuracy.

[0040] As can be seen from the above, in the scheme provided by the application, by setting up a local cache at the service node, the service request can first be locally queried when it arrives, and if there is service data locally, only the distributed version number needs to be requested from the distributed cache node to verify the validity of the locally stored service data. Only when there is no corresponding service data in the local cache or the local version number is inconsistent with the distributed version number, a data query request is sent to the distributed cache node and the local cache is updated. In this way, the accuracy of the service data is ensured, the access pressure of the database and the distributed cache node is reduced, the response delay of cache reading and writing is reduced, and the efficiency of data access and the overall stability of the system in a high-concurrency scenario are improved.

[0041] In an exemplary embodiment, the method further comprises: If the local version number is the same as the distributed version number, the service data is returned to the requester.

[0042] In this exemplary embodiment, after the service node queries and obtains the distributed version number of the corresponding service data from the distributed cache node, it will accurately compare it with the local version number in the local cache. If the two version numbers are confirmed to be exactly the same, it means that the service data currently stored in the local cache of the service node is completely consistent with the service data held by the distributed cache node, and there is no risk of expiration or conflict.

[0043] At this time, the service node can directly adopt the service data obtained from the local cache and return it to the requester of the service request. In this way, in the case that the service data in the local cache of most service nodes is not expired, the service request can be responded extremely quickly at the service node, completely avoiding the network bandwidth consumption and time delay caused by transmitting service data from the distributed cache node through the network, thereby improving the system throughput and response efficiency in a high-concurrency scenario.

[0044] In an exemplary embodiment, the method further comprises: If the service data is not obtained from the distributed cache node, the service data is requested from a preset database.

[0045] In this exemplary embodiment, after the distributed cache node receives the data query request of the service node, it will first initiate a search in its own storage space, aiming to simultaneously obtain the service data corresponding to the data query request and the distributed version number bound thereto.

[0046] Among them, the storage space of the distributed cache node is usually a high-speed storage space specially designed for high-frequency access data, which can respond to queries with extremely low delay, so the design of preferentially local query can shorten the data acquisition time to the greatest extent and adapt to high-concurrency and low-latency business needs.

[0047] If the distributed cache node successfully retrieves the matched business data and the corresponding distributed version number in its own storage space, it can directly perform subsequent return operations based on the business data and the corresponding distributed version number.

[0048] If the business data is not found in the storage space of the distributed cache node after local retrieval, the distributed cache node can return a failure message to the business node, and then the business node can query the preset database to retrieve the business data, thereby avoiding query failure due to the absence of cached data in the distributed cache node and ensuring smooth progress of the business process.

[0049] In an implementation manner, requesting the business data from the preset database comprises: reading the business data from the preset database and generating a distributed version number of the business data; storing the business data and the distributed version number to the distributed cache node and the local cache.

[0050] In this implementation manner, when the distributed cache node fails to query the business data, the business node can establish a communication connection with the preset database and then accurately retrieve the corresponding business data from the preset database. After obtaining the business data from the preset database, the business node can write the business data into the distributed cache node according to the cache strategy, and generate and store a distributed version number of the business data in the distributed cache node. The distributed version number will serve as an identifier for marking the current state of the business data and be stored together with the business data, so as to be quickly called when the business node queries the distributed version number in the future.

[0051] In this way, the distributed cache node plays the role of a data transfer station, which not only guarantees the final accuracy of the business data, but also builds an effective barrier against a large number of request attacks on the preset database.

[0052] In an implementation manner, the method further comprises: storing target data to the preset database; after the target data is updated, updating the target data stored in the preset database based on the updated target data.

[0053] In this implementation manner, the business node can upload the business data generated in its own business process as target data to the preset database, so that other business nodes can read the target data from the preset database when they have a demand for the target data.

[0054] Furthermore, to ensure the timeliness and accuracy of business data stored in the distributed cache nodes, when the business data stored in the preset database is updated, the business node with the updated target data can synchronize the updated target data to the distributed cache nodes in real time, so as to keep the target data stored in the preset database consistent with its data source and ensure that the preset database always holds the latest version of the target data.

[0055] This design, which uses a pre-defined database as the update guide, provides a foundation for the coordination of target data in different versions in the subsequent cache, thereby improving access efficiency while ensuring eventual data consistency in a distributed environment.

[0056] In one implementation, this method further includes: If the target data has been synchronized and stored in the distributed cache node, then after the target data is updated, the target data and the corresponding target version number stored in the distributed cache node will be updated.

[0057] Specifically, after the target data changes, not only will the target data in the preset database be updated, but if the target data has been previously synchronized and stored in the distributed cache node, then data synchronization will also be performed on the distributed cache node.

[0058] After the target data in the preset database is updated, the business node can initiate an update operation on the corresponding target data in the distributed cache node. The update operation includes two parts: first, updating the old value in the distributed cache node with the updated target data to ensure that the target data stored in the distributed cache node is consistent with the preset database; second, generating and setting a new, incrementing target version number as the distributed version number of the updated target data, so that other business nodes can use this target version number to determine the validity of the target data stored locally.

[0059] In this way, an efficient and reliable shared data middleware layer can be built for the entire business system, enabling all business nodes to make decisions based on the latest data and version number when accessing distributed cache nodes, thus providing a strong guarantee for the final data consistency in a distributed environment.

[0060] like Figure 2 As shown, in a distributed cache node, this data caching method can implement the following process: Step 201: If a version number query request is received from a business node, query the distributed version number of the business data corresponding to the version number query request, and return the distributed version number to the business node.

[0061] When a distributed cache node receives a version number query request from a business node, it will immediately and accurately query the distributed version number corresponding to the specific business data pointed to by the request in its own storage space. The distributed version number can mark the current state of the business data.

[0062] After the query is completed, the distributed cache node returns the obtained distributed version number to the business node that initiated the request. Then, the business node can compare the local version number with the distributed version number. If they are the same, it means that the business data in the local cache of the business node is valid, and there is no need to request business data from the distributed cache node again, so as to avoid unnecessary complete data transmission and reduce network interaction. Conversely, if they are different, it means that the business data in the local cache of the business system is invalid, and a data query request needs to be sent to the distributed cache node to request business data.

[0063] Step 202: If a data query request is received from a business node, query the business data corresponding to the data query request and the corresponding distributed version number, and return the business data and the corresponding distributed version number to the business node.

[0064] If a distributed cache node receives a data query request from a business node, it can retrieve the specified business data and its associated distributed version number from the query request. After obtaining the complete business data and its corresponding distributed version number, the distributed cache node returns both the business data and the distributed version number to the business node. This allows the business node to update its local cache with the latest business data and, based on this, provide accurate business data back to the requester.

[0065] This ensures that complete business data is transmitted over the network only when absolutely necessary, avoiding indiscriminate and frequent access to large amounts of data. As a result, the response latency of cache read and write is significantly reduced in high-concurrency scenarios, improving the overall processing capacity and stability of the system.

[0066] like Figure 3 As shown, taking an insurance business scenario as an example, the data caching system provided in this application will be described. The distributed cache nodes can store business data such as fund configuration data, accounting configuration data, public configuration data, and payment configuration data, along with their corresponding distributed version numbers. The fund module, accounting module, and public configuration module can act as data sources, providing the above business data to the preset database and the distributed cache nodes for cache maintenance. The payment module can act as a business node, handling business requests such as payment order placement, and using the business data cached in the distributed cache nodes when needed.

[0067] Specifically, after the payment module initiates a payment order request, it needs to call the payment routing business data in the fund module. Therefore, the local cache can be queried first, and the version number of the business data in the local cache can be obtained. Then, the cache is used to initiate a query to the distributed cache node.

[0068] If the business data is obtained from the local cache, a version number query request is initiated to the distributed cache node to query the distributed version number of the business data, and the local version number is compared: If the version numbers are consistent, the business data in the local cache is directly read and returned to the business requester for subsequent related business logic, such as the payment module directly using the payment routing configuration in the local cache to complete the order placement. If the version numbers are inconsistent or the business data is missing in the local cache, the latest business data and the corresponding distributed version number are read from the distributed cache node, synchronized to the local cache, and then returned to the requester. If the distributed cache node also lacks the business data, the payment module initiates a query to the preset database to obtain the latest business data, synchronizes the data to the distributed cache node, generates an initial distributed version number, updates the local cache, and finally returns the requester.

[0069] When the payment routing configuration in the insurance business needs to be adjusted, the business node where the fund module is located can modify the payment routing related data in the preset database. After the modification, the payment routing data stored in the preset database is changed. Then, the business node where the fund module is located can automatically trigger the synchronization mechanism to synchronize the changed payment routing data from the preset database to the distributed cache node, and automatically increment the corresponding distributed version number.

[0070] When the payment module of the insurance collection and payment system initiates a payment order request next time, it can detect that the local version number in the local cache is inconsistent with the distributed version number in the distributed cache node, and then pull the latest payment routing data and the distributed version number from the distributed cache node, synchronize them to the local cache, and use the latest configuration for subsequent payment order requests of the business node.

[0071] It should be understood that, although each step in the flowchart involved in the above-described embodiments is shown in sequence according to the arrow, these steps are not necessarily executed in the order indicated by the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other orders. Moreover, at least some of the steps in the flowchart involved in the above-described embodiments can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be alternately or alternately executed with at least some of other steps or steps or stages in other steps. It can be understood that the steps in different embodiments can be freely combined as needed, and various non-contradictory schemes formed by the combination are within the scope of protection of the present application.

[0072] Based on the same inventive concept, the embodiments of the present application also provide a data caching device for implementing the above-mentioned data caching method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so the specific limitations in one or more data caching device embodiments provided below can refer to the limitations of the data caching method in the above text, which will not be repeated here.

[0073] In an exemplary embodiment, as shown in Figure 4 a data caching device is provided, applied to a service node, comprising: a query module 301, configured to query the service data corresponding to the service request and the corresponding local version number in the local cache after receiving the service request; a first request module 302, configured to send a version number query request to the distributed cache node if the service data and the corresponding local version number are obtained; the version number query request is used to query the distributed version number corresponding to the service request; a second request module 303, configured to send a data query request for the service data to the distributed cache node if the service data does not exist in the local cache, and / or the local version number is different from the distributed version number, and store the service data and the corresponding distributed version number returned by the distributed cache node to the local cache; a return module 304, configured to return the service data to the requester of the service request.

[0074] In an exemplary embodiment, as shown in Figure 5 a data caching device is provided, applied to a distributed cache node, comprising: The first processing module 401 is configured to, if a version number query request sent by a service node is received, query a distributed version number of service data corresponding to the version number query request, and return the distributed version number to the service node. The second processing module 402 is configured to, if a data query request sent by the service node is received, query service data corresponding to the data query request and a corresponding distributed version number, and return the service data and the corresponding distributed version number to the service node.

[0075] The modules in the data caching apparatus can be implemented by software, hardware, or a combination thereof. The modules can be embedded in or independent of a processor in a computer device in hardware form, or stored in a memory in the computer device in software form, so as to be called and executed by the processor to perform operations corresponding to the modules.

[0076] In an exemplary embodiment, a computer device is provided, which can be a server, and an internal structure diagram of the computer device can be as shown in Figure 6 The computer device includes a processor, a memory, an input / output interface (I / O), and a communication interface. The processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating computer program and a database. The internal memory provides an environment for running of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is configured to store measurement data and / or positioning information. The input / output interface of the computer device is configured to exchange information between the processor and external devices. The communication interface of the computer device is configured to communicate with external terminals through a network connection. The computer program is executed by the processor to implement a data caching method.

[0077] Those skilled in the art can understand that Figure 6 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0078] In an exemplary embodiment, a computer device is provided, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps described in any of the above embodiments.

[0079] In one embodiment, a computer readable storage medium is provided, having stored thereon a computer program which, when executed by a processor, implements the steps of any of the above embodiments.

[0080] In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of any of the above embodiments.

[0081] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant regulations.

[0082] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the above-mentioned embodiment methods. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. The non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. The volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration but not limitation, the RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., without being limited thereto.

[0083] The technical features of the above embodiments can be combined in any manner. To make the description concise, all possible combinations of the technical features in the above embodiments are not described, but as long as the combinations of the technical features do not exist, they should be considered as the scope of the present application.

[0084] The above-described embodiments are merely illustrative of several embodiments of the present application, and the description is relatively specific and detailed, but should not be understood as a limitation on the scope of the patent. It should be noted that for those skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of protection of the present application should be subject to the appended claims.

Claims

1. A data caching method, characterized by, The method applied to a service node comprises: After receiving a service request, querying corresponding service data and a corresponding local version number of the service request in a local cache; If the service data and the corresponding local version number are obtained, sending a version number query request to a distributed cache node; the version number query request is used to query a distributed version number corresponding to the service request; If the service data does not exist in the local cache, and / or the local version number is different from the distributed version number, sending a data query request for the service data to the distributed cache node, and storing the service data and the corresponding distributed version number returned by the distributed cache node to the local cache; Returning the service data to a requester of the service request.

2. The method of claim 1, wherein, The method further comprises: If the local version number is the same as the distributed version number, returning the service data to the requester.

3. The method of claim 1, wherein, The method further comprises: If the service data is not obtained from the distributed cache node, requesting the service data from a preset database.

4. The method of claim 3, wherein, The method of requesting the service data from the preset database comprises: Reading the service data from the preset database, and generating a distributed version number of the service data; Storing the service data and the distributed version number to the distributed cache node and the local cache.

5. The method of claim 3, wherein, The method further comprises: Storing target data to the preset database; After the target data is updated, updating the target data stored in the preset database based on the updated target data.

6. The method of claim 5, wherein, The method further comprises: If the target data has been stored to the distributed cache node, after the target data is updated, updating the target data and a corresponding target version number stored in the distributed cache node.

7. A data cache apparatus, characterized by The device applied to a service node comprises: A query module, configured to query corresponding service data and a corresponding local version number of a service request in a local cache after receiving the service request; A first request module, configured to send a version number query request to a distributed cache node if the service data and the corresponding local version number are obtained; the version number query request is used to query a distributed version number corresponding to the service request; A second request module, configured to send a data query request for the service data to the distributed cache node if the service data does not exist in the local cache, and / or the local version number is different from the distributed version number, and store the service data and the corresponding distributed version number returned by the distributed cache node to the local cache; A return module, configured to return the service data to a requester of the service request.

8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, The processor executes the computer program to realize the steps of the method in any one of claims 1 to 6.

9. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize the steps of the method in any one of claims 1 to 6.

10. A computer program product, characterised in that, The computer program is executed by the processor to realize the steps of the method in any one of claims 1 to 6.