Data processing method, device and equipment
By comparing and restoring data consistency in real time within a multi-level caching system, the problems of latency and high resource consumption in cache inconsistency detection are solved, thereby improving the stability and performance of financial business systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-05
- Publication Date
- 2026-03-31
AI Technical Summary
In existing technologies, multi-level caching systems lack effective cache data consistency discovery and self-healing solutions when data is inconsistent, resulting in detection latency, high resource consumption, and high database access pressure, which affects business stability and performance.
When a read request is received, the local cache is queried first. If an error is found, the data is retrieved from the second-level cache or the database. The consistency between the local and second-level cache data is compared asynchronously. If the data is inconsistent, the second-level cache is set to invalid and the local cache data is deleted. The asynchronous thread is used to detect and recover from inconsistencies in real time.
It enables real-time detection and recovery of cache inconsistencies, reduces the pressure on database access, improves business stability and performance, and avoids resource waste and delays.
Smart Images

Figure CN121764931A_ABST
Abstract
Description
Technical Field
[0001] This document relates to the field of computer technology, and in particular to a data processing method, apparatus, and device. Background Technology
[0002] To address the access pressure on databases caused by frequent queries and retrieval of hot data, multi-level caching systems are typically implemented. For example, in financial services, billing systems often introduce a second-level remote cache (such as a T-base-based cache) at the database level on top of a local cache, thereby reducing database access pressure. However, regarding consistency between multi-level caches, there is currently no universal solution for cache data consistency discovery and self-healing in cases of cache data inconsistency. To ensure the consistency of the second-level cache, a better cache consistency identification and self-healing solution is needed. Summary of the Invention
[0003] The purpose of the embodiments in this specification is to provide a better cache consistency identification and self-healing scheme.
[0004] To achieve the above technical solution, the embodiments in this specification are implemented as follows: This specification provides a data processing method, comprising: receiving a read request for target business data; responding to the read request by querying the target business data in a local cache; if the query for the target business data in the local cache is abnormal, querying the target business data by calling a second-level cache or a database; retrieving the cached target business data from the second-level cache, storing the retrieved target business data from the second-level cache in the local cache, and asynchronously retrieving the target business data from the database, comparing the target business data in the database with the target business data in the second-level cache, and if they are inconsistent, setting the target business data in the second-level cache to an invalid state and deleting the target business data from the local cache.
[0005] This specification provides a data processing apparatus, comprising: a request module for receiving a read request for target business data; a local query module for querying the target business data in a local cache in response to the read request; a data read module for querying the target business data by calling a secondary cache or a database if the query for the target business data in the local cache is abnormal; and a data processing module for retrieving the cached target business data from the secondary cache, storing the retrieved target business data from the secondary cache in the local cache, asynchronously retrieving the target business data from the database, comparing the target business data in the database with the target business data in the secondary cache, and if they are inconsistent, setting the target business data in the secondary cache to an invalid state and deleting the target business data from the local cache.
[0006] This specification provides a data processing apparatus comprising: a processor; and a memory arranged to store computer-executable instructions, wherein the executable instructions, when executed, cause the processor to: receive a read request for target service data; in response to the read request, query the target service data in a local cache; if the query for the target service data in the local cache is abnormal, query the target service data by invoking a secondary cache or a database; retrieve the cached target service data from the secondary cache, store the retrieved target service data from the secondary cache in the local cache, and retrieve the target service data from the database asynchronously, compare the target service data in the database with the target service data in the secondary cache, and if they are inconsistent, set the target service data in the secondary cache to an invalid state and delete the target service data from the local cache.
[0007] This specification also provides a storage medium for storing computer-executable instructions. When executed by a processor, the executable instructions implement the following process: receiving a read request for target business data; responding to the read request, querying the target business data in a local cache; if the query for the target business data in the local cache is abnormal, querying the target business data by calling a secondary cache or a database; retrieving the cached target business data from the secondary cache, storing the retrieved target business data from the secondary cache in the local cache, and asynchronously retrieving the target business data from the database, comparing the target business data in the database with the target business data in the secondary cache, and if they are inconsistent, setting the target business data in the secondary cache to an invalid state and deleting the target business data from the local cache.
[0008] This specification also provides a computer program product, including a computer program that, when executed by a processor, implements the following process: receiving a read request for target business data; responding to the read request, querying the target business data in a local cache; if the query for the target business data in the local cache is abnormal, querying the target business data by calling a second-level cache or a database; retrieving the cached target business data from the second-level cache, storing the retrieved target business data from the second-level cache in the local cache, and asynchronously retrieving the target business data from the database, comparing the target business data in the database with the target business data in the second-level cache, and if they are inconsistent, setting the target business data in the second-level cache to an invalid state and deleting the target business data from the local cache. Attached Figure Description
[0009] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Figure 1 This is a schematic diagram of a data query caching process described in this specification; Figure 2 This is a schematic diagram illustrating a data consistency processing procedure as described in this specification; Figure 3 This is a schematic diagram of the structure of a data processing system described in this specification; Figure 4 This is a schematic diagram of a data processing procedure described in this specification; Figure 5 This is a schematic diagram illustrating another data processing procedure described in this specification; Figure 6 This is a schematic diagram of yet another data processing procedure described in this specification; Figure 7 This is a schematic diagram of yet another data processing procedure described in this specification; Figure 8 This is a schematic diagram of a data processing device according to the present specification; Figure 9 This is a schematic diagram of a data processing device described in this specification. Detailed Implementation
[0010] This specification provides a data processing method, apparatus, and device through its embodiments.
[0011] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.
[0012] This specification provides an optimization mechanism for dual-caching consistency based on high-performance key-value storage. For the financial business domain, the billing system's first-level cache architecture can directly use Guava Cache as the local cache. Simultaneously, combined with a database cluster mode, after the billing system starts, the first business transaction queries the database to obtain the corresponding data. Then, the retrieved data is populated back into the local cache, and subsequent business transactions will directly access the local cache to obtain the data. Analysis of the billing system's first-level cache architecture reveals that the local cache has a strong dependency on the database. Database instability directly impacts the financial business chain (such as the payment chain), affecting the availability and transactions of financial services. Database access can also create performance bottlenecks, increasing the response time of the billing core interface. Uncertain changes within the database (e.g., changes in the execution plan affect the optimal selection of query table indexes in the billing system) can indirectly lead to decreased stability and also affect the financial business chain (such as the payment chain). Based on the above considerations, in order to improve the stability of the financial business system in the business chain, reduce the risk of the financial business system to the business, and weaken the strong dependence on the database, the data caching architecture of the financial business system can be redesigned. A second-level remote cache (such as a T-base-based cache) can be introduced at the first-level cache and database levels, thereby reducing the access pressure on the database. Specifically, for example... Figure 1 As shown, upon receiving a query request for certain data, the system first queries the local cache, Guava Cache. If the data exists in the local cache, the query result is returned. If the data does not exist in the local cache, the system queries the second-level remote cache (taking a Tbase-based cache as an example). If the data exists in the second-level remote cache, the query result is returned, and the data from the second-level remote cache is stored in the local cache. If the data does not exist in the second-level remote cache, the data is read from the database, stored in the second-level remote cache, and then stored in the local cache. However, regarding consistency between multi-level caches, there is currently no universal solution for cache data consistency discovery and self-healing in cases of inconsistent cache data.
[0013] Currently, most solutions for ensuring consistency between dual caches employ a timed scanning and self-healing approach. Specifically, such as... Figure 2 As shown, the system periodically scans and compares the data in the cache and the database. If inconsistencies are found, the corresponding data is automatically repaired and the cache is updated, with corresponding repair logs recorded. However, this method suffers from detection delays and cannot repair in real time. The scheduled task cannot immediately detect cache inconsistencies, resulting in a time delay. Furthermore, it consumes resources; scanning efficiency is low with large amounts of data, and each cache query requires significant cache service performance, impacting business cache query performance. In addition, in a cluster deployment mode, the centralized updates of scheduled tasks can put considerable access pressure on the database. Therefore, the embodiments in this specification aim to propose a better cache consistency identification and self-healing scheme while ensuring second-level cache consistency. Specific processing details can be found in the following embodiments.
[0014] The data processing methods provided in one or more embodiments of this specification are applicable to the implementation environment of data processing. (Refer to...) Figure 3 The implementation environment includes at least: The system consists of client 100, server 200, and secondary cache 300. In addition, the server running server 200 can be configured with a local cache and a corresponding query mechanism.
[0015] Client 100 can run on terminal devices, which can be mobile phones, personal computers, tablets, e-book readers, wearable devices, devices that interact with information based on AR (Augmented Reality) and VR (Virtual Reality), and laptop computers, etc. Client 100 can be installed on terminal devices. Client 100 can be an application, a browser, or a subroutine embedded in an application, etc.
[0016] Server 200 can run on a server, which can be one or more servers, a server cluster consisting of several servers, or a cloud server on a cloud computing platform. Server 200 can be installed on the server, and server 200 can be an application or a subroutine embedded in an application.
[0017] The second-level cache 300 can run on a server, which can be one or more servers, a server cluster consisting of several servers, or a cloud server on a cloud computing platform. The second-level cache 300 can cache a certain amount of data from the database 400.
[0018] Database 400 can be set on a specified server, for example, it can be set on the server where the second-level cache 300 is located, or it can be set on a server other than the server where the second-level cache 300 is located. Database 400 can store information related to key-value pair classes.
[0019] In this implementation environment, server 200 can receive read requests for target business data sent by client 100. In response to the read request, server 200 queries the target business data in its local cache. If the query for the target business data in the local cache fails, it queries the target business data by calling the second-level cache 300 or the database 400. Then, it can retrieve the cached target business data from the second-level cache 300, store the retrieved target business data from the second-level cache 300 in the local cache, and retrieve the target business data from the database 400 asynchronously. It then compares the target business data in the database 400 with the target business data in the second-level cache. If they are inconsistent, the target business data in the second-level cache 300 is set to an invalid state, and the target business data in the local cache is deleted.
[0020] like Figure 4 As shown in the embodiments of this specification, a data processing method is provided. The execution subject of this method can be a terminal device or a server, etc. The terminal device can be a mobile terminal device such as a mobile phone or tablet computer, or a computer device such as a laptop or desktop computer, or an IoT device (specifically, a smartwatch, in-vehicle device, etc.). The server can be a single server or a server cluster composed of multiple servers. The server can be the server of a business platform where a merchant has joined, and the business platform can be a business platform such as a financial business or online shopping business. This embodiment uses a server as the execution subject for detailed description. For the case where the execution subject is a terminal device, please refer to the following server case processing, which will not be repeated here. The method may specifically include the following steps: In step S402, a read request for the target service data is received.
[0021] The target business data can be any data related to the specified business. For example, the target business data can be one or more of the following in a payment business: the payer's account information, the payee's account information, and order information. Alternatively, the target business data can be information about the fees that a merchant on an e-commerce platform needs to pay during a specified period. Or, the target business data can be relevant data from any specified website. The specific data can be set according to the actual situation.
[0022] In implementation, a read request for target business data can be generated when certain business data (i.e., target business data) needs to be obtained during the execution of a certain business. For example, if a user needs to pay a merchant for a product, the user's account information needs to be read, and the terminal device can generate a read request for the user's account information. Similarly, if a merchant needs to pay fees for a specified period on an e-commerce platform, the terminal device can generate a read request for the merchant's billing information. Alternatively, when a specified settlement period arrives (such as the 10th of each month or 00:00 each day), the business platform can automatically trigger a settlement instruction for the target merchant. In this case, the target merchant's identifier can be obtained, and a settlement request can be generated based on the identifier. The server can obtain the settlement request for the target merchant and send it to the target merchant. The target merchant can then generate a read request for the settlement bill corresponding to the settlement request. Specific details can be set according to actual circumstances, and this specification does not limit this aspect in the embodiments.
[0023] In step S404, in response to the above read request, the target business data is queried from the local cache.
[0024] Local caching refers to caching within the memory of the terminal device or server itself. Compared to retrieving data from remote services via network bandwidth, local caching involves retrieving data locally, resulting in faster and more efficient responses. However, since local caching is stored in memory, its storage capacity is limited by the memory resources of the terminal device or server. While local caching offers fast read speeds, there may be some lag in data updates. Therefore, application code using local caching needs to be able to accept the inconsistencies caused by potential delays in locally cached data.
[0025] In implementation, in response to the above read request, the system can first check whether the target business data exists in the local cache. In practical applications, the data stored in the local cache can be stored in key-value pairs. The key can be the identifier of the target business data, such as the name, hash value, or encoding of the target business data, and the value can be the content of the target business data. In this way, the above read request can include the identifier (key) of the target business data, and the above processing of checking whether the target business data exists in the local cache can be achieved by checking whether the identifier of the target business data is contained in the local cache. The specific settings can also be set according to the actual situation, and this specification does not limit this embodiment.
[0026] In step S406, if the query for the target business data in the local cache fails, the target business data is retrieved by calling the second-level cache or the database.
[0027] Query anomalies can occur when the local cache fails to return any relevant information within a predetermined timeframe after a query, or when the query timeout occurs, or when the target business data is not found. The specific settings can be configured according to actual needs. Data stored in the second-level cache can be in key-value pairs. The key can be an identifier for the target business data, such as its name, hash value, or code, while the value can be the content of the target business data. This allows querying the second-level cache to check if it contains the identifier of the target business data. The second-level cache can be an independently configured caching mechanism, placed between the terminal device and the database, or it can act as a database cache, residing in the memory of the server hosting the database. The specific configuration can be adjusted according to actual needs. Second-level caching can be implemented through server clusters, such as Tair cache server clusters and Tbase cache server clusters. Among them, Tbase cache server clusters provide rich storage data structures and API interfaces, as well as highly stable service guarantees. Moreover, a single instance of a TBase cache server cluster can handle 30,000 to 50,000 QPS (Queries per second), and a TBase cache server cluster can handle tens of millions to hundreds of millions of QPS.
[0028] In implementation, if the target business data is not found in the local cache (specifically, if the identifier (i.e., key) of the target business data is not found in the local cache), or the query timeout occurs, or the local cache does not return any relevant information within the predetermined time after querying the information, it can be determined that the query for the target business data in the local cache is abnormal. In this case, the target business data can be queried through other caches or even the database. That is, when the query for the target business data in the local cache is abnormal, the processing will execute the `load` method of `cacheload`. In this method, the target business data will be loaded from the second-level cache. If the target business data does not exist in the second-level cache, it will be loaded from the database. Afterward, the target business data can be backfilled into the second-level cache and the local cache. Specifically, the second-level cache is invoked and queried (specifically, by the identifier (i.e., key) of the target business data). If the target business data exists in the second-level cache, the query result is returned to read the target business data. If the target business data does not exist in the second-level cache (specifically, by the identifier (i.e., key) of the target business data does not exist), the target business data is read from the database (specifically, by querying the target business data by the identifier of the target business data and providing the target business data to the terminal device for the user to read). The target business data can be stored in the second-level cache (specifically, by storing the identifier (i.e., key) of the target business data and the target business data in the second-level cache), and then the stored target business data is stored in the local cache through the second-level cache.
[0029] If the target business data is found in the local cache, it can be provided to the user on the terminal device so that the user can view the target business data.
[0030] In step S408, the target business data is retrieved from the second-level cache, stored in the local cache, and retrieved from the database asynchronously. The target business data in the database is compared with the target business data in the second-level cache. If they are inconsistent, the target business data in the second-level cache is set to invalid and the target business data in the local cache is deleted.
[0031] In implementation, such as Figure 5As shown, to ensure the consistency between the target business data backfilled to the local cache and the target business data in the database, a consistency check can be performed on the data in the dual-caching system. Specifically, the target business data can be retrieved from the second-level cache and stored in the local cache. During this process, an asynchronous thread can be started to retrieve the target business data from the database asynchronously and compare it with the target business data in the second-level cache. If the target business data in the database is inconsistent with the target business data in the second-level cache, it indicates that the target business data stored in the database may have been read-overwritten or manually corrected and updated. At this time, the target business data in the second-level cache and the local cache is no longer the latest version of the target business data. The target business data in the second-level cache can be set to an invalid state, and the target business data in the local cache can be deleted. Subsequently, the corresponding data can be read directly from the database, and the processing of steps S406 and S408 can continue to be executed, that is, a loop comparison can be performed until the target business data in the database is consistent with the target business data in the second-level cache. In this way, by discovering real-time business traffic, version comparison of target business data is performed in an asynchronous thread to detect cache inconsistencies, providing real-time detection capabilities. Moreover, you can recover cached data through self-healing capabilities in the event of data inconsistencies.
[0032] It should be noted that, as Figure 5 As shown, if the invalidation status setting of the target business data in the second-level cache fails, the process of deleting the target business data in the local cache can continue. Subsequently, the corresponding data can be read directly from the database, and loop comparison and other processing can be performed.
[0033] This specification provides a data processing method. Upon receiving a read request for target business data, the method responds by querying the target business data in a local cache. If the query fails, the method queries the target business data using a second-level cache or a database. The method then retrieves the cached target business data from the second-level cache and stores it in the local cache. Asynchronously, the method retrieves the target business data from the database and compares it with the data in the second-level cache. If they are inconsistent, the target business data in the second-level cache is set to invalid and deleted from the local cache. This method utilizes real-time business traffic to detect version comparisons of target business data in an asynchronous thread, enabling real-time detection of cache inconsistencies. Furthermore, it allows for self-healing recovery of cached data in case of inconsistencies. Since real-time business traffic is used for cache comparison, it avoids scanning the entire cache, only querying the cached data relevant to the current business operation, thus not affecting the timeliness of cache queries.
[0034] In practical applications, if the two are inconsistent in step S408 above, the target business data in the second-level cache is set to an invalid state, and the target business data in the local cache is deleted. There are various ways to do this. Here is another optional method, which can be found below: If the two are inconsistent, the target business data in the second-level cache is set to an invalid state, and a first cache data eviction policy is set for the target business data stored in the local cache, so as to delete the target business data in the local cache through the first cache data eviction policy.
[0035] The first cache data eviction policy is an additional eviction policy set for target business data stored in the local cache. This policy can include various approaches. For example, it can be a policy built by setting a fixed storage duration, such as eviction of target business data after 10 seconds or after 5 seconds. Alternatively, it can be a policy set based on the number of queries, such as eviction after 5 queries or 3 queries. Another approach is to eviction based on the number of queries within a preset storage duration, such as eviction after 10 seconds if the number of queries is less than or greater than 3, or eviction after 5 seconds if the number of queries is less than or greater than 1. The specific policy can be set according to actual circumstances.
[0036] In practice, deleting the cache is a risky operation. In extreme cases, if the cached data cannot be restored to consistency with the database within a short period, all related business requests during the cache deletion period will directly access the database, which is very detrimental to the database. Therefore, a layer of protection needs to be added to the database before deleting the cache, namely, setting an eviction policy for the target business data stored in the local cache. This allows the data in the local cache to be stored for a period of time before being deleted, thereby reducing the number of requests sent to the database. Specifically, for example... Figure 6 As shown, if the target business data in the database is inconsistent with the target business data in the second-level cache, the target business data in the second-level cache is set to an invalid state. Then, a separate first cache data eviction policy (also known as a local daemon cache) can be set for the target business data stored in the local cache. When the first cache data eviction policy is not met (i.e., during the daemon cache verification phase), the target business data can still be retrieved in the local cache. Even though the target business data may differ from the target business data in the database, data read operations can still be provided to the user, improving the user experience. When the first cache data eviction policy is met, it can be executed to evict (or delete) the target business data in the local cache. Other data stored in the local cache can also be protected by setting cache data eviction policies (or local daemon caches) to protect database performance and reduce database pressure.
[0037] In practical applications, a second cache data eviction policy is set in the local cache. The first cache data eviction policy mentioned above is different from the second cache data eviction policy. The specific processing method for deleting the target business data in the local cache in the above process can be varied. The following provides another optional processing method, which can be found in the following content: Delete the target business data in the local cache through the first cache data eviction policy or the second cache data eviction policy.
[0038] The second cache data eviction policy can be an eviction policy that all data in the entire local cache must follow. The second cache data eviction policy can include a variety of policies. For example, the second cache data eviction policy can be an eviction policy constructed using the Least Frequently Used (LFU) algorithm. The LFU algorithm can evict data based on the access frequency of the data. The second cache data eviction policy can also be an eviction policy set by a random eviction mechanism, etc. The specific policy can be set according to the actual situation.
[0039] In implementation, the target business data in the local cache must comply with both the second cache data eviction policy and the first cache data eviction policy. Both of these policies can evict the target business data in the local cache. Specifically, the second cache data eviction policy is constructed using the Least Frequently Used (LFU) algorithm, while the first cache data eviction policy can be set to evict the data after it has been queried 5 times. Before deleting the target business data in the local cache, the current number of times the target business data has been queried can be obtained, and it can be determined whether the target business data meets the second cache data eviction policy. If the target business data does not meet the second cache data eviction policy, but the number of times it has been queried has reached 5 times, the target business data in the local cache can be deleted using the first cache data eviction policy. If the target business data meets the second cache data eviction policy, but the number of times it has been queried has not reached 5 times, the target business data in the local cache can be deleted using the second cache data eviction policy. The specific policy can be set according to the actual situation, and this embodiment does not limit this.
[0040] In practical applications, the second cached data eviction policy is an eviction policy built using the Least Recently Used (LRU) algorithm, while the first cached data eviction policy is an eviction policy built using a preset data write duration.
[0041] The LRU algorithm updates the access time of data with each access and then selects the least accessed data for eviction. The data write duration (or data storage duration) can be set according to actual conditions, such as 5 seconds or 10 seconds. In practical applications, the first cache data eviction policy can set the eviction timing of the stored target business data and its identifier to 10 seconds after the data is written, or to 10 seconds after `exprieAfterWrite`. `exprieAfterWrite` is a GuavaCache policy used to control the expiration of cached items (such as the corresponding stored target business data and its identifier). It indicates that a cached item will be reclaimed (i.e., removed) if it is not updated within a specified time interval, and new data must be reloaded on the next access. The first cache data eviction policy, built using a preset data write duration, simplifies cache preservation in read-heavy, write-light environments and reduces database access, thus protecting database stability.
[0042] In practical applications, the specific processing method of the above step S406 can be varied. Here is another optional processing method, which can be found in the following content: If the query of the target business data in the local cache is abnormal, the second-level cache is called to query the target business data.
[0043] The specific processing method for retrieving the cached target business data from the second-level cache in the corresponding step S408 above can be as follows: If the target business data is found in the second-level cache, then retrieve the cached target business data from the second-level cache.
[0044] In practical applications, the specific processing method of step S406 can vary. Another optional processing method is provided below, specifically referring to steps S4062 and S4064 below. Based on this, in the above... Figure 4 Based on this, the specific steps included in this method can be as follows: Figure 7 As shown.
[0045] In step S4062, if the query for the target business data in the local cache fails, the second-level cache is invoked to query the target business data.
[0046] In implementation, if an error occurs when querying the target business data in the local cache, the second-level cache can be invoked and queried (the presence of the target business data in the second-level cache can be determined by checking if its identifier is stored). If the target business data exists in the second-level cache, the query results are returned to retrieve the target business data. If the target business data does not exist in the second-level cache, it is retrieved from the database (specifically, the target business data can be queried using its identifier). The target business data can then be stored in the second-level cache (specifically, the identifier of the target business data can be stored in the second-level cache along with the corresponding target business data).
[0047] In step S4064, if the query for the target business data in the second-level cache is abnormal, the target business data is retrieved from the database and cached in the second-level cache.
[0048] Among them, query anomalies may include failure to return any relevant information within a predetermined time after receiving the query request, query processing timeout, or failure to find the target business data (or the identifier of the target business data). Failure to return any relevant information within a predetermined time after receiving the query request or query processing timeout may be caused by abnormal situations such as network jitter or secondary cache service jitter (such as the secondary cache service being unavailable) during remote calls, resulting in link interruption.
[0049] Based on the processing in steps S4062 and S4064 above, the subsequent processing in step S408, which involves retrieving the cached target business data from the secondary cache, can be executed.
[0050] In practical applications, after setting the target business data in the second-level cache to an invalid state, the target business data stored in the second-level cache can also be deleted. For details, please refer to the following: call the second-level cache and delete the target business data stored in the second-level cache through the second-level cache.
[0051] In practical applications, such as Figure 6 As shown, if the deletion of the target business data stored in the second-level cache fails, the subsequent processing of deleting the target business data in the local cache can continue.
[0052] In practical applications, target business data includes business data related to resource transfer, which includes one or more of the following: resource account information and the quantity of resources to be transferred.
[0053] The business data related to resource transfer can be payment-related data or transfer-related data, etc. The quantity of resources to be transferred can include, for example, the amount to be paid or transferred, and can be set according to the actual situation.
[0054] This specification provides a data processing method. Upon receiving a read request for target business data, the method responds by querying the target business data in a local cache. If the query fails, the method queries the target business data using a second-level cache or a database. The method then retrieves the cached target business data from the second-level cache and stores it in the local cache. Asynchronously, the method retrieves the target business data from the database and compares it with the data in the second-level cache. If they are inconsistent, the target business data in the second-level cache is set to invalid and deleted from the local cache. This method utilizes real-time business traffic to detect version comparisons of target business data in an asynchronous thread, enabling real-time detection of cache inconsistencies. Furthermore, it allows for self-healing recovery of cached data in case of inconsistencies. Since real-time business traffic is used for cache comparison, it avoids scanning the entire cache, only querying the cached data relevant to the current business operation, thus not affecting the timeliness of cache queries.
[0055] In addition, the cache comparison is performed using real-time business traffic. Therefore, database access only involves data related to the version of this business. A protective caching mechanism is also used for database access. Data will not be accessed in a concentrated manner at the same time, so as not to affect the timeliness of business traffic cache query. Furthermore, it can simplify the cache freshness solution in the context of more reads and fewer writes in the cache and reduce database access to protect the stability of the database.
[0056] The above describes the data processing method provided in the embodiments of this specification. Based on the same idea, the embodiments of this specification also provide a data processing apparatus, such as... Figure 8 As shown.
[0057] The data processing device includes: a request module 801, a local query module 802, a data reading module 803, and a data processing module 804, wherein: Request module 801 receives read requests for target business data; The local query module 802, in response to the read request, queries the target business data in the local cache; If the query for the target business data in the local cache is abnormal, the data reading module 803 will query the target business data by calling the second-level cache or the database. The data processing module 804 retrieves the target business data from the secondary cache, stores the retrieved target business data from the secondary cache into the local cache, retrieves the target business data from the database asynchronously, and compares the target business data in the database with the target business data in the secondary cache. If the two are inconsistent, the target business data in the secondary cache is set to an invalid state, and the target business data in the local cache is deleted.
[0058] In this embodiment of the specification, if the data processing module 804 and the target business data in the secondary cache are inconsistent, the target business data in the secondary cache is set to an invalid state, and a first cache data eviction policy is set for the target business data stored in the local cache, so as to delete the target business data in the local cache through the first cache data eviction policy.
[0059] In this embodiment of the specification, a second cache data eviction policy is set in the local cache. The first cache data eviction policy is different from the second cache data eviction policy. The data processing module 804 deletes the target business data in the local cache through the first cache data eviction policy or the second cache data eviction policy.
[0060] In the embodiments of this specification, the second cached data eviction policy is an eviction policy constructed using the Least Recently Used (LRU) algorithm, and the first cached data eviction policy is an eviction policy constructed using a preset data write duration.
[0061] In this embodiment of the specification, if the data reading module 803 encounters an error in querying the target business data in the local cache, it will invoke the second-level cache to query the target business data. If the target business data is found in the secondary cache, the data processing module 804 retrieves the cached target business data from the secondary cache.
[0062] In this embodiment of the specification, the data reading module 803 includes: If the first query unit encounters an error in querying the target business data in the local cache, it invokes the second-level cache to query the target business data. If the second query unit encounters an error in querying the target business data in the second-level cache, it retrieves the target business data from the database and caches the target business data stored in the database into the second-level cache.
[0063] In the embodiments described in this specification, the device further includes: The data deletion module calls the secondary cache and deletes the target business data stored in the secondary cache.
[0064] In the embodiments described in this specification, the target business data includes business data related to resource transfer, and the target business data includes one or more of the following: information about resource accounts and the quantity of resources to be transferred.
[0065] For ease of description, the above devices are described by dividing them into various modules or units based on their functions. Of course, when implementing one or more embodiments of this specification, the functions of each module or unit can be implemented in one or more software and / or hardware components, or a module that performs the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are merely illustrative; the division of each module and unit is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or modules can be combined or integrated into another system, or some features can be ignored or not executed, etc.
[0066] This specification provides a data processing apparatus that, upon receiving a read request for target business data, responds to the read request by querying the target business data in a local cache. If the query for the target business data in the local cache is abnormal, the apparatus queries the target business data by calling a second-level cache or a database. Then, it retrieves the cached target business data from the second-level cache, stores the retrieved target business data from the second-level cache into the local cache, and asynchronously retrieves the target business data from the database. It then compares the target business data in the database with the target business data in the second-level cache. If they are inconsistent, the target business data in the second-level cache is set to an invalid state, and the target business data in the local cache is deleted. In this way, through real-time business traffic discovery, version comparison of the target business data is performed in an asynchronous thread to discover cache inconsistencies, providing real-time discovery capabilities. Moreover, in the event of data inconsistency, the cached data can be recovered through self-healing capabilities. Furthermore, since real-time business traffic is used for cache comparison, real-time traffic does not collect and query the full cache data, but only queries the cached data involved in the current business, thus avoiding a full cache scan and not affecting the timeliness of business traffic cache query.
[0067] In addition, the cache comparison is performed using real-time business traffic. Therefore, database access only involves data related to the version of this business. A protective caching mechanism is also used for database access. Data will not be accessed in a concentrated manner at the same time, so as not to affect the timeliness of business traffic cache query. Furthermore, it can simplify the cache freshness solution in the context of more reads and fewer writes in the cache and reduce database access to protect the stability of the database.
[0068] The above describes the data processing apparatus provided in the embodiments of this specification. Based on the same idea, the embodiments of this specification also provide a data processing device, such as... Figure 9 As shown.
[0069] The data processing device can be a terminal device or a server, as described in the above embodiments.
[0070] Data processing devices can vary significantly in configuration and performance, and may include a communication interface 902, a user interface 904, a processor 906, and a data storage 908. These components are interconnected and communicate with each other via a system bus, network, or other connection mechanism 910. The communication interface 902 enables the data processing device 900 to communicate with other devices, access networks, and transmission networks via analog or digital modulation. For example, the communication interface 902 may include a chipset and antenna for wireless communication with a radio access network or access point. Furthermore, the communication interface 902 can be a wired interface such as Ethernet, Token Ring, or a USB port, or a wireless interface such as Wi-Fi, Bluetooth, Global Positioning System (GPS), or a wide-area wireless interface (e.g., WiMAX or LTE). Of course, the communication interface 902 may also support other forms of physical layer interfaces and standard or proprietary communication protocols. The communication interface 902 may also include multiple physical communication interfaces, such as Wi-Fi, Bluetooth, and wide-area wireless interfaces.
[0071] User interface 904 includes receiving user input and providing output to the user. Therefore, user interface 904 may include input components such as a keypad, keyboard, touch-sensitive or presence-sensitive panel, computer mouse, trackball, joystick, microphone, still camera, and video camera, and output components such as a display screen (which may be combined with a touch-sensitive panel), CRT, LCD, LED, display using DLP technology, printer, and other similar devices known or developed in the future. User interface 904 may also generate auditory output via speakers, speaker jacks, audio output ports, audio output devices, headphones, and other similar devices known or developed in the future. In some embodiments, user interface 904 may include software, circuitry, or other forms of logic capable of transmitting and receiving data from external user input / output devices. Additionally or alternatively, data processing device 900 may support remote access from other devices via communication interface 902 or another physical interface (not shown). User interface 904 may be configured to receive user input, the position and movement of which may be indicated by indicators or cursors described herein. User interface 904 may also be configured as a display device for rendering or displaying text fragments.
[0072] Processor 906 may contain one or more general-purpose processors and / or special-purpose processors.
[0073] Data storage 908 may include one or more volatile and / or non-volatile storage components and may be integrated wholly or partially with processor 906. Data storage 908 may include removable and non-removable components.
[0074] Processor 906 is capable of executing program instructions 918 (e.g., compiled or uncompiled program logic and / or machine code) stored in data storage 908 to perform the various functions described herein. Data storage 908 may contain a non-transitory computer-readable medium on which program instructions are stored, which, when executed by data processing device 900, enable data processing device 900 to perform any methods, processes, or functions disclosed in this specification and / or the accompanying drawings. Processor 906 executing program instructions 918 may result in processor 906 using data 912.
[0075] For example, program instructions 918 may include an operating system 922 (e.g., an operating system kernel, device drivers, and / or other modules) and one or more application programs 920 (e.g., a browser, social media application, or game application) installed on the data processing device 900. Similarly, data 912 may include operating system data 916 and application data 914. Operating system data 916 is primarily accessible to the operating system 922, while application data 914 is primarily accessible to one or more application programs 920. Application data 914 may reside in a file system that is visible or hidden from the user of the data processing device 900.
[0076] Application 920 can communicate with operating system 912 through one or more application programming interfaces (APIs). These APIs help application 920 read and / or write application data 914, transmit or receive information via communication interface 902, receive or display information on user interface 904, etc.
[0077] In some terminology, application 920 may be simply referred to as "app". Furthermore, application 920 can be downloaded to data processing device 900 through one or more online app stores or app markets. However, applications can also be installed on data processing device 900 in other ways, such as through a web browser or a physical interface on data processing device 900 (e.g., a USB port).
[0078] Specifically, in this embodiment, the data processing device 900 includes a data storage 908 and one or more program instructions 918, wherein one or more program instructions 918 are stored in the data storage 908, and one or more program instructions 918 are configured to be executed by one or more processors. The one or more program instructions include computer-executable instructions for performing the following: The system receives a read request for target business data; in response to the read request, it queries the target business data in the local cache; if the query for the target business data in the local cache fails, it queries the target business data by calling the second-level cache or the database; it retrieves the cached target business data from the second-level cache, stores the retrieved target business data from the second-level cache into the local cache, retrieves the target business data from the database asynchronously, and compares the target business data in the database with the target business data in the second-level cache; if they are inconsistent, it sets the target business data in the second-level cache to an invalid state and deletes the target business data from the local cache.
[0079] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the data processing device embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0080] This specification provides a data processing device that, upon receiving a read request for target business data, responds to the request by querying the target business data in a local cache. If the query for the target business data in the local cache is abnormal, it queries the target business data by calling a second-level cache or a database. Then, it retrieves the cached target business data from the second-level cache, stores the retrieved target business data from the second-level cache into the local cache, and asynchronously retrieves the target business data from the database. It compares the target business data in the database with the target business data in the second-level cache. If they are inconsistent, it sets the target business data in the second-level cache to an invalid state and deletes the target business data from the local cache. In this way, through real-time business traffic discovery, version comparison of the target business data is performed in an asynchronous thread to discover cache inconsistencies, providing real-time discovery capabilities. Moreover, it can recover cached data through self-healing capabilities in the event of data inconsistency. Furthermore, since real-time business traffic is used for cache comparison, real-time traffic does not collect and query the full cache data, but only queries the cache data involved in the current business, thus avoiding a full cache scan and not affecting the timeliness of business traffic cache query.
[0081] Furthermore, based on the above Figures 1 to 7 This specification also provides a storage medium for storing computer-executable instruction information in one or more embodiments. In one specific embodiment, the storage medium may be a USB flash drive, optical disc, hard disk, etc. When the computer-executable instruction information stored in the storage medium is executed by a processor, it can realize the following process: The system receives a read request for target business data; in response to the read request, it queries the target business data in the local cache; if the query for the target business data in the local cache fails, it queries the target business data by calling the second-level cache or the database; it retrieves the cached target business data from the second-level cache, stores the retrieved target business data from the second-level cache into the local cache, retrieves the target business data from the database asynchronously, and compares the target business data in the database with the target business data in the second-level cache; if they are inconsistent, it sets the target business data in the second-level cache to an invalid state and deletes the target business data from the local cache.
[0082] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the above-described storage medium embodiment is basically similar to the method embodiment, so the description is relatively simple; relevant parts can be referred to the description of the method embodiment.
[0083] This specification provides a storage medium that, upon receiving a read request for target business data, responds to the request by querying the target business data in a local cache. If the query for the target business data in the local cache fails, it queries the target business data by calling a second-level cache or a database. Then, it retrieves the cached target business data from the second-level cache, stores the retrieved target business data from the second-level cache into the local cache, and asynchronously retrieves the target business data from the database. It then compares the target business data in the database with the target business data in the second-level cache. If they are inconsistent, the target business data in the second-level cache is set to an invalid state, and the target business data in the local cache is deleted. In this way, through real-time business traffic discovery, version comparison of the target business data is performed in an asynchronous thread to detect cache inconsistencies, providing real-time discovery capabilities. Moreover, it can recover cached data through self-healing capabilities in the event of data inconsistency. Furthermore, since real-time business traffic is used for cache comparison, real-time traffic does not collect and query the full cache data, but only the cached data involved in the current business, thus avoiding a full cache scan and not affecting the timeliness of business traffic cache query.
[0084] Furthermore, based on the above Figures 1 to 7 This specification also provides one or more embodiments of a computer program product, including a computer program, which, when executed by a processor, can perform the following processes: The system receives a read request for target business data; in response to the read request, it queries the target business data in the local cache; if the query for the target business data in the local cache fails, it queries the target business data by calling the second-level cache or the database; it retrieves the cached target business data from the second-level cache, stores the retrieved target business data from the second-level cache into the local cache, retrieves the target business data from the database asynchronously, and compares the target business data in the database with the target business data in the second-level cache; if they are inconsistent, it sets the target business data in the second-level cache to an invalid state and deletes the target business data from the local cache.
[0085] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the above-described embodiment of a computer program product is relatively simple in description because it is fundamentally similar to the method embodiment; relevant parts can be referred to the description of the method embodiment.
[0086] This specification provides a computer program product that, upon receiving a read request for target business data, responds to the request by querying the target business data in a local cache. If the query for the target business data in the local cache is abnormal, it queries the target business data by calling a second-level cache or a database. Then, it retrieves the cached target business data from the second-level cache, stores the retrieved target business data from the second-level cache into the local cache, and asynchronously retrieves the target business data from the database. It compares the target business data in the database with the target business data in the second-level cache. If they are inconsistent, it sets the target business data in the second-level cache to an invalid state and deletes the target business data from the local cache. In this way, through real-time business traffic discovery, version comparison of the target business data is performed in an asynchronous thread to discover cache inconsistencies, providing real-time discovery capabilities. Moreover, it can recover cached data through self-healing capabilities in the event of data inconsistency. Furthermore, since real-time business traffic is used for cache comparison, real-time traffic does not collect and query the full cache data, but only the cached data involved in the current business, thus avoiding a full cache scan and not affecting the timeliness of business traffic cache query.
[0087] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims may be performed in a different order than those shown in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired results. In some embodiments, multitasking and parallel processing are possible or may be advantageous. Moreover, although one or more embodiments of this specification provide method steps as described in the embodiments or flowcharts, it is understood that the order of steps listed in the embodiments or flowcharts is merely one possible execution order among many steps and does not represent the only execution order. Therefore, when method steps are involved in the claims, adjustments to the order of those steps, or parallelism between steps, are also within the scope of protection of the claims.
[0088] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must also be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also understand that by simply performing some logic programming on the method flow using one of these hardware description languages and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.
[0089] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0090] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0091] For ease of description, the above apparatus is described by dividing it into various functional units. Of course, when implementing one or more embodiments of this specification, the functions of each unit can be implemented in one or more software and / or hardware.
[0092] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, one or more embodiments of this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0093] Embodiments in this specification are described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this specification. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable parallel device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable parallel device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0094] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable fraud device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0095] These computer program instructions can also be loaded onto a computer or other programmable device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0096] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0097] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0098] Computer-readable media include both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0099] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical or equivalent elements in the process, method, article, or apparatus that includes said element. Furthermore, "a," "an," and "the" are not specifically singular and may include plural forms. Ordinal numbers such as "first," "second," etc., do not necessarily indicate order; they are often used to distinguish objects. For example, "first server" and "second server" usually refer to two servers, described as "first server" and "second server" to differentiate them; however, sometimes these two servers may be the same server. Moreover, in this specification, unless explicitly stated otherwise, "receiving and sending data" does not necessarily mean direct receiving and sending; it can be indirect receiving and sending (i.e., receiving and sending indirectly through one or more entities). Similarly, in this specification, unless otherwise stated, the relationships between structures can be direct or indirect.
[0100] Furthermore, the specific terms used in this specification to describe embodiments, such as "an embodiment," "one embodiment," or "some embodiments," refer to a particular feature, structure, or characteristic related to at least one embodiment of this specification. Therefore, it should be emphasized and noted that "an embodiment," "one embodiment," or "an alternative embodiment" mentioned twice or more in different locations in this specification do not necessarily refer to the same embodiment. Moreover, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of those different embodiments or examples, without contradiction.
[0101] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, one or more embodiments of this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0102] One or more embodiments of this specification can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. One or more embodiments of this specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0103] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0104] The above description is merely an embodiment of this specification and is not intended to limit this document. Various modifications and variations can be made to this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims in this document.
Claims
1. A data processing method, the method comprising: Receive read requests for target business data; In response to the read request, the target business data is retrieved from the local cache; If the query for the target business data in the local cache fails, the target business data will be retrieved by calling the second-level cache or the database. The target business data is retrieved from the second-level cache, stored in the local cache, and retrieved from the database asynchronously. The target business data in the database is compared with the target business data in the second-level cache. If they are inconsistent, the target business data in the second-level cache is set to invalid and the target business data in the local cache is deleted.
2. The method according to claim 1, wherein if the two are inconsistent, setting the target business data in the secondary cache to an invalid state and deleting the target business data in the local cache includes: If the two are inconsistent, the target business data in the secondary cache is set to an invalid state, and a first cache data eviction policy is set for the target business data stored in the local cache, so as to delete the target business data in the local cache through the first cache data eviction policy.
3. The method according to claim 2, wherein the local cache is configured with a second cache data eviction policy, the first cache data eviction policy being different from the second cache data eviction policy, and the deletion of the target business data in the local cache includes: The target business data in the local cache is deleted using either the first cache data eviction policy or the second cache data eviction policy.
4. The method according to claim 3, wherein the second cached data eviction policy is an eviction policy constructed using the Least Recently Used (LRU) algorithm, and the first cached data eviction policy is an eviction policy constructed using a preset data write duration.
5. The method according to claim 1, wherein if an anomaly occurs in the query of the target business data in the local cache, the target business data is queried by invoking the second-level cache or the database, comprising: If the query for the target business data in the local cache fails, the second-level cache is invoked to query the target business data. The step of retrieving the cached target business data from the secondary cache includes: If the target business data is found in the second-level cache, then the cached target business data is retrieved from the second-level cache.
6. The method according to claim 1, wherein if an anomaly occurs in the query of the target business data in the local cache, the target business data is queried by invoking the second-level cache or the database, comprising: If the query for the target business data in the local cache fails, the second-level cache is invoked to query the target business data. If the query for the target business data in the second-level cache fails, the target business data is retrieved from the database, and the target business data stored in the database is cached in the second-level cache.
7. The method according to claim 1, further comprising: The second-level cache is invoked to delete the target business data stored in the second-level cache.
8. The method according to claim 1, wherein the target business data includes business data related to resource transfer, and the target business data includes one or more of the following: information of resource accounts and the quantity of resources to be transferred.
9. A data processing apparatus, the apparatus comprising: The request module receives read requests for target business data; The local query module, in response to the read request, queries the target business data in the local cache; If the data reading module encounters an error while querying the target business data in the local cache, it will query the target business data by calling the second-level cache or the database. The data processing module retrieves the target business data from the secondary cache, stores the retrieved target business data from the secondary cache into the local cache, retrieves the target business data from the database asynchronously, and compares the target business data in the database with the target business data in the secondary cache. If the two are inconsistent, the target business data in the secondary cache is set to an invalid state, and the target business data in the local cache is deleted.
10. A data processing apparatus, the data processing apparatus comprising: processor; as well as A memory configured to store computer-executable instructions, which, when executed, cause the processor to: Receive read requests for target business data; In response to the read request, the target business data is retrieved from the local cache; If the query for the target business data in the local cache fails, the target business data will be retrieved by calling the second-level cache or the database. The target business data is retrieved from the second-level cache, stored in the local cache, and retrieved from the database asynchronously. The target business data in the database is compared with the target business data in the second-level cache. If they are inconsistent, the target business data in the second-level cache is set to invalid and the target business data in the local cache is deleted.