Data processing method and device

By employing a multi-layered caching architecture and a dynamic data filling mechanism, the problem of high-frequency and low-frequency data competing for cache space in a single-layered caching architecture is solved, thereby improving cache hit rate and system response speed.

CN120909498APending Publication Date: 2025-11-07TONGCHENG NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510841924.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-23
Publication Date
2025-11-07

AI Technical Summary

Technical Problem

In existing single-layer caching architectures, high-frequency and low-frequency data compete for cache space, resulting in a decrease in the hit rate after cache eviction and an inability to effectively utilize cache resources.

Method used

It adopts a multi-layer caching architecture and a dynamic data filling mechanism. It prioritizes querying the first cache level of high-frequency data. If the data is not found, it queries the low-frequency data level level level by level. After a hit, it actively fills the data back into the high-frequency level level. The dynamic allocation of cache levels reduces contention and improves the hit rate.

Benefits of technology

It improves cache hit rate, avoids repeated access to inefficient cache levels, ensures data consistency and resource utilization efficiency, reduces cache space contention, and improves system response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120909498A_ABST
    Figure CN120909498A_ABST
Patent Text Reader

Abstract

The invention discloses a data processing method and device and relates to the technical field of data processing. Receiving an access request sent by a user, and analyzing the access request to obtain a cache identifier; inputting the cache identifier into the first cache hierarchy for query, if the first query result is a null value, inputting the cache identifier into the second cache hierarchy for query, if the second query result is a null value, inputting the cache identifier into the third cache hierarchy for query, and if the third query result is not a null value, inputting the cache identifier into the third cache hierarchy for query; if yes, obtaining first cache data corresponding to the cache identifier from the third query result, and writing the first cache data into the first cache hierarchy and the second cache hierarchy respectively; after it is confirmed that the first cache data is written into the first cache hierarchy, the first cache hierarchy displays the first cache data corresponding to the cache identifier to the user. By implementing the technical scheme provided by the invention, the problems that high-frequency and low-frequency data compete for a cache space in a single-layer cache architecture and the hit rate is reduced after the cache is eliminated are effectively solved.
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 particularly relates to a data processing method and device. BACKGROUND

[0002] With the continuous emergence and development of various business systems, the business systems continuously generate and process massive data in the process of continuous operation. As the core asset of the business system, data carries the key information and value of business operation. If the business data is not properly stored and backed up, once the business system is interrupted or encounters system failure, it may cause permanent loss of data and cannot be recovered through conventional means, thereby seriously affecting business continuity and data integrity.

[0003] Currently, in order to improve the response speed and processing efficiency of the business system, the cache technology is generally used to temporarily store and quickly access the business data. In the existing cache scheme, most systems still use a single-layer cache architecture, that is, the data is directly stored in the memory space of the application process. Due to the capacity limitation of the application process memory, high-frequency access data and low-frequency access data will inevitably compete for the limited cache space. When the cache space reaches the saturation state, the system will remove part of the data based on the established eviction policy, but after removal, the subsequent access request for the evicted data cannot hit in the cache, thereby reducing the hit rate of the cache data.

[0004] Therefore, there is an urgent need for a data processing method and device that can solve the above technical problems. SUMMARY

[0005] The present application provides a data processing method and device, which effectively solves the problem of competition for cache space between high-frequency and low-frequency data in the single-layer cache architecture and the problem of decreased hit rate after cache eviction by introducing multiple cache levels and a dynamic data filling mechanism.

[0006] In a first aspect, the present application provides a data processing method, which comprises: receiving an access request sent by a user, analyzing the access request to obtain a cache identifier; inputting the cache identifier into a first cache level for querying to obtain a first query result; if the first query result is empty, inputting the cache identifier into a second cache level for querying to obtain a second query result; if the second query result is empty, inputting the cache identifier into a third cache level for querying to obtain a third query result, the priority of the first cache level being higher than that of the second cache level, and the priority of the second cache level being higher than that of the third cache level; if the third query result is not empty, obtaining first cache data corresponding to the cache identifier from the third query result, and writing the first cache data into the first cache level and the second cache level respectively; and after confirming that the first cache data has been written into the first cache level, displaying the first cache data corresponding to the cache identifier to the user by the first cache level.

[0007] By adopting the above technical solution, the access request sent by the user is received, the cache identifier is determined according to the access request, and then the cache identifier is inputted into the first cache level for querying based on the cache identifier, to obtain the first query result. If the first query result is empty, the cache identifier is inputted into the second cache level for querying to obtain the second query result. If the second query result is also empty, that is, the access request does not hit in the first cache level and the second cache level, the cache identifier is inputted into the third cache level for querying to obtain the third query result. Then the first cache data is loaded from the third query result, and the first cache data is written into the first cache level and the second cache level at the same time. The active backfill mechanism avoids the chain reaction of vacancy, improves the overall hit rate, and displays the first cache data to the user through the first cache level, thereby avoiding repeated access to the third cache level. The priority of each cache level is layered, and the cache level of each cache data is dynamically allocated, thereby reducing the situation that multiple cache data compete for cache space.

[0008] Optionally, if the first query result is empty, the cache identifier is inputted into the second cache level for querying to obtain the second query result, which specifically comprises: when the first query result is empty, judging whether the second cache level is in a normal running state; when the second cache level is in the normal running state, determining to input the cache identifier into the second cache level for querying to obtain the second query result; and when the second cache level is not in the normal running state, determining to mark the second cache level as a fault state, and inputting the cache identifier into the third cache level for querying to obtain a fourth query result.

[0009] By adopting the technical solution, when it is determined that the first query result is null, the cache identifier is input into the second cache level for query, the running state of the second cache level is actively detected, if it is found that the second cache level is in a normal running state, the cache identifier is input into the second cache level for query to obtain a second query result, if it is found that the second cache level is in a fault state, the second cache level is immediately skipped, and the cache identifier is directly input into the third cache level for query to obtain a fourth query result, by marking the fault state, the fault level can be quickly identified and isolated, and request accumulation is avoided.

[0010] Optionally, before the cache identifier is input into the first cache level for query, the to-be-cached data needs to be stored, specifically including: obtaining the to-be-cached data, obtaining the first access frequency and the first data amount from the to-be-cached data, the first access frequency being a corresponding access frequency in a preset first time; determining whether the first access frequency is greater than a preset first access frequency and whether the first data amount is less than a preset data amount; when the first access frequency is greater than the preset first access frequency and the first data amount is less than the preset data amount, it is determined that the to-be-cached data is stored into the first cache level; when the first access frequency is less than or equal to the preset first access frequency and the first data amount is greater than or equal to the preset data amount, it is determined that the to-be-cached data is stored into the second cache level; obtaining a second access frequency corresponding to the to-be-cached data, the second access frequency being a total access frequency corresponding to the to-be-cached data; when the second access frequency is less than or equal to a preset second access frequency, it is determined that the to-be-cached data is stored into the third cache level.

[0011] By adopting the technical solution, the first access frequency and the first data amount corresponding to the to-be-cached data are obtained, when the first access frequency is greater than the preset first access frequency and the first data amount is less than the preset data amount, the to-be-cached data is preferentially stored in the first cache level, to ensure that high-speed access can be quickly responded; when the first access frequency is less than the preset first access frequency and the first data amount is greater than or equal to the preset data amount, the to-be-cached data is stored in the second cache level, to avoid occupying high-speed cache resources, when the second access frequency is less than the preset second access frequency, the to-be-cached data is directly stored in the third cache level, based on accurate layering, the capacity and performance advantages of each level of cache are maximized, and the overall hit rate is improved.

[0012] Optionally, after determining to store the to-be-cached data into the first cache level when the first access frequency is greater than the preset first access frequency and the first data amount is less than the preset data amount, the method further comprises: determining that the cache capacity in the first cache level is full, obtaining second cache data from the first cache level, and determining the first time corresponding to the second cache data and the first access frequency, the first access frequency being the total access frequency corresponding to the third cache data; obtaining a first interval duration, the first interval duration being the interval time between the current time and the first time; determining whether the first interval duration is greater than the preset interval duration and the first access frequency is less than the preset first access frequency; and when the first interval duration is greater than the preset interval duration and the first access frequency is less than the preset first access frequency, determining to delete the second cache data in the first cache level.

[0013] By adopting the above technical solution, when the first cache level capacity is full, the eviction strategy is triggered actively to release space to accommodate new data, avoiding performance problems caused by insufficient capacity. If the first interval duration is greater than the preset interval duration and the first access frequency is less than the preset first access frequency, the second cache data is preferentially evicted, avoiding the deletion of frequently accessed data, while the real cold data is evicted, improving the cache hit rate.

[0014] Optionally, after determining to store the to-be-cached data into the second cache level when the first access frequency is less than or equal to the preset first access frequency and the first data amount is greater than or equal to the preset data amount, the method further comprises: obtaining a second access frequency, the second access frequency being the access frequency of the second cache data within a preset second time; determining whether the second access frequency is greater than or equal to a preset second access frequency; and when the second access frequency is greater than or equal to the preset second access frequency, determining to transfer the second cache data in the first cache level to the second cache level.

[0015] By adopting the above technical solution, the second access frequency within the preset second time is obtained to dynamically identify data that suddenly becomes hot recently. When the second access frequency is greater than or equal to the preset second access frequency, the second cache data is migrated from the first cache level to the second cache level, ensuring that high-frequency data is stored in a more suitable level, and the burst hot data is migrated to the second cache level, which has higher capacity and persistence capability, avoiding the eviction of data due to insufficient capacity in the first cache level, and improving the overall hit rate.

[0016] Optionally, before determining to store the to-be-cached data to the third cache level when the second access frequency is less than or equal to the preset second access frequency, the method further comprises: obtaining third cache data from the second cache level, determining a second time corresponding to the third cache data; obtaining interval days, the interval days being days between the second time and the current time; determining whether the interval days are greater than a preset interval days; when the interval days are greater than the preset interval days, determining to transfer the third cache data in the second cache level to the third cache level.

[0017] By using the above technical solution, the interval days between the second time and the current time are calculated, the cold data that has not been accessed for a long time is identified, when the interval days are greater than the preset interval days, the third cache data is migrated from the second cache level to the third cache level, the second cache level space is released, it is ensured that the second cache level focuses on storing appropriate data, the long-term hit rate is improved, and the cold data is dynamically identified and degraded by periodically checking the access interval days of the data.

[0018] Optionally, after receiving the access request sent by the user, the method further comprises: in response to the update operation of the user at the first node, updating the first information in the second cache level and the third cache level respectively according to the update operation, the first information being the information corresponding to the update of the user; determining the second node based on the user, and sending invalidation information to the second node, the invalidation information being information that the first information has been invalidated, the first information being information corresponding to the user before the update operation is performed; determining that the second node receives the invalidation information, so that the second node finds the second information corresponding to the first information from the first cache level according to the invalidation information, and cleans up the second information, the second information being information corresponding to the user stored in the second node.

[0019] By using the above technical solution, in response to the update operation of the user at the first node, the data in the second cache level and the third cache level is immediately updated synchronously, it is ensured that all levels of data are consistent, the problem of inconsistent data is avoided, based on the update operation of the user, the associated second node is determined, and the invalidation information is sent to the second node, which informs that the old data cached by the second node has been invalidated, it is ensured that the second node cleans up the old cache data in time, the second node receives the invalidation information, finds and cleans up the corresponding second information from the first cache level, the cache space is released, and the cache hit rate is improved.

[0020] In a second aspect of the present application, a data processing device is provided, which comprises a receiving unit, a processing unit and a confirming unit. The receiving unit receives an access request sent by a user, analyzes the access request and obtains a cache identifier. The processing unit inputs the cache identifier into a first cache level for query and obtains a first query result. If the first query result is null, the processing unit inputs the cache identifier into a second cache level for query and obtains a second query result. If the second query result is null, the processing unit inputs the cache identifier into a third cache level for query and obtains a third query result. The priority of the first cache level is higher than that of the second cache level, and the priority of the second cache level is higher than that of the third cache level. If the third query result is not null, the processing unit obtains first cache data corresponding to the cache identifier from the third query result and writes the first cache data into the first cache level and the second cache level respectively. The confirming unit confirms that the first cache data has been written into the first cache level, so that the first cache level displays the first cache data corresponding to the cache identifier to the user.

[0021] Optionally, the processing unit is configured to determine whether the second cache level is in a normal operation state when the first query result is null. When the second cache level is in the normal operation state, the processing unit determines to input the cache identifier into the second cache level for query and obtains the second query result. When the second cache level is not in the normal operation state, the processing unit determines to mark the second cache level as a fault state and input the cache identifier into the third cache level for query and obtains a fourth query result.

[0022] Optionally, the receiving unit is configured to obtain to-be-cached data, and obtain a first access frequency and a first data amount from the to-be-cached data. The first access frequency is a corresponding access frequency within a preset first time. The processing unit is configured to determine whether the first access frequency is greater than a preset first access frequency and whether the first data amount is less than a preset data amount. When the first access frequency is greater than the preset first access frequency and the first data amount is less than the preset data amount, the processing unit determines to store the to-be-cached data into the first cache level. When the first access frequency is less than or equal to the preset first access frequency and the first data amount is greater than or equal to the preset data amount, the processing unit determines to store the to-be-cached data into the second cache level. The receiving unit is configured to obtain a second access frequency corresponding to the to-be-cached data. The second access frequency is a total access frequency corresponding to the to-be-cached data. When the second access frequency is less than or equal to a preset second access frequency, the processing unit determines to store the to-be-cached data into the third cache level.

[0023] Optionally, the receiving unit is configured to determine that the cache capacity in the first cache level is full, acquire second cache data from the first cache level, and determine a first time corresponding to the second cache data and a first access number corresponding to the third cache data, the first access number being a total access number corresponding to the third cache data; acquire a first interval duration, the first interval duration being an interval between the current time and the first time; the processing unit is configured to determine whether the first interval duration is greater than a preset interval duration and the first access number is less than a preset first access number; and the confirming unit is configured to determine to delete the second cache data in the first cache level when the first interval duration is greater than the preset interval duration and the first access number is less than the preset first access number.

[0024] Optionally, the receiving unit is configured to acquire a second access number, the second access number being an access number corresponding to the second cache data within a preset second time; the processing unit is configured to determine whether the second access number is greater than or equal to a preset second access number; and the confirming unit is configured to determine to transfer the second cache data in the first cache level to the second cache level when the second access number is greater than or equal to the preset second access number.

[0025] Optionally, the receiving unit is configured to acquire third cache data from the second cache level and determine a second time corresponding to the third cache data; acquire an interval day number, the interval day number being a number of days between the second time and the current time; the processing unit is configured to determine whether the interval day number is greater than a preset interval day number; and the confirming unit is configured to determine to transfer the third cache data in the second cache level to the third cache level when the interval day number is greater than the preset interval day number.

[0026] Optionally, the receiving unit is configured to respond to an update operation of a user at a first node, update first information in the second cache level and the third cache level according to the update operation, the first information being information corresponding to the update of the user; the processing unit is configured to determine a second node based on the user, send invalidation information to the second node, the invalidation information being information that the first information is invalid, the first information being information corresponding to the user before the update operation is performed; and the confirming unit is configured to determine that the second node receives the invalidation information, so that the second node finds second information corresponding to the first information from the first cache level according to the invalidation information, and cleans up the second information, the second information being information corresponding to the user stored in the second node.

[0027] In a third aspect, an electronic device is provided, which includes a processor, a memory, a user interface, and a network interface. The memory is configured to store instructions, the user interface and the network interface are configured to communicate with other devices, and the processor is configured to execute the instructions stored in the memory, so that the electronic device performs the method of any one of the above aspects.

[0028] In a fourth aspect, the present application provides a computer-readable storage medium storing instructions that, when executed, perform any of the methods described above.

[0029] In summary, the one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. The method comprises receiving an access request sent by a user, determining a cache identifier based on the access request, and querying a first cache level based on the cache identifier to obtain a first query result. If the first query result is empty, the cache identifier is input into a second cache level for querying to obtain a second query result. If the second query result is also empty, i.e., the access request does not hit in the first cache level and the second cache level, the cache identifier is input into a third cache level for querying to obtain a third query result. First cache data is loaded from the third query result, and the first cache data is written into the first cache level and the second cache level at the same time. An active backfill mechanism avoids a chain reaction of vacancies and improves the overall hit rate. The first cache data is displayed to the user through the first cache level, avoiding repeated access to the third cache level. The cache levels are prioritized, and the cache levels of each cache data are dynamically allocated, reducing the situation of multiple cache data competing for cache space.

[0030] 2. In response to an update operation of the user at the first node, the data in the second cache level and the third cache level is immediately synchronized and updated to ensure consistency of all levels of data and avoid data inconsistency. Based on the user update operation, an associated second node is determined, and invalidation information is sent to the second node to notify that the old cache data has been invalidated. The second node is ensured to clean up the old cache data in time. After receiving the invalidation information, the second node searches and cleans up the corresponding second information from the first cache level to release the cache space and improve the cache hit rate. BRIEF DESCRIPTION OF DRAWINGS

[0031] Figure 1 is a flowchart of a data processing method provided by an embodiment of the present application; Figure 2 is a structural diagram of a data processing device provided by an embodiment of the present application; Figure 3 is a structural diagram of an electronic device disclosed by an embodiment of the present application.

[0032] Legend of reference signs: 201, receiving unit; 202, processing unit; 203, confirmation unit; 300, electronic device; 301, processor; 302, memory; 303, user interface; 304, network interface; 305, communication bus. DETAILED DESCRIPTION

[0033] In order for those skilled in the art to better understand the technical solutions in the specification, the technical solutions in the specification will be clearly and completely described below in combination with the accompanying drawings in the embodiments of the specification. Obviously, the described embodiments are only some of the embodiments of the present application, not all the embodiments.

[0034] In the description of the embodiments of the present application, the words such as "for example" or "for instance" are used to represent an example, illustration or description. Any embodiment or design scheme described as "for example" or "for instance" in the embodiments of the present application should not be interpreted as more preferred or more advantageous than other embodiments or design schemes. Rather, the words such as "for example" or "for instance" are intended to present the relevant concept in a specific manner.

[0035] In the description of the embodiments of the present application, the term "a plurality of" means two or more. For example, a plurality of systems means two or more systems, and a plurality of screen terminals means two or more screen terminals. In addition, the terms "first" and "second" are used only for the purpose of description, and should not be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Therefore, the features defined with "first" and "second" can explicitly or implicitly include one or more of the features. The terms "include", "contain", "have" and their variants mean "include but are not limited to", unless otherwise specifically emphasized.

[0036] Therefore, how to solve the problem of high-frequency and low-frequency data competing for cache space in a single-layer cache architecture and the problem of the hit rate decreasing after cache eviction. The data processing method provided by the embodiments of the present application is applied to a server. The server of the present application can be a platform providing cache services for business system data, Figure 1 is a flowchart of a data processing method provided by the embodiments of the present application, with reference to Figure 1 The method comprises the following steps S101-S106.

[0037] S101: receiving an access request sent by a user, analyzing the access request, and obtaining a cache identifier.

[0038] In the above S101, before receiving the access request sent by the user, the server needs to ensure that the data has been cached. In this embodiment, a dynamic hierarchy is used to select a suitable cache hierarchy for the data, and then the correspondence between each data and the identifier is constructed, so as to subsequently find the data corresponding to the identifier in the cache hierarchy.

[0039] Further, after the data to be cached is online, the access characteristics of the data to be cached are analyzed, and the most suitable cache level for the data is automatically selected, specifically including: obtaining the data to be cached, obtaining a first access frequency and a first data volume from the data to be cached, the first access frequency being a corresponding access frequency within a preset first time; determining whether the first access frequency is greater than a preset first access frequency and whether the first data volume is less than a preset data volume; when the first access frequency is greater than the preset first access frequency and the first data volume is less than the preset data volume, it is determined that the data to be cached is stored in the first cache level; when the first access frequency is less than or equal to the preset first access frequency and the first data volume is greater than or equal to the preset data volume, it is determined that the data to be cached is stored in the second cache level; obtaining a second access frequency corresponding to the data to be cached, the second access frequency being a total access frequency corresponding to the data to be cached; when the second access frequency is less than or equal to a preset second access frequency, it is determined that the data to be cached is stored in the third cache level.

[0040] Specifically, the to-be-cached data is selected, and the access information of the to-be-cached data is collected through a business log, the access information including a frequency of the to-be-cached data being accessed by a user and a size of the data, a first access frequency and a first data size being extracted from the access information, the first access frequency being a number of times that the to-be-cached data is accessed within a preset first time, the preset first time being set to 20 minutes, and the first data size being a size of the to-be-cached data, i.e., a number of bytes of a string. For example, the to-be-cached data is user A, the preset first time is set to 5 minutes, the access frequency of user A within 5 minutes is obtained, and if user A is accessed 12 times within 5 minutes, the first access frequency is 12 times / 5 minutes, and the size of the string corresponding to user A is 256 bytes, and the first data size is 256 bytes. The obtained first access frequency is compared with a preset first access frequency, and the first data size is compared with a preset data size, the preset first access frequency being set according to business experience and used to determine whether the to-be-cached data is high-frequency access data or low-frequency access data, and the preset data size being set according to a cache storage capacity and used to determine whether the to-be-cached data is large data or small data. When the first access frequency is greater than the preset first access frequency and the first data size is less than the preset data size, it is indicated that the to-be-cached data is high-frequency small data, and the high-frequency small data is stored in a first cache level, the first cache level being a local memory. In the above example, if the preset first access frequency is set to 10 times / 5 minutes and the preset data size is set to 512 bytes, when the first access frequency is greater than the preset first access frequency and the first data size is less than the preset data size, it is determined that user A is stored in the first cache level, i.e., information of user A is preferentially stored in the local memory. When the first access frequency is less than or equal to the preset first access frequency and the first data size is greater than or equal to the preset data size, it is indicated that the to-be-cached data is low-frequency large data, and the low-frequency large data is stored in a second cache level, the second cache level being a distributed storage such as a Redis database. For example, if the first access frequency is 9 times / 5 minutes and the first data size is 614 bytes, since the first access frequency is less than the preset first access frequency and the first data size is greater than the preset data size, information of user A is stored in the second cache level.

[0041] Furthermore, the total number of accesses to the data to be cached since its launch is counted, i.e., the second access frequency. This second access frequency is then compared with a preset second access frequency, which is set based on business costs, to determine whether the data is cold data. If the second access frequency is less than or equal to the preset second access frequency, it indicates that the data to be cached is cold data, and the data to be cached can be stored in the third cache level. In this case, the third cache level refers to the database. Storing cold data in the database is to avoid resource waste. If the second access frequency is greater than the preset second access frequency, it indicates that the data to be cached is not cold data. The same comparison method can be used to determine whether the data to be cached is stored in the first or second cache level. After storing the data to be cached in the above manner, each piece of data to be cached needs to be assigned a cache identifier so that the corresponding cached data can be found later using the cache identifier. For example, if the preset second access frequency is 7 times, and the second access frequency is 3 times, it indicates that the data is cold data, i.e., it is rarely accessed, so the data is stored in the database (third cache level). The above method enables intelligent caching and tiered storage based on access frequency and data volume, optimizing resource utilization while ensuring performance.

[0042] Next, the system receives access requests from users (individuals who require access). These requests are parsed to extract key information, including parameters, request names, and the overall name of the request. A unique cache identifier is then generated based on this information. For example, a GET request for / user / 123 would yield a cache identifier of user:123. This cache identifier typically consists of the business type and an ID. The cache identifier is then formatted to ensure consistency.

[0043] S102: Input the cache identifier into the first cache level for querying and obtain the first query result.

[0044] In step S102 above, after obtaining the cache identifier, each data has been pre-stored in its corresponding first, second, and third cache levels. First, the cache identifier is input into the first cache level for querying, as the first cache level corresponds to local memory. The cache identifier can be used as a key to call the cache interface. The key is then input into the cache interface for querying, yielding the first query result. This first query result indicates whether the cached data corresponding to the cache identifier exists in the first cache level. This result can indicate that the data does not exist (i.e., null) or it can indicate that the data exists (i.e., cached data).

[0045] S103: If the first query result is empty, the cache identifier is entered into the second cache level for querying to obtain the second query result.

[0046] In the above S103, if the first query result is null, it indicates that the cache data corresponding to the cache identifier is not stored in the first cache level, so the cache identifier needs to be input into the second cache level for query. However, before inputting into the second cache level for query, the second cache level needs to be detected for failure. If it is detected that the second cache level has failure, the second cache level is directly skipped, and the cache identifier is directly input into the third cache level for query. If it is not detected that the second cache level has failure, the cache identifier continues to be input into the second cache level for query.

[0047] If the first query result is null, the cache identifier is input into the second cache level for query to obtain a second query result, which specifically includes: when the first query result is null, it is determined whether the second cache level is in a normal operation state; when the second cache level is in the normal operation state, it is determined that the cache identifier is input into the second cache level for query to obtain the second query result; when the second cache level is not in the normal operation state, it is determined that the second cache level is marked as a failure state, and the cache identifier is input into the third cache level for query to obtain a fourth query result. Specifically, when it is determined that the first query result is null, a command request or a lightweight operation is sent to the second cache level, and feedback information of the second cache level is received. If the feedback information is received, it is considered that the second cache level is in the normal operation state if a health check is successful from the feedback information. If the feedback information is not received for a long time, it is considered that the second cache level is in the failure state due to connection exception, command execution failure, health check failure, etc. The state of the second cache level is updated in real time according to a timing task. For example, a PING command is sent to the second cache level (Redis), and PONG is returned, so the Redis is marked as the normal state. When the second cache level is in the normal operation state, an interface of the second cache level is called to query the second query result corresponding to the cache identifier. The state of the second cache level is updated to the failure state, and the failure time and reason are recorded. The second cache level can be directly skipped for query, and an interface of the third cache level is called to query the fourth query result corresponding to the cache identifier. Through the health check and failure degradation, it is ensured that the second cache level can still normally serve when it is in failure, the failure cache level is marked, repeated invalid query is avoided, the third cache level is queried, and data accuracy is ensured. Subsequently, the second cache level is repaired based on the marking of the failure state. When it is determined that the second cache level is in the normal operation state, the access request can continue to be processed according to the original process, that is, when the first cache level is not hit, the cache identifier can be input into the second cache level for query.

[0048] S104: If the second query result is null, input the cache identifier into the third cache level for query to obtain a third query result, the priority of the first cache level is greater than the priority of the second cache level, and the priority of the second cache level is greater than the priority of the third cache level.

[0049] In the above S104, after obtaining the second query result, if the second query result is not null, the cache data is obtained from the first query result, and the cache data is filled into the first cache level, so that the first cache level shows the cache data to the user. The cache data found from the second cache level is filled into the first cache level, which is for the convenience of subsequent request acceleration. If the second query result is null, it indicates that the cache data corresponding to the cache identifier is not stored in the second cache level, so the cache identifier needs to be input into the third cache level for query to obtain the third query result.

[0050] In the embodiment, the priority of the first cache level is greater than the priority of the second cache level, and the priority of the second cache level is greater than the priority of the third cache level, that is, after obtaining the cache identifier, the cache identifier is input into the first cache level first. If the corresponding cache data is not queried in the first cache level, the cache identifier is input into the second cache level. If the corresponding cache data is queried in the second cache level, the cache data is input and filled into the first cache level, so that the first cache level shows the cache data to the user. If the corresponding cache data is not queried in the second cache level, the cache identifier is input into the third cache level. If the corresponding cache data is queried in the third cache level, the cache data is sequentially filled into the first cache level and the second cache level.

[0051] S105: If the third query result is not null, the first cache data corresponding to the cache identifier is obtained from the third query result, and the first cache data is written into the first cache level and the second cache level respectively.

[0052] In the above S105, after obtaining the third query result, the first cache data corresponding to the cache identifier is obtained from the third query result, and the first cache data obtained from the third cache level is written into the first cache level and the second cache level. It can adapt to distributed backfill operation and avoid data inconsistency caused by multi-thread backfill at the same time.

[0053] S106: After confirming that the first cache data has been written into the first cache level, the first cache data corresponding to the cache identifier is shown to the user by the first cache level.

[0054] In S106, after confirming that the first cache data has been written into the first cache level, the first cache data in the first cache level is returned to the user. Since the query speed in the first cache level is extremely fast (nanosecond level), low-latency response is ensured. The first cache data is simultaneously backfilled into the first cache level and the second cache level, so that the corresponding first cache data can be directly output from the first cache level after subsequent same access requests.

[0055] In a possible implementation, the data stored in the first cache level is checked in real time, and the data in the first cache level is eliminated based on the access frequency and the interval length, so as to release the cache space while ensuring the cache hit rate. Specifically, it is determined that the cache capacity in the first cache level is full, the second cache data is obtained from the first cache level, and the first time corresponding to the second cache data and the first access number are determined. The first access number is the total access number corresponding to the third cache data. The first interval length is obtained, which is the interval time between the current time and the first time. It is determined whether the first interval length is greater than the preset interval length and the first access number is less than the preset first access number. When the first interval length is greater than the preset interval length and the first access number is less than the preset first access number, it is determined that the second cache data in the first cache level is deleted.

[0056] Specifically, the current usage capacity and the total capacity of the first cache level (local memory) are monitored in real time. If the current usage capacity is greater than or equal to a preset threshold of the total capacity, it is considered that the cache capacity is full. At this time, the cache capacity being full does not mean that the current usage capacity is equal to the total capacity, but a preset threshold of the total capacity is set to indicate that the current usage capacity has exceeded the preset threshold of the total capacity, confirming that the first cache level is in the cache capacity full state, and triggering the eviction strategy according to the cache capacity full state. For example, the total capacity of the first cache level is 2G, the current usage capacity is 1.80G, and the preset threshold is set to 85%. At this time, the current usage capacity accounts for 90% of the total capacity usage rate, and the usage rate is greater than the preset threshold. By default, the first cache level is in the cache capacity full state. The second cache data stored in the first cache level can be obtained at this time. The second cache data refers to any data stored in the first cache level. The first time corresponding to the second cache data and the first access number are obtained. The first time refers to the time of the last access to the second cache data, and the first access number refers to the total cumulative access number of the second cache data. The current time is obtained, and the first interval duration is calculated according to the current time and the first time. The first interval duration is equal to the current time minus the first time, and the unit of the first interval duration can be minutes. For example, the current time is August 29, 2024, 13:00, the first time is August 29, 2024, 12:48, and the first interval duration is 12 minutes. The first interval duration is compared with the preset interval duration, and the first access number is compared with the preset first access number. The preset interval duration can be set according to the business requirements to set the expiration duration, and the preset interval duration can be set to 10 minutes. The preset first access number is set according to the access frequency, which can be set to 20 times. When the first interval duration is greater than the preset interval duration, and the first access number is less than the preset first access number, the second cache data is a low-frequency and invalid data at this time, so it is determined that the second cache data is deleted from the first cache level. When the first interval duration is less than or equal to the preset interval duration, and the first access number is greater than or equal to the preset first access number, the second cache data does not meet the eviction strategy at this time, so the second cache data is continued to be stored in the first cache level. By evicting low-frequency and long-inactive data, the cache space is released, and the hit rate of high-frequency data is improved.

[0057] In addition, in addition to cleaning up the cache data in the first cache level according to the elimination strategy, the access times of each cache data in a certain period can be obtained, and the cache data can be transferred to the second cache level for storage according to the access times, and the transfer strategy is dynamically determined based on the access times, which optimizes the use of resources while ensuring performance. Specifically, the second access times are obtained, which are the access times of the second cache data in a preset second time; it is determined whether the second access times are greater than or equal to the preset second access times; when the second access times are greater than or equal to the preset second access times, it is determined that the second cache data in the first cache level is transferred to the second cache level. Specifically, the preset second time can be defined, which can be set to 1 hour, and the access times of the second cache data in the preset second time, i.e. the second access times, are counted from the monitoring system, and then the second access times are compared with the preset second access times, which are set according to business requirements or historical data analysis. When the second access times are greater than or equal to the preset second access times, the second cache data can be transferred from the first cache level to the second cache level. For example, the second access times of the second cache data F are 5 times / hour, and the preset second access times are set to 4 times / hour, the second access times are greater than the preset second access times, and it is determined that the second cache data F is transferred to the second cache level for storage. The preset second access times can be set based on business planning, which is only an example and is not limited.

[0058] In a possible implementation, the data in the second cache level is checked in real time, the data can be cleaned based on the eviction policy, and the data that has not been accessed for a long time can be transferred to the third cache level, thereby reducing the storage cost. Specifically, the third cache data in the second cache level is obtained, the second time corresponding to the third cache data is determined, the interval days are obtained, the interval days are the days between the second time and the current time, it is determined whether the interval days are greater than the preset interval days, and when the interval days are greater than the preset interval days, it is determined that the third cache data in the second cache level is transferred to the third cache level. Specifically, the third cache data in the second cache level is obtained, the third cache data is any data in the second cache level, the second time corresponding to the third cache data is obtained, the current time is obtained, and the interval days are calculated according to the current time and the second time. The interval days refer to the day difference between the current time and the second time. For example, the current time is August 30, 2024, the second time is August 1, 2024, and the interval days are 29 days. Then, the interval days are compared with the preset interval days, and the preset interval days can be set according to business requirements, for example, 30 days. When the interval days are greater than the preset interval days, it is determined that the third cache data is transferred from the second cache level to the third cache level. When the interval days are less than or equal to the preset interval days, the third cache data continues to be stored in the second cache level. The low-frequency data in the second cache level can also be cleaned according to the above-described eviction policy of the first cache level, which is not described in detail here. According to the above-described checking method of the first cache level and the second cache level, the data in the third cache level is continuously identified. If the access frequency is high, the cache data is filled into the second cache level for storage. It can be understood that the storage position of each cache data is not fixed and is dynamically adjusted based on the access frequency and the interval length.

[0059] In addition, the second interval length corresponding to the third cache data in the second cache level and the third access times can also be obtained. The second interval length is the length of time between the last access time and the current time. When the second interval length is less than or greater than the preset second interval length, and the third access times are greater than the preset third access times, the third cache data is determined to be high-frequency data, and the third cache data is transferred from the second cache level to the first cache level.

[0060] In a possible implementation, when a user performs an update or deletion operation on information stored in a first cache level, the operation is event broadcasted, so that all nodes can timely perceive the cache change through the event broadcast, avoiding data inconsistency and dirty read problems, and without the need for full synchronization each time, greatly reducing cache overhead. Specifically, in response to a user update operation on a first node, the first information in a second cache level and a third cache level is updated according to the update operation, the first information being information corresponding to the user after the update; based on the user, a second node is determined, and invalidation information is sent to the second node, the invalidation information being information that the first information has become invalid, the first information being information corresponding to the user before the update operation is performed; and after it is determined that the second node receives the invalidation information, the second node is caused to find second information corresponding to the first information from the first cache level according to the invalidation information, and to clean up the second information, the second information being information corresponding to the user stored in the second node.

[0061] Specifically, it is determined that a user performs an update operation on a first node, the first node corresponding to a first cache level, the update operation including modification of a user ID, a field, and a value, and the first cache level storing the latest information of the user after the update operation. Information corresponding to the user is found in a second cache level and a third cache level, and the information of the user is updated according to the update operation, so that the latest information of the user is stored in the second cache level and the third cache level. Because the third cache level stores long-term archival data, the information of the user in the third cache level needs to be updated. Then, based on the user, a second node is determined, the second node referring to other nodes sharing the same second cache level as the first node, a second node list is obtained, and invalidation information is pushed to the second node through a message queue or a channel broadcast, the second node listens to the invalidation information, finds user data stored in the first cache level in the second node according to the invalidation information, finds corresponding second data from the first cache level according to the ID of the user, and cleans up the second data in the first cache level. It can also be understood that after the user performs an update operation or a deletion operation on a node, the information corresponding to the user in the second cache level and the third cache level is updated according to the update operation or the deletion operation. Then, other nodes related to the node are investigated, historical information related to the user is found from the other nodes, and the historical information is cleaned up. Because the historical information of the user has changed, the historical information of the user needs to be cleaned up to avoid output of data of the user before the update when subsequent queries are performed.

[0062] For example, assuming that there are 3 application server nodes D, E and F, each of which has a local cache (first cache level) and shares a Redis (second cache level), and user A updates user information on node D, the node D is denoted as a first node, and the updated user information is denoted as information obtained after the update operation, that is, the first cache level corresponding to the first node caches the user information after the user is updated. The first information is updated in the Redis (second cache level) and the database (third cache level) according to the update operation of user A on node D, and the first information refers to the historical information of user A, which is updated according to the update operation. Since the nodes E and F share a Redis (second cache level) with the node D, it is necessary to query the local cache (first cache level) corresponding to each of the nodes E and F to check whether the historical data of user A exists in the local cache (first cache level) corresponding to each of the nodes E and F. The historical data refers to the user data of user A before the update operation. If the historical data exists, the historical data is cleaned, and the historical data is denoted as second data. Before the cleaning, the node D sends a message of "cache invalidation of user A" to a specific channel (such as "cache-evict") through the Pub / Sub (publish / subscribe) mechanism of Redis. The nodes E and F subscribe to the channel, and after receiving the message, clean the user data in the local cache (first cache level) corresponding to each of the nodes E and F. Subsequently, when the user data of user A is accessed through the nodes E and F, the latest data can be queried from the Redis (second cache level) and the database (third cache level).

[0063] In addition, when the cache data is stored in the first cache level and the second cache level, an expiration duration can be randomly set for each cache data, that is, the expiration duration of each cache data is different, and can be set to 20 seconds, 1 minute, 40 seconds, etc. Once the cache data is not accessed within the expiration duration, the cache data is automatically cleaned. The expiration duration is set to avoid the invalidation of a plurality of cache data at the same time, which causes a large number of requests to query the third cache level directly, thereby causing the business system to be unavailable.

[0064] The application also provides a data processing apparatus, Figure 2 is a structural schematic diagram of a data processing apparatus provided by the application, referring to Figure 2 The apparatus comprises a receiving unit 201, a processing unit 202 and a confirming unit 203.

[0065] The receiving unit 201 receives an access request sent by a user, analyzes the access request, and obtains a cache identifier.

[0066] The processing unit 202 inputs the cache identifier into the first cache level for query to obtain a first query result; if the first query result is empty, inputs the cache identifier into the second cache level for query to obtain a second query result; if the second query result is empty, inputs the cache identifier into the third cache level for query to obtain a third query result; the priority of the first cache level is higher than that of the second cache level, and the priority of the second cache level is higher than that of the third cache level; if the third query result is not empty, obtains the first cache data corresponding to the cache identifier from the third query result, and writes the first cache data into the first cache level and the second cache level respectively.

[0067] The confirming unit 203 confirms that the first cache data has been written into the first cache level, so that the first cache level displays the first cache data corresponding to the cache identifier to the user.

[0068] In a possible implementation, the processing unit 202 is configured to determine whether the second cache level is in a normal operation state when the first query result is empty; when the second cache level is in the normal operation state, determine to input the cache identifier into the second cache level for query to obtain the second query result; when the second cache level is not in the normal operation state, determine to mark the second cache level as a fault state, and input the cache identifier into the third cache level for query to obtain a fourth query result.

[0069] In a possible implementation, the receiving unit 201 is configured to obtain the to-be-cached data, and obtain a first access frequency and a first data amount from the to-be-cached data, the first access frequency being a corresponding access frequency in a preset first time; the processing unit 202 is configured to determine whether the first access frequency is greater than a preset first access frequency, and whether the first data amount is less than a preset data amount; when the first access frequency is greater than the preset first access frequency, and the first data amount is less than the preset data amount, determine to store the to-be-cached data into the first cache level; when the first access frequency is less than or equal to the preset first access frequency, and the first data amount is greater than or equal to the preset data amount, determine to store the to-be-cached data into the second cache level; the receiving unit 201 is configured to obtain a second access frequency corresponding to the to-be-cached data, the second access frequency being a total access frequency corresponding to the to-be-cached data; when the second access frequency is less than or equal to a preset second access frequency, determine to store the to-be-cached data into the third cache level.

[0070] In a possible implementation, the receiving unit 201 is configured to determine that the cache capacity in the first cache level is full, obtain second cache data from the first cache level, and determine a first time corresponding to the second cache data and a first access number, the first access number being a total access number corresponding to the third cache data; obtain a first interval duration, the first interval duration being an interval between the current time and the first time; the processing unit 202 is configured to determine whether the first interval duration is greater than a preset interval duration and the first access number is less than a preset first access number; and the confirming unit 203 is configured to determine to delete the second cache data in the first cache level when the first interval duration is greater than the preset interval duration and the first access number is less than the preset first access number.

[0071] In a possible implementation, the receiving unit 201 is configured to obtain a second access number, the second access number being an access number corresponding to the second cache data in a preset second time; the processing unit 202 is configured to determine whether the second access number is greater than or equal to a preset second access number; and the confirming unit 203 is configured to determine to transfer the second cache data in the first cache level to the second cache level when the second access number is greater than or equal to the preset second access number.

[0072] In a possible implementation, the receiving unit 201 is configured to obtain third cache data from the second cache level and determine a second time corresponding to the third cache data; obtain an interval day number, the interval day number being a number of days between the second time and the current time; the processing unit 202 is configured to determine whether the interval day number is greater than a preset interval day number; and the confirming unit 203 is configured to determine to transfer the third cache data in the second cache level to the third cache level when the interval day number is greater than the preset interval day number.

[0073] In a possible implementation, the receiving unit 201 is configured to respond to an update operation of a user on the first node, and update first information in the second cache level and the third cache level respectively according to the update operation, the first information being information corresponding to the update of the user; the processing unit 202 is configured to determine a second node based on the user, and send invalidation information to the second node, the invalidation information being information that the first information is invalid, the first information being information corresponding to the user before the update operation is performed; and the confirming unit 203 is configured to determine that the second node receives the invalidation information, so that the second node finds second information corresponding to the first information from the first cache level according to the invalidation information, and cleans up the second information, the second information being information corresponding to the user and stored in the second node.

[0074] It should be noted that the apparatus provided by the above examples is only used as an example for the division of the above functional modules when realizing its functions. In actual application, the above functions can be completed by different functional modules according to the needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the above described functions. In addition, the apparatus and method embodiments provided by the above examples belong to the same concept, and the specific implementation process is detailed in the method embodiments, which will not be described here.

[0075] The present application also discloses an electronic device. Referring to Figure 3 , Figure 3 A structural schematic diagram of an electronic device is provided for the embodiments of the present application. The electronic device 300 can include at least one processor 301, at least one network interface 304, a user interface 303, a memory 302, and at least one communication bus 305.

[0076] The communication bus 305 is used to realize the connection and communication between the components.

[0077] The user interface 303 can include a display screen (Display) and a camera (Camera). Optionally, the user interface 303 can also include a standard wired interface and a wireless interface.

[0078] The network interface 304 can optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).

[0079] The processor 301 can include one or more processing cores. The processor 301 connects various parts within the server through various interfaces and lines, performs various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 302, and calling data stored in the memory 302. Alternatively, the processor 301 can be implemented in at least one of a hardware form of a digital signal processing (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 301 can integrate a combination of one or more of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes operating systems, user interfaces, and application requests; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; and the modem is used for processing wireless communication. It can be understood that the above-mentioned modem can also not be integrated into the processor 301, but can be realized by a separate chip.

[0080] The memory 302 can include a random access memory (RAM) and a read-only memory (ROM). Alternatively, the memory 302 includes a non-transitory computer-readable storage medium. The memory 302 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 302 can include a program storage area and a data storage area. The program storage area can store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The data storage area can store data related to the above-mentioned various method embodiments, etc. The memory 302 can alternatively be at least one storage device located away from the aforementioned processor 301.

[0081] As shown in Figure 3 The memory 302 as a computer storage medium can include an operating system, a network communication module, a user interface module, and an application program for data processing.

[0082] In Figure 3In the electronic device 300 shown, the user interface 303 is mainly used to provide an interface for the user to input, and obtain data input by the user; and the processor 301 can be used to invoke an application program stored in the memory 302 for data processing, and when executed by one or more processors, enable the electronic device to perform the method described in one or more of the above embodiments.

[0083] It should be noted that, for the foregoing method embodiments, in order to simply describe, they are all described as a combination of a series of actions, but those skilled in the art should know that the present application is not limited to the order of the actions described, because according to the present application, certain steps can be performed in other order or at the same time. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0084] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.

[0085] In several embodiments provided by the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic. The division of the units is only a logical function division. There can be another division manner in actual implementation, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between different parts can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical or other forms.

[0086] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.

[0087] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware, or in the form of software functional unit.

[0088] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable memory. Based on such understanding, the technical solutions of the present application essentially or say the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a memory and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in various embodiments of the present application. The aforementioned memory includes: a U disk, a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.

[0089] The above is only exemplary embodiments of the present disclosure, and cannot limit the scope of the present disclosure. That is, any equivalent changes and modifications made in accordance with the teachings of the present disclosure are still within the scope of the present disclosure. Other embodiments of the present disclosure will be readily apparent to those skilled in the art upon considering the specification and practicing the true principles of the disclosure. The present application is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or conventional techniques in the art that are not described in the present disclosure.

Claims

1. A data processing method, characterized by, The method comprises: receiving an access request sent by a user, analyzing the access request to obtain a cache identifier; inputting the cache identifier into a first cache level for querying to obtain a first query result; if the first query result is null, inputting the cache identifier into a second cache level for querying to obtain a second query result; if the second query result is null, inputting the cache identifier into a third cache level for querying to obtain a third query result, the priority of the first cache level being higher than the priority of the second cache level, and the priority of the second cache level being higher than the priority of the third cache level; if the third query result is not null, obtaining first cache data corresponding to the cache identifier from the third query result, and writing the first cache data into the first cache level and the second cache level respectively; after confirming that the first cache data has been written into the first cache level, the first cache data corresponding to the cache identifier is displayed to the user by the first cache level.

2. The method of claim 1, wherein, if the first query result is null, inputting the cache identifier into a second cache level for querying to obtain a second query result, specifically comprising: when the first query result is the null value, judging whether the second cache level is in a normal operating state; when the second cache level is in the normal operating state, determining to input the cache identifier into the second cache level for querying to obtain the second query result; when the second cache level is not in the normal operating state, determining to mark the second cache level as a fault state, and inputting the cache identifier into the third cache level for querying to obtain a fourth query result.

3. The method of claim 1, wherein, before inputting the cache identifier into the first cache level for querying, the to-be-cached data needs to be stored, specifically comprising: obtaining the to-be-cached data, obtaining a first access frequency and a first data amount from the to-be-cached data, the first access frequency being a corresponding access frequency within a preset first time; judging whether the first access frequency is greater than a preset first access frequency, and whether the first data amount is less than a preset data amount; when the first access frequency is greater than the preset first access frequency, and the first data amount is less than the preset data amount, determining to store the to-be-cached data into the first cache level; when the first access frequency is less than or equal to the preset first access frequency, and the first data amount is greater than or equal to the preset data amount, determining to store the to-be-cached data into the second cache level; obtaining a second access frequency corresponding to the to-be-cached data, the second access frequency being a total access frequency corresponding to the to-be-cached data; when the second access frequency is less than or equal to a preset second access frequency, determining to store the to-be-cached data into the third cache level.

4. The method of claim 3, wherein, After it is determined that the first access frequency is greater than the preset first access frequency and the first data amount is less than the preset data amount, the method further includes: determining that the first cache level is full, obtaining second cache data from the first cache level, and determining a first time corresponding to the second cache data and a first access number corresponding to the second cache data, the first access number being a total access number corresponding to the third cache data; obtaining a first interval duration, the first interval duration being an interval time between a current time and the first time; determining whether the first interval duration is greater than a preset interval duration and the first access number is less than a preset first access number; when the first interval duration is greater than the preset interval duration and the first access number is less than the preset first access number, determining to delete the second cache data in the first cache level.

5. The method of claim 4, wherein, After it is determined that the first access frequency is less than or equal to the preset first access frequency and the first data amount is greater than or equal to the preset data amount, the method further includes: obtaining a second access number, the second access number being an access number corresponding to the second cache data within a preset second time; determining whether the second access number is greater than or equal to a preset second access number; when the second access number is greater than or equal to the preset second access number, determining to transfer the second cache data in the first cache level to the second cache level.

6. The method of claim 4, wherein, Before it is determined that the second access frequency is less than or equal to a preset second access frequency, the method further includes: obtaining third cache data from the second cache level and determining a second time corresponding to the third cache data; obtaining an interval day number, the interval day number being a number of days between the second time and the current time; determining whether the interval day number is greater than a preset interval day number; when the interval day number is greater than the preset interval day number, determining to transfer the third cache data in the second cache level to the third cache level.

7. The method of claim 1, wherein, After the access request sent by the user is received, the method further includes: in response to an update operation of the user at a first node, updating first information in the second cache level and the third cache level according to the update operation, the first information being information corresponding to the update of the user; based on the user, determining a second node, and sending invalidation information to the second node, the invalidation information being information that the first information has become invalid, the first information being information corresponding to the user before the update operation is performed; Determine that the second node receives the failure information, so that the second node finds second information corresponding to the first information from the first cache level according to the failure information, and cleans up the second information, the second information being information corresponding to the user stored in the second node.

8. A data processing apparatus, characterized by, The device comprises a receiving unit (201), a processing unit (202) and a confirming unit (203); The receiving unit (201) receives an access request sent by a user, analyzes the access request, and obtains a cache identifier; The processing unit (202) inputs the cache identifier into a first cache level for query, obtains a first query result, inputs the cache identifier into a second cache level for query if the first query result is null, and obtains a second query result; If the second query result is null, input the cache identifier into a third cache level for query, obtain a third query result, the priority of the first cache level being higher than that of the second cache level, and the priority of the second cache level being higher than that of the third cache level; If the third query result is not null, obtain first cache data corresponding to the cache identifier from the third query result, and write the first cache data into the first cache level and the second cache level respectively; The confirming unit (203) confirms that the first cache data has been written into the first cache level, so that the first cache level displays the first cache data corresponding to the cache identifier to the user.

9. An electronic device, comprising: The electronic device (300) comprises a processor (301), a memory (302), a user interface (303) and a network interface (304), the memory (302) is used for storing instructions, the user interface (303) and the network interface (304) are used for communicating with other devices, and the processor (301) is used for executing the instructions stored in the memory (302) to make the electronic device (300) execute the method of any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores instructions, when the instructions are executed, the method of any one of claims 1-7 is executed.