Data processing method and device, computing equipment and storage medium

By utilizing the memory storage space of the Internet data center, data updates are directly initiated to the database and target keys and values ​​are deleted, which solves the problem of limited memory capacity of hardware devices and achieves flexible cache capacity adjustment and cost reduction.

CN120849460APending Publication Date: 2025-10-28TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410525331.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-28
Publication Date
2025-10-28

AI Technical Summary

Technical Problem

When using hardware device memory as a cache medium, the capacity is limited and the change process requires hardware changes, resulting in a long device setup time and difficulty in flexibly adjusting the intermediate storage medium capacity.

Method used

Use the memory storage space provided by the Internet data center as the first storage space, directly initiate data updates to the database, and delete the target keys and values ​​in the memory storage space after receiving the update results, so as to achieve flexible capacity adjustment.

Benefits of technology

While ensuring data reading and writing efficiency, it reduces the cost of using storage media and enables flexible adjustment of cache capacity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120849460A_ABST
    Figure CN120849460A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data processing method and device, computing equipment and a storage medium, which are used for flexibly adjusting the capacity of an intermediate storage medium for caching. Comprising the steps that when a target service initiates data updating related to a target key, a first storage space directly initiates the data updating related to the target key to a database, and after the database feeds back a data updating result related to the target key, under the condition that the target key is stored in the first storage space, the target key and a value corresponding to the target key are deleted; the first storage space is a memory storage space provided by the Internet data center, and feeding back an update result to the target service. The internet data center is composed of a plurality of devices containing memories, so that the first storage space can be used for randomly adjusting the capacity of the first storage space based on the memory space provided by the internet data center, and the capacity of the intermediate storage medium can be flexibly adjusted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] As the application scope of computer technology continues to expand and data sources are constantly being generated, in order to efficiently read, write and update data, a cache can be set up in high-speed storage to store temporary copies of the data, thereby improving the data access speed.

[0003] To reduce costs, memory is being used as an intermediate storage medium to cache frequently accessed data in databases in scenarios where storage speed requirements are not stringent. However, in solutions using hardware memory as a cache, the memory capacity of the hardware is limited, and changes to the capacity of the intermediate storage medium often involve hardware changes. These hardware changes inevitably introduce new equipment setup time, making the flexible adjustment of the intermediate storage medium's capacity a significant challenge. Summary of the Invention

[0004] This application provides a data processing method, apparatus, device, and storage medium for flexibly adjusting the capacity of an intermediate storage medium used for caching.

[0005] In view of the above, the first aspect of this application provides a data processing method, comprising:

[0006] Retrieve the data update request sent by the target service. The data update request carries the target key and a preset value.

[0007] Send a target update request to the database. The target update request carries the target key and preset value. The target update request is generated based on the data update request. The database is used to store the data generated by the target business in the form of key-value pairs.

[0008] Retrieve the target update result sent by the database. The target update result indicates whether the value corresponding to the target key has been successfully updated to the preset value.

[0009] When the target key is stored in the first storage space, the target key and the value corresponding to the target key are deleted. The first storage space is used to cache the data generated by the target business in the form of key-value pairs. The first storage space is the memory storage space provided by the Internet data center.

[0010] Send the update result to the target business. The update result indicates whether the value corresponding to the target key has been successfully updated to the preset value. The update result is generated based on the target update result.

[0011] A second aspect of this application provides a data processing apparatus, comprising:

[0012] The acquisition unit is used to acquire data update requests sent by the target service. The data update requests carry a target key and a preset value.

[0013] The sending unit is used to send a target update request to the database. The target update request carries a target key and a preset value. The target update request is generated based on the data update request. The database is used to store the data generated by the target business in the form of key-value pairs.

[0014] The acquisition unit is also used to acquire the target update result sent by the database. The target update result indicates whether the value corresponding to the target key has been successfully updated to the preset value.

[0015] The processing unit is used to delete the target key and the value corresponding to the target key when the target key is stored in the first storage space. The first storage space is used to cache the data generated by the target business in the form of key-value pairs. The first storage space is the memory storage space provided by the Internet data center.

[0016] The sending unit is also used to send update results to the target service. The update results indicate whether the value corresponding to the target key has been successfully updated to the preset value. The update results are generated based on the target update results.

[0017] In one possible implementation of the second aspect, the first storage space is set on multiple cache nodes, which include a root node and descendant nodes of the root node. The root node and descendant nodes are distributed in a binary tree manner, and the first storage space reads and writes data in the root node and descendant nodes through the root node.

[0018] In one possible implementation of the second aspect, the processing unit is specifically used for:

[0019] Generate a target delete request, which indicates the deletion of the target key and the value corresponding to the target key from the cache node;

[0020] Send a target deletion request to the root node so that the root node, if it has the target key and the corresponding value cached in the root node, deletes the target key and the corresponding value, and forwards the target deletion request to the root node's child nodes, which are contained in the root node's descendant nodes.

[0021] In one possible implementation of the second aspect, the processing unit is further configured to cache the target key and the value corresponding to the updated target key in a first storage space according to the target update result;

[0022] The sending unit is specifically used to send the update result to the target service if the target key and the value corresponding to the updated target key are successfully cached.

[0023] In one possible implementation of the second aspect, the target update result carries the target key and the value corresponding to the updated target key;

[0024] The processing unit is specifically used for:

[0025] Parse the target update result to obtain the target key and the corresponding value of the updated target key;

[0026] Cache the target key and the value corresponding to the updated target key in the first storage space.

[0027] In one possible implementation of the second aspect, the target node runs a target thread, and the target node is contained in multiple cache nodes;

[0028] The processing unit is also used to store the target time, which is the time when the first storage space caches the target key and the value corresponding to the updated target key;

[0029] The processing unit is also used to delete the target key and the value corresponding to the updated target key if the cache of the target key and the value corresponding to the updated target key expires. The target node is used to analyze whether the cache of the target key and the value corresponding to the updated target key has expired based on the target time.

[0030] In one possible implementation of the second aspect, when the preset value is empty, the data update request is used to delete the target key and the value corresponding to the target key.

[0031] In one possible implementation of the second aspect, the processing unit is specifically configured to store the target key in the first storage space, and delete the target key and the value corresponding to the target key when the target update result indicates that the value corresponding to the target key has been successfully updated to a preset value.

[0032] In one possible implementation of the second aspect, the acquisition unit is further configured to acquire a data query request sent by the target service, the data query request carrying a target key;

[0033] The sending unit is also used to send a target query request to the database when the target key is not stored in the first storage space. The target query request carries the target key and is generated based on the data query request.

[0034] The acquisition unit is also used to acquire the target query result sent by the database, which carries the value corresponding to the target key;

[0035] The sending unit is also used to send query results to the target service. The query results are generated based on the target query results and carry the value corresponding to the target key.

[0036] In one possible implementation of the second aspect, the target query request also carries a target value, which, together with the target key, forms a target key-value pair.

[0037] After obtaining the target query result sent by the database, the processing unit is also used to cache the target value and target key to the first storage space;

[0038] The sending unit is specifically used to send the query results to the target business after successfully caching the target value and target key to the first storage space.

[0039] In one possible implementation of the second aspect, the sending unit is further configured to send a data query result to the target service when the target key is stored in the first storage space. The data query result carries a target value, and the target value and the target key form a target key-value pair.

[0040] A third aspect of this application provides a computer device, including: a memory, a processor, and a bus system;

[0041] The memory is used to store programs;

[0042] The processor is used to execute programs in memory, and the processor is used to execute the methods mentioned above according to the instructions in the program code;

[0043] Bus systems are used to connect memory and processor to enable communication between them.

[0044] The fourth aspect of this application provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the methods described above.

[0045] In a fifth aspect, this application provides a computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the above aspects.

[0046] As can be seen from the above technical solutions, the embodiments of this application have the following advantages: using Internet data centers to provide memory storage space for the first storage space, and the first storage space is used to cache the data generated by the target business in the form of key-value pairs. While ensuring data read and write efficiency, the cache nodes associated with the first storage space can be adjusted according to actual needs, thereby realizing flexible adjustment of the capacity of the first storage space and reducing the cost of using storage media. Attached Figure Description

[0047] Figure 1This is a schematic diagram of the architecture of the data processing system in the embodiments of this application;

[0048] Figure 2 This is another schematic diagram of the data processing system in the embodiments of this application;

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

[0050] Figure 4 This is another flowchart illustrating the data processing method in an embodiment of this application;

[0051] Figure 5 This is another flowchart illustrating the data processing method in an embodiment of this application;

[0052] Figure 6 This is another flowchart illustrating the data processing method in an embodiment of this application;

[0053] Figure 7 This is another flowchart illustrating the data processing method in an embodiment of this application;

[0054] Figure 8 This is a schematic diagram of the distribution of multiple IDCs in an embodiment of this application;

[0055] Figure 9 This is another flowchart illustrating the data processing method in an embodiment of this application;

[0056] Figure 10 This is a schematic diagram of the data processing device in an embodiment of this application;

[0057] Figure 11 This is another structural schematic diagram of the data processing device in the embodiments of this application;

[0058] Figure 12 This is another structural schematic diagram of the data processing device in the embodiments of this application. Detailed Implementation

[0059] This application provides a data processing method, apparatus, device, and storage medium for flexibly adjusting the capacity of an intermediate storage medium used for caching.

[0060] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “corresponding to,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0061] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0062] As the application scope of computer technology continues to expand and data sources are constantly being generated, in order to efficiently read, write and update data, a cache can be set up in high-speed storage to store temporary copies of the data, thereby improving the data access speed.

[0063] To reduce costs, memory is being used as an intermediate storage medium to cache frequently accessed data in databases in scenarios where storage speed requirements are not stringent. However, in solutions using hardware memory as a cache, the memory capacity of the hardware is limited, and changes to the capacity of the intermediate storage medium often involve hardware changes. These hardware changes inevitably introduce new equipment setup time, making the flexible adjustment of the intermediate storage medium's capacity a significant challenge.

[0064] This application addresses the above issues by proposing a method whereby, when a target service initiates a data update related to a target key, the first storage space directly sends the update to the database. After the database returns the update result, if the target key is already stored in the first storage space, the target key and its corresponding value are deleted, and the update result is returned to the target service. The first storage space is the memory storage space provided by the Internet Data Center. Since the Internet Data Center consists of multiple memory-equipped devices, the capacity of the first storage space can be arbitrarily adjusted based on the available memory space, thus achieving flexible adjustment of the intermediate storage medium's capacity.

[0065] The method provided in this application is applicable to, for example... Figure 1 The data processing system shown includes a caching service and a database.

[0066] In this context, the target business is the user of the data processing system. It initiates a data processing request to the caching service for data querying or data updating. After receiving the data processing request, the caching service processes the data accordingly and returns the data processing result to the target business.

[0067] The caching service includes a target thread and a first storage space. The target thread runs on a target node, which is contained in an Internet data center. The target thread is used to analyze whether the data has expired based on the caching time of the data cached in the first storage space.

[0068] The first storage space is used to cache data generated by the target business in the form of key-value pairs.

[0069] The database serves as hard disk storage, used to persist data generated by the target business to disk. When the cache service restarts or undergoes changes, the database acts as a stable data source, supporting data reading, writing, and modification.

[0070] See Figure 2 , Figure 2This is an optional architecture diagram illustrating an application scenario of the data processing method provided in this application embodiment. To support a data processing method, terminal device 100 connects to server 300 via network 200, and server 300 connects to database 400. Network 200 can be a wide area network (WAN), a local area network (LAN), or a combination of both. The client for implementing the data processing method is deployed on terminal device 100. The client can run on terminal device 100 via a browser or as a standalone application (APP). The specific form of the client is not limited here. Server 300 involved in this application can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Terminal device 100 can be a smartphone, tablet, laptop, PDA, personal computer, smart TV, smartwatch, in-vehicle device, wearable device, etc., but is not limited to these. Terminal device 100 and server 300 can be directly or indirectly connected via network 200 through wired or wireless communication, which is not limited in this application. The number of server 300 and terminal device 100 is also not limited. The solution provided in this application can be completed independently by terminal device 100, independently by server 300, or jointly by terminal device 100 and server 300, which is not specifically limited in this application. In short, database 400 can be regarded as an electronic filing cabinet—a place to store electronic files, where users can perform operations such as adding, querying, updating, and deleting data in the files. The so-called "database" is a collection of data stored together in a certain way, which can be shared by multiple users, has the lowest possible redundancy, and is independent of applications. Database management system (DBMS) is a computer software system designed for managing databases, and generally has basic functions such as storage, retrieval, security, and backup.Database management systems can be categorized based on the database model they support, such as relational or Extensible Markup Language (XML); or based on the type of computer they support, such as server clusters or mobile phones; or based on the query language used, such as Structured Query Language (SQL) or XQuery; or based on performance priorities, such as maximum scale or highest operating speed; or other classification methods. Regardless of the classification method used, some DBMSs can cross categories, for example, supporting multiple query languages ​​simultaneously. In this application, database 400 can be used to store training samples or images to be processed. Of course, the storage location of training samples or images to be processed is not limited to the database; for example, it can also be stored in terminal device 100, a blockchain, or the distributed file system of server 300, etc.

[0071] In some embodiments, both the server 300 and the terminal device 100 can execute the data processing method provided in the embodiments of this application.

[0072] In this embodiment, the specific process can be as follows: The terminal device 100 obtains a data update request sent by the target service. The data update request carries a target key and a preset value. Then, the terminal device 100 sends a target update request to the database 400. The target update request carries a target key and a preset value. The target update request is generated based on the data update request. The database 400 is used to store the data generated by the target service in the form of key-value pairs. Then, the terminal device 100 obtains the target update result sent by the database 400. The target update result indicates whether the value corresponding to the target key has been successfully updated to the preset value. Afterwards, if the target key is stored in the first storage space, the terminal device 100 deletes the target key and the value corresponding to the target key. The first storage space is used to cache the data generated by the target service in the form of key-value pairs. The first storage space is the memory storage space provided by the Internet data center. The terminal device 100 also sends an update result to the target service. The update result indicates whether the value corresponding to the target key has been successfully updated to the preset value. The update result is generated based on the target update result.

[0073] A database, simply put, can be viewed as an electronic filing cabinet—a place to store electronic files, where users can perform operations such as adding, querying, updating, and deleting data. A "database" is a collection of data stored together in a certain way, shared by multiple users, with minimal redundancy, and independent of application programs. A Database Management System (DBMS) is a computer software system designed to manage databases, generally possessing basic functions such as storage, retrieval, security, and backup. DBMSs can be classified according to the database model they support, such as relational or Extensible Markup Language (XML); or according to the type of computer they support, such as server clusters or mobile phones; or according to the query language used, such as Structured Query Language (SQL) or XQuery; or according to performance priorities, such as maximum scale or maximum operating speed; or other classification methods. Regardless of the classification method used, some DBMSs can cross categories, for example, supporting multiple query languages ​​simultaneously.

[0074] It is understood that in the specific implementation of this application, data such as target values ​​are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0075] Given that this application involves some technical terms, these terms will be introduced below.

[0076] Thread safety: Thread safety refers to the correct behavior of a program in a multi-threaded environment. In a multi-threaded environment, multiple threads may simultaneously access and modify shared resources, such as global variables, files, and databases. Without appropriate synchronization mechanisms to ensure mutual exclusion of access to these resources in a multi-threaded environment, program behavior may encounter problems, such as data inconsistency and race conditions. To ensure thread safety, we need to use synchronization mechanisms to control access to shared resources. Common synchronization mechanisms include: mutexes, semaphores, read-write locks, atomic operations, and thread-local storage.

[0077] Multiple IDCs: Multiple IDCs (Internet Data Centers) refer to multiple Internet data centers. An Internet Data Center (IDC) is a large data center specifically designed for hosting and managing Internet infrastructure, providing various infrastructure services such as computing, storage, and networking to support the operation of Internet applications and businesses. IDCs are typically operated by large Internet service providers, telecommunications operators, cloud computing service providers, etc., and their data centers are characterized by high reliability, high security, high scalability, high bandwidth, and low latency. Multiple IDCs is an Internet infrastructure deployment strategy based on a distributed architecture. By distributing data and computing tasks among data centers in multiple geographical locations, it improves system availability, performance, and fault tolerance.

[0078] Caching: A cache is a type of memory used to store temporary copies of data for quick access when needed. The purpose of caching is to improve data access speed, and it is one of the key factors in improving performance in computer systems. Caching can be divided into hardware caches and software caches. Hardware caches are typically located inside high-speed devices such as CPUs and GPUs to accelerate data access. Software caches are implemented at the software level, such as browser caches and database caches. The principle of caching is based on the principle of locality of reference, which states that during program execution, programs often access adjacent memory addresses and data. By storing frequently accessed data in a cache, access to slow storage devices such as memory and hard drives can be reduced, thereby improving system performance. The cache hierarchy includes L1, L2, and L3, where L1 cache is closest to the CPU, is the fastest, but has the smallest capacity; L2 cache is slightly farther away, slightly slower, but has a larger capacity; and L3 cache is farthest from the CPU, slowest, but has the largest capacity. Multi-level caching designs better satisfy the principle of locality of reference and improve data access efficiency. Caching is a key component in computer systems that improves data access speed. By storing temporary copies of data, it reduces access to slow storage, thereby improving system performance.

[0079] Background threads: These are threads that run within a program or operating system, primarily designed to perform auxiliary tasks in the background without blocking or interfering with the main thread. Compared to the main thread, background threads typically do not handle user interface responses or interactions, but instead perform low-priority, time-consuming tasks or tasks that do not require immediate results. Background threads improve multitasking capabilities and allow the main thread to respond to user actions more quickly. Typical application scenarios for background threads include: 1. Data processing: Background threads can handle tasks such as reading, writing, calculating, and transforming large amounts of data to reduce the burden on the main thread. 2. Network communication: Background threads can handle network operations such as data exchange, downloading, and uploading with servers, ensuring the main thread remains responsive. 3. Background tasks: Background threads are typically used to perform scheduled tasks, data synchronization, logging, backups, and other background processing to minimize interference with the main thread. 4. Long-running operations: Background threads can handle operations that require a long time to complete without blocking the main thread while waiting for results.

[0080] Key-value (KV) is a type of NoSQL database that uses key-value pairs for data storage and retrieval. The key represents a unique identifier for the data, and the value is the corresponding data content. KV storage is typically used in large-scale distributed systems for fast data manipulation and storage. KV storage can be divided into two types: in-memory KV storage and disk KV storage. In-memory KV storage is suitable for scenarios with very high response speed requirements, such as caching and computational tasks. Disk KV storage is suitable for scenarios with large data volumes requiring persistent storage, such as internet businesses and the financial industry.

[0081] Map: An associative container that stores key-value pairs, where each key is unique. Elements in a map are automatically sorted by key. Maps are commonly used for search, insertion, and deletion operations. Some basic characteristics of maps are as follows: Key-value pairs: Each element in a map is a key-value pair, where the key uniquely identifies the element, and the value is the data associated with the key. Automatic sorting: Elements in a map are automatically sorted by key. By default, this is achieved using the key comparison operator (<), but you can also provide custom comparison functions. Unique keys: Every key in a map must be unique. If you try to insert a key that already exists, the map will not do anything and will not report an error. Efficient searching: Because maps internally use a balanced binary search tree (such as a red-black tree) to store elements, the time complexity of search, insertion, and deletion operations is O(log n), where n is the number of elements in the map. No subscript operator support: Unlike other containers (such as vector and array), maps do not support the subscript operator (operator[]). This is because the subscript operator requires an integer index, while map keys can be of any type. However, you can use the map's member function `find()` to find a key and access its value via an iterator.

[0082] Binary Tree: A binary tree is a tree-like data structure in which each node has at most two child nodes, commonly referred to as the "left child" and "right child". Binary trees have a recursive property, meaning that each of their subtrees is also a binary tree. Some basic concepts of a binary tree are as follows: Root node: The top node of the binary tree, with no parent node. Leaf node: A node with no child nodes.

[0083] The data processing method provided in this application is based on the aforementioned Figure 1 The data processing system shown has different processing flows depending on the message sent by the target service. The following sections describe these flows in conjunction with the different messages sent by the target service:

[0084] Scenario 1: The message sent by the target service is a data query request;

[0085] First, when the message sent by the target service is a data query request, the data processing method provided in this application is further analyzed, and different operations are performed depending on whether the target key is stored in the first storage space.

[0086] 1. The target key is not stored in the first storage space;

[0087] Based on the foregoing Figure 1The data processing system shown below addresses the scenario where the target key is not stored in the first storage space and the message sent by the target service is a data query request. Figure 3 The data processing method provided in the embodiments of this application will be described.

[0088] S110, The target service sends a data query request to the first storage space;

[0089] The data query request carries the target key.

[0090] S120. Search for the target key in the first storage space;

[0091] After receiving a data query request from the target business, the caching service parses the data query request and obtains the target key. The first storage space is used to cache the data used by the target business in the form of key-value pairs.

[0092] Specifically, the first storage space uses key comparison operators to check if the target key exists and the value corresponding to the target key.

[0093] Optionally, the first storage space is memory, and the data structure of the first storage space can be any thread-safe map, such as a thread-safe ConcurrentHashMap or other open-source thread-safe data structures. The thread safety of the first storage space can also be achieved by adding thread locks, mutexes, semaphores, read-write locks, and other techniques to the map data structure. There are no restrictions here.

[0094] S130. If the target key is not stored in the first storage space, the first storage space sends a target query request to the database.

[0095] The target query request carries the target key, and the database stores the key-value pairs generated by the target business.

[0096] Specifically, if the target key is not stored in the first storage space, that is, if the value obtained by querying the target key in the first storage space is empty, the first storage space generates a target query request based on the data query request and sends the target query request to the database.

[0097] Optionally, based on the database, the data corresponding to each key can include data from multiple businesses. Therefore, the target query request can also carry the identity identifier of the target business, which is not restricted here.

[0098] S140. The database sends the target query result to the first storage space;

[0099] The target query result carries the value corresponding to the target key.

[0100] Specifically, after receiving the target query request sent by the first storage space, the database parses the target query request to obtain the target key, or the target key and the identity identifier of the target business; after completing the query on the target key, the database generates the target query result.

[0101] Optionally, if the target query request carries a target key, the target key is queried in the database to obtain the value corresponding to the target key. The value corresponding to the target key can be the target value or be empty.

[0102] Optionally, if the target query request carries a target key and the identity identifier of the target business, the target key is queried in the database to obtain the value corresponding to the target key; and the target value corresponding to the target business is extracted from the value corresponding to the target key based on the identity identifier of the target business, or the value corresponding to the target key is empty, or the value corresponding to the target business in the value corresponding to the target key is empty, without any restrictions here.

[0103] Optionally, the target data processing result may also include the identity identifier of the target business; there are no restrictions here.

[0104] It is understood that the description of the target query results here is only an example. In actual applications, the settings should be combined with the specific application scenario, and no restrictions are imposed here.

[0105] S150, The first storage space sends the query results to the target service;

[0106] The query results are generated based on the target query results. The query results carry the target value or null value, and the target value and the target key form a target key-value pair.

[0107] Specifically, after obtaining the target query result sent by the database, the first storage space generates a query result based on the target query result and sends the query result to the target business so that the target business can perform subsequent operations based on the query result. No restrictions are imposed here.

[0108] In this embodiment of the application, a data processing method is provided in which, when the target business queries data corresponding to a target key, and the target key does not exist in the first storage space, the first storage space initiates a query for the target key in the database, obtains the target query result, and forwards the target query result to the target business so that the target business can perform subsequent operations. This improves the operation of the data processing method provided in this application when data querying is performed and the target key is not stored in the first storage space, thus enhancing the completeness of the solution.

[0109] Based on the foregoing Figure 3The data processing method shown may further include step S160 before step S150 is implemented when the target query result includes the target value. Step S150 includes step S151. Please refer to [link to relevant documentation]. Figure 4 .

[0110] S160. If the target query result includes the target value, the first storage space caches the target key-value pair.

[0111] In this context, the target key-value pair consists of a target key and a target value.

[0112] S151. When the target key-value pair is successfully cached in the first storage space, the first storage space sends the query result to the target business.

[0113] The query results are generated based on the target query results, and the query results carry the target value.

[0114] Specifically, after the first storage space stores the target key-value pair for a first period of time, it is considered that the first storage space has successfully cached the target query result. The first storage space generates a query result based on the target query result and sends the query result to the target business so that the target business can perform subsequent operations based on the query result. No restrictions are imposed here.

[0115] In this embodiment, when the target query result carries a target value, the first storage space caches the target key-value pair. After ensuring that the first storage space successfully caches the target key-value pair, the query result is sent to the target service. This provides a basis for the next query of the value corresponding to the target key, reduces the time required for the next query of the value corresponding to the target key, and improves the efficiency of data processing.

[0116] 2. The target key is stored in the first storage space;

[0117] Based on the foregoing Figure 1 The data processing system shown below, for the case where the target key is stored in the first storage space and the message sent by the target service is a data query request, will be discussed in conjunction with the following. Figure 5 The data processing method provided in the embodiments of this application will be described.

[0118] S210, The target service sends a data query request to the first storage space;

[0119] The data query request carries the target key.

[0120] S220. Search for the target key in the first storage space;

[0121] After receiving a data query request from the target business, the caching service parses the data query request and obtains the target key. The first storage space is used to cache the data used by the target business in the form of key-value pairs.

[0122] Specifically, the first storage space uses key comparison operators to query whether the target key exists in the first storage space, and the value corresponding to the target key.

[0123] Optionally, the first storage space is memory, and the data structure of the first storage space can be any thread-safe map, such as a thread-safe ConcurrentHashMap or other open-source thread-safe data structures. The thread safety of the first storage space can also be achieved by adding thread locks, mutexes, semaphores, read-write locks, and other techniques to the map data structure. There are no restrictions here.

[0124] S230. If the target key is stored in the first storage space, the first storage space sends the data query result to the target service.

[0125] The data query results carry the target value, and the target value and the target key form a key-value pair.

[0126] Specifically, after completing the query on the target key, the first storage space generates the data query result and sends the data query result to the target business so that the target business can perform subsequent operations based on the data query result. No restrictions are imposed here.

[0127] In this embodiment, when the target service queries the data corresponding to the target key, and the target key is stored in the first storage space, the first storage space sends the query result to the target service so that the target service can perform subsequent operations. This improves the operation of the data processing method provided in this application when the target service queries the data corresponding to the target key, and the target key is stored in the first storage space, thus enhancing the completeness of the solution.

[0128] Scenario 2: The message sent by the target service is an update message;

[0129] Based on the foregoing Figure 1 The data processing system shown below, in response to the data processing request instructing the update of the value corresponding to the target key, will be discussed in conjunction with the following. Figure 6 The data processing method provided in the embodiments of this application will be described.

[0130] S310, The target service sends a data update request to the first storage space;

[0131] The data update request carries a target key and a preset value, with the preset value used to update the value corresponding to the target key.

[0132] S320, The first storage space sends a target update request to the database;

[0133] The target update request carries the target key and preset value.

[0134] Optionally, the target update request may also carry the identity identifier of the target business.

[0135] Specifically, after receiving a data update request, the first storage space generates a target update request based on the target key and preset value carried in the data update request, combined with the identity identifier of the target business. The first storage space then sends the target update request to the database.

[0136] S330, The database sends the target update result to the first storage space;

[0137] The target update result indicates whether the value corresponding to the target key has been successfully updated to the preset value.

[0138] Specifically, whether the value corresponding to the target key has been successfully updated to the preset value can be determined by including the target key and the updated value of the target key in the target update result, or by including the target identifier in the target update result. The content of the target identifier and its corresponding meaning are preset.

[0139] For example, a target identifier of 1 indicates that the value corresponding to the target key has been successfully updated to the preset value, while a target identifier of 0 indicates that the value corresponding to the target key has failed to be updated. No restrictions are imposed here.

[0140] Furthermore, the target update result can also carry the updated value corresponding to the target key along with the target identifier.

[0141] For example, before the database receives the target update request, the target key and target value stored in the database form a key-value pair. If the database successfully updates the value corresponding to the target key to the preset value, the target update result also carries the key-value pair consisting of the target key and the preset value.

[0142] Before the database receives the target update request, the target key and target value stored in the database form a key-value pair. If the database fails to update the value corresponding to the target key to the preset value, the target update result also carries the key-value pair consisting of the target key and target value.

[0143] It is understood that the description of the target update result here is only an example. In actual applications, it should be set according to the specific application scenario. There are no restrictions here.

[0144] S340, Delete the target key and the value corresponding to the target key in the first storage space;

[0145] Specifically, after receiving the target update result, the first storage space deletes the target key and the value corresponding to the target key from the first storage space.

[0146] Furthermore, the first storage space can delete the target key and its corresponding value only if the target update request indicates that the database has successfully updated the value corresponding to the target key; there are no restrictions here.

[0147] In this embodiment, since the database fails to update the value corresponding to the target key, the target key and the value corresponding to the target key stored in the first storage space do not need to be changed. The first storage space only deletes the target key and the value of the target key when the target update request indicates that the database has successfully updated the value corresponding to the target key. This simplifies the operation process and further improves the implementation efficiency of the data processing method.

[0148] S350, the first storage space sends the update result to the target service.

[0149] The update result is generated based on the target update result, and the update result indicates whether the value corresponding to the target key has been successfully updated.

[0150] Specifically, after the first storage space successfully deletes the target key and the value corresponding to the target key, it generates an update result based on the target update result and sends the update result to the target business, so that the target business can perform subsequent operations based on the update result. The update result is a response message for the data update request.

[0151] For example, the first storage space can be considered to have successfully deleted the target key and its corresponding value after a second time interval following the moment the first storage space initiates the deletion. Alternatively, after deleting the target key and its corresponding value, the first storage space can query the target key and obtain an empty value; this is not restricted here.

[0152] It is understood that the explanation of the method for determining the successful deletion of the target key and the value corresponding to the target key in the first storage space is only an example. In actual applications, it should be set according to the specific application scenario, and no restrictions are imposed here.

[0153] In this embodiment of the application, in the scenario where the target business initiates an update to the value corresponding to the target key, the first storage space deletes the target key and the value corresponding to the target key before feeding back the target data to the target business. This avoids the situation where the key-value pairs related to the target key have different contents in the database and the first storage space, thereby improving data consistency during the data processing process.

[0154] Based on the foregoing Figure 6 In the data processing method shown, since the first storage space is located in multiple Internet data centers (IDCs), step S340 may specifically include steps S341 to S342. Please refer to [link / reference needed]. Figure 7 :

[0155] S341. The first storage space generates a target deletion request;

[0156] The target deletion request specifies the deletion of the target key and the corresponding value in the IDC node.

[0157] S342. The first storage space sends a target deletion request to the root node in the cache node;

[0158] The first storage space includes multiple cache nodes (IDC), and the root node among the multiple cache nodes is used to read and write the data of the descendant nodes of the root node.

[0159] Specifically, to facilitate understanding, let's first combine... Figure 8 This section introduces the distribution of multiple data centers (IDCs).

[0160] A multi-IDC (Internet Data Center) system includes at least one root node. The root node is connected to the child nodes of the two root nodes, and the child nodes of the two root nodes are each connected to the two grandchild nodes of the root node. In other words, multiple IDCs form at least one such system. Figure 8 The diagram shows an IDC binary tree. Each node corresponds to a data storage device.

[0161] In constructing such Figure 8 In the binary tree stage shown, when a target storage device is added to the online IDC, it sends an add signal to the IDC node management center. The IDC node management center adds the target storage device to the target machine list corresponding to the first storage space and adds the target storage device's identity identifier to the target machine list according to the time of addition. The target storage device's identity identifier is unique in the target machine list and is associated with the order in which it was added among the multiple storage devices corresponding to the first storage space.

[0162] For example, the identifier of the first storage device added to the first storage space is set to 1, the identifier of the second storage device added to the first storage space is set to 2, ..., and the identifier of the Nth storage device added to the first storage space is set to N. Furthermore, based on the identifiers of the storage devices, a structure can be built as follows: Figure 8 The binary tree shown.

[0163] Furthermore, the identity of each storage space is globally unique. Therefore, the identity of the target storage device is used to uniquely identify the target storage device in the first storage space. At the same time, the identity of the first storage space is used to uniquely identify the first storage space. In other words, the target storage device can be globally uniquely identified by using the identity of the target storage device and the identity of the first storage space.

[0164] In this embodiment, the data structure of multiple cache nodes used in the first storage space is set in the form of a binary tree, which can effectively improve the speed of data query.

[0165] Therefore, the first storage space sends a target deletion request to the root node among multiple cache nodes. The root node can then delete the target key and its corresponding value based on the request, and forwards the deletion request to cache nodes with identifiers 2 and 3. The cache node with identifier 2 deletes the target key and its corresponding value based on the request and forwards it to its child nodes. Similarly, the cache node with identifier 3 deletes the target key and its corresponding value based on the request and forwards it to its child nodes. This process continues until the leaf nodes of the binary tree are reached, deleting the target key and its corresponding value.

[0166] In this embodiment of the application, based on the case where the first storage space is set up in multiple IDCs, in the binary tree structure composed of multiple IDCs, the first storage space sends the target deletion request to the root node in the multiple IDCs. Then, through the root node, the target deletion request is transmitted to all nodes in the multiple IDCs in turn using the parent-child relationship in the binary tree, so as to achieve the complete deletion of the target key and the value corresponding to the target key, and avoid the data inconsistency caused by omissions during the deletion process.

[0167] Based on the foregoing Figure 6 or Figure 7 In the data processing method shown, if the data processing request indicates that the value corresponding to the target key be updated, and the target key cannot be found in the first storage space, step S360 may be included before step S350 is implemented. Step S350 includes step S351. Please refer to [link to relevant documentation]. Figure 9 .

[0168] S360, the first storage space caches the target key and the value corresponding to the updated target key;

[0169] Specifically, after receiving the target update result sent by the database, the first storage space caches the target key and the value corresponding to the updated target key.

[0170] Optionally, if the target update result includes the value corresponding to the updated target key, the first storage space, after receiving the target update result, extracts and caches the target key and the value corresponding to the updated target key from the target update result.

[0171] Optionally, if the target update result carries a target identifier, and the target identifier indicates that the update was successful, the first storage space caches the target key and the value corresponding to the updated target key according to the data update request.

[0172] If the target identifier indicates that the update fails, the first storage space retrieves the target key and the corresponding value from the database and caches the target key and the corresponding value. No restrictions are imposed here.

[0173] It is understood that the description of the target key and the corresponding value of the updated target key in the first storage space cache is only an example. In actual applications, it should be set according to the specific application scenario. There are no restrictions here.

[0174] In this embodiment of the application, based on the target update result including the value corresponding to the updated target key, the first storage space can directly use the value corresponding to the updated target key for caching, thereby improving the efficiency of the first storage space in caching the target key and the value corresponding to the updated target key.

[0175] S351. When the target key and preset value are successfully cached in the first storage space, the first storage space sends the update result to the target service.

[0176] The update result is generated based on the target update result, and the update result indicates whether the value corresponding to the target key has been successfully updated.

[0177] Specifically, the first storage space successfully deletes the target key and its corresponding value. After caching the target key and its updated value, the first storage space generates an update result based on the target update result and sends the update result to the target service. This allows the target service to perform subsequent operations based on the update result, which is a response message for the data update request.

[0178] In this embodiment, after the database sends the target update result back to the first storage space, the first storage space caches the target key and the value corresponding to the updated target key. When the target business queries the data related to the target key in the future, it can directly obtain it from the first storage space without having to retrieve it from the database. This shortens the time required for the target business to query the data related to the target key in the future and improves the efficiency of data processing.

[0179] Optionally, due to the data processing method, the data in the first storage space can also be periodically deleted by setting up a thread for periodic management. The data processing method may also include steps S370 and S380.

[0180] S370, The first storage space stores the target time;

[0181] The target time is the moment when the first storage space caches the target key and the value corresponding to the updated target key.

[0182] S380. If the cache of the target key and the value corresponding to the updated target key in the first storage space times out, delete the target key and the value corresponding to the updated target key from the first storage space.

[0183] Specifically, the first storage space calls the target thread to determine whether the data in the first storage space has timed out. If the data has timed out, the cached timed-out data in the first storage space is deleted.

[0184] Specifically, the target thread periodically scans the target key and the value corresponding to the updated target key in the first storage space to determine whether the cache of the target key and the value corresponding to the updated target key has expired at the current moment. If the cache of the target key and the value corresponding to the updated target key has expired, the target key and the preset value are deleted.

[0185] The target thread is the thread in the target node, and the target node is contained in multiple cache nodes.

[0186] For example, the cache time for the target key and the value corresponding to the updated target key is the target time. The target thread has a pre-set target duration. If the current time is after the target duration after the target time, it is considered that the cache for the target key and the value corresponding to the updated target key has timed out.

[0187] It is understandable that the explanation of the cache timeout judgment for the target key and the updated target key in the first storage space is only an example. In actual applications, when caching the target key and the updated target key, the first storage space can also directly write the timeout time corresponding to the target key and the updated target key. There is no restriction here.

[0188] In this embodiment, by setting a target thread in the cache service, the target thread is used to determine whether the data in the first storage space has timed out, thereby cleaning up the cached timed-out data in the first storage space, releasing the cache space and improving the data processing efficiency of the first storage space.

[0189] Based on the foregoing Figure 6 , Figure 7 and Figure 9 The data processing method described here, in the case of a default null value, uses a data update request to delete the target key and the value corresponding to the target key, which will not be elaborated here.

[0190] In this embodiment, when the target service deletes the data corresponding to the target key, the first storage space sends a data update request carrying the target key and a preset value to the database, wherein the preset value is empty, so as to realize the deletion of the value corresponding to the target key. This improves the operation of the data processing method provided in this application when the target service deletes the data corresponding to the target key, and enhances the completeness of the solution.

[0191] The data processing apparatus in this application is described in detail below. Please refer to [link / reference]. Figure 10 , Figure 10 This is a schematic diagram of one embodiment of the data processing apparatus in this application. The data processing apparatus 10 includes:

[0192] Acquisition unit 110 is used to acquire data update requests sent by the target service. The data update requests carry a target key and a preset value.

[0193] Sending unit 120 is used to send a target update request to the database. The target update request carries a target key and a preset value. The target update request is generated based on the data update request. The database is used to store the data generated by the target business in the form of key-value pairs.

[0194] The acquisition unit 110 is also used to acquire the target update result sent by the database. The target update result indicates whether the value corresponding to the target key has been successfully updated to the preset value.

[0195] Processing unit 130 is used to delete the target key and the value corresponding to the target key when the target key is stored in the first storage space. The first storage space is used to cache the data generated by the target business in the form of key-value pairs. The first storage space is the memory storage space provided by the Internet data center.

[0196] The sending unit 120 is also used to send an update result to the target service. The update result indicates whether the value corresponding to the target key has been successfully updated to the preset value. The update result is generated based on the target update result.

[0197] In this embodiment of the application, when the target service initiates an update of the value corresponding to the target key, the first storage space deletes the target key and the value corresponding to the target key before feeding back the target data to the target service. This avoids the situation where the key-value pairs related to the target key are different in the database and the first storage space, thereby improving data consistency during the data processing process.

[0198] Optionally, the first storage space is set on multiple cache nodes, which include a root node and descendant nodes of the root node. The root node and descendant nodes are distributed in a binary tree. The first storage space reads and writes data in the root node and descendant nodes through the root node.

[0199] In this embodiment, the data structure of multiple cache nodes used in the first storage space is set in the form of a binary tree, which can effectively improve the speed of data query.

[0200] Optionally, the processing unit 130 is specifically used for:

[0201] Generate a target delete request, which indicates the deletion of the target key and its corresponding value from the cache node.

[0202] Send a target deletion request to the root node so that the root node, if it has the target key and the corresponding value cached in the root node, deletes the target key and the corresponding value, and forwards the target deletion request to the root node's child nodes, which are contained in the root node's descendant nodes.

[0203] In this embodiment, the data processing device is based on the case where the first storage space is set up in multiple IDCs. In the binary tree structure composed of multiple IDCs, the first storage space sends the target deletion request to the root node in the multiple IDCs. Then, through the root node, the target deletion request is transmitted to all nodes in the multiple IDCs in turn using the parent-child relationship in the binary tree, so as to achieve the complete deletion of the target key and the value corresponding to the target key, and avoid the data inconsistency caused by omissions during the deletion process.

[0204] Optionally, the processing unit 130 is also configured to cache the target key and the value corresponding to the updated target key in the first storage space according to the target update result;

[0205] The sending unit 120 is specifically used to send the update result to the target service when the target key and the value corresponding to the updated target key are successfully cached.

[0206] In this embodiment, after the database sends the target update result back to the first storage space, the first storage space caches the target key and the value corresponding to the updated target key. When the target business queries the data related to the target key in the future, it can directly obtain it from the first storage space without having to retrieve it from the database. This shortens the time required for the target business to query the data related to the target key in the future and improves the efficiency of data processing.

[0207] In one possible implementation of the second aspect, the target update result carries the target key and the value corresponding to the updated target key;

[0208] Processing unit 130 is specifically used for:

[0209] Parse the target update result to obtain the target key and the corresponding value of the updated target key;

[0210] Cache the target key and the value corresponding to the updated target key in the first storage space.

[0211] In this embodiment of the application, based on the target update result including the value corresponding to the updated target key, the data processing device can directly use the value corresponding to the updated target key for caching, thereby improving the efficiency of the first storage space in caching the target key and the value corresponding to the updated target key.

[0212] Optionally, the target node runs a target thread, and the target node is contained in multiple cache nodes;

[0213] The processing unit 130 is also used to store the target time, which is the time when the first storage space caches the target key and the value corresponding to the updated target key;

[0214] The processing unit 130 is also used to delete the target key and the value corresponding to the updated target key when the cache of the target key and the value corresponding to the updated target key expires. The target node is used to analyze whether the cache of the target key and the value corresponding to the updated target key has expired based on the target time.

[0215] In this embodiment, by setting a target thread in the cache service, the target thread is used to determine whether the data in the first storage space has timed out, thereby cleaning up the cached timed-out data in the first storage space, releasing the cache space and improving the data processing efficiency of the first storage space.

[0216] Optionally, if the default value is empty, the data update request is used to delete the target key and the value corresponding to the target key.

[0217] In this embodiment, when the target service deletes the data corresponding to the target key, the first storage space sends a data update request carrying the target key and a preset value to the database, wherein the preset value is empty, so as to realize the deletion of the value corresponding to the target key. This improves the operation of the data processing method provided in this application when the target service deletes the data corresponding to the target key, and enhances the completeness of the solution.

[0218] Optionally, the processing unit 130 is specifically used to store the target key in the first storage space and, when the target update result indicates that the value corresponding to the target key has been successfully updated to a preset value, delete the target key and the value corresponding to the target key.

[0219] In this embodiment, since the database fails to update the value corresponding to the target key, the target key and the value corresponding to the target key stored in the first storage space do not need to be changed. The first storage space only deletes the target key and the value of the target key when the target update request indicates that the database has successfully updated the value corresponding to the target key. This simplifies the operation process and further improves the implementation efficiency of the data processing method.

[0220] Optionally, the acquisition unit 110 is also used to acquire a data query request sent by the target service, the data query request carrying the target key;

[0221] The sending unit 120 is also used to send a target query request to the database when the target key is not stored in the first storage space. The target query request carries the target key and is generated based on the data query request.

[0222] The acquisition unit 110 is also used to acquire the target query result sent by the database, the target query result carrying the value corresponding to the target key;

[0223] The sending unit 120 is also used to send query results to the target service. The query results are generated based on the target query results and carry the value corresponding to the target key.

[0224] In this embodiment of the application, a data processing method is provided in which, when the target business queries data corresponding to a target key, and the target key does not exist in the first storage space, the first storage space initiates a query for the target key in the database, obtains the target query result, and forwards the target query result to the target business so that the target business can perform subsequent operations. This improves the operation of the data processing method provided in this application when data querying is performed and the target key is not stored in the first storage space, thus enhancing the completeness of the solution.

[0225] Optionally, the target query request also carries the target value, which, together with the target key, forms a target key-value pair;

[0226] The processing unit 130 is also used to cache the target value and target key to the first storage space;

[0227] The sending unit 120 is specifically used to send the query result to the target service after successfully caching the target value and target key to the first storage space.

[0228] In this embodiment, when the target query result carries a target value, the first storage space caches the target key-value pair. After ensuring that the first storage space successfully caches the target key-value pair, the query result is sent to the target service. This provides a basis for the next query of the value corresponding to the target key, reduces the time required for the next query of the value corresponding to the target key, and improves the efficiency of data processing.

[0229] Optionally, the sending unit 120 is also used to send a data query result to the target service when the target key is stored in the first storage space. The data query result carries the target value, and the target value and the target key form a target key-value pair.

[0230] In this embodiment, when the target service queries the data corresponding to the target key, and the target key is stored in the first storage space, the first storage space sends the query result to the target service so that the target service can perform subsequent operations. This improves the operation of the data processing method provided in this application when the target service queries the data corresponding to the target key, and the target key is stored in the first storage space, thus enhancing the completeness of the solution.

[0231] The data processing apparatus provided in this application can be used on a server; please refer to [link / reference]. Figure 11 , Figure 11 This is a schematic diagram of a server structure provided in an embodiment of this application. The server 300 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 322 (e.g., one or more processors) and memory 332, and one or more storage media 330 (e.g., one or more mass storage devices) for storing application programs 342 or data 344. The memory 332 and storage media 330 can be temporary or persistent storage. The program stored in the storage media 330 may include one or more modules (not shown in the diagram), each module may include a series of instruction operations on the server. Furthermore, the CPU 322 may be configured to communicate with the storage media 330 and execute the series of instruction operations stored in the storage media 330 on the server 300.

[0232] Server 300 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input / output interfaces 358, and / or one or more operating systems 341, such as Windows Server. TM Mac OS X TM Unix TM Linux TM FreeBSD TM etc.

[0233] The steps performed by the server in the above embodiments can be based on this Figure 11 The server structure shown.

[0234] The data processing apparatus provided in this application can be used in terminal devices; please refer to [link / reference]. Figure 12 For ease of explanation, only the parts relevant to the embodiments of this application are shown. For specific technical details not disclosed, please refer to the method section of the embodiments of this application. In the embodiments of this application, a smartphone is used as an example for illustration:

[0235] Figure 12 This is a block diagram illustrating a portion of the structure of a smartphone related to the terminal device provided in the embodiments of this application. (Reference) Figure 12The smartphone includes components such as a radio frequency (RF) circuit 410, a memory 420, an input unit 430, a display unit 440, a sensor 450, an audio circuit 460, a wireless fidelity (WiFi) module 470, a processor 480, and a power supply 490. Those skilled in the art will understand that... Figure 12 The smartphone structure shown does not constitute a limitation on smartphones and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0236] The following is combined Figure 12 A detailed introduction to the various components of a smartphone:

[0237] RF circuit 410 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with processor 480; additionally, it transmits uplink data to the base station. Typically, RF circuit 410 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, RF circuit 410 can also communicate wirelessly with networks and other devices. The aforementioned wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile Communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Message Service (SMS), etc.

[0238] The memory 420 can be used to store software programs and modules. The processor 480 executes various functions and data processing of the smartphone by running the software programs and modules stored in the memory 420. The memory 420 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the smartphone (such as audio data, phonebook, etc.). In addition, the memory 420 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0239] The input unit 430 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of the smartphone. Specifically, the input unit 430 may include a touch panel 431 and other input devices 432. The touch panel 431, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 431), and drive the corresponding connected devices according to a pre-set program. Optionally, the touch panel 431 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 480, and can also receive and execute commands sent by the processor 480. In addition, the touch panel 431 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 431, the input unit 430 may also include other input devices 432. Specifically, other input devices 432 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.

[0240] Display unit 440 can be used to display information input by the user or information provided to the user, as well as various menus of the smartphone. Display unit 440 may include display panel 441, optionally configured as a liquid crystal display (LCD), organic light-emitting diode (OLED), or similar form. Further, touch panel 431 may cover display panel 441. When touch panel 431 detects a touch operation on or near it, it transmits the information to processor 480 to determine the type of touch event. Subsequently, processor 480 provides corresponding visual output on display panel 441 based on the type of touch event. Although in Figure 12 In this embodiment, the touch panel 431 and the display panel 441 are two separate components to realize the input and output functions of the smartphone. However, in some embodiments, the touch panel 431 and the display panel 441 can be integrated to realize the input and output functions of the smartphone.

[0241] The smartphone may also include at least one sensor 450, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 441 according to the ambient light level, and the proximity sensor can turn off the display panel 441 and / or the backlight when the smartphone is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that recognize the smartphone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, tapping), etc. Other sensors that may be configured in the smartphone, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.

[0242] Audio circuit 460, speaker 461, and microphone 462 provide an audio interface between the user and the smartphone. Audio circuit 460 converts received audio data into electrical signals and transmits them to speaker 461, where speaker 461 converts them into sound signals for output. On the other hand, microphone 462 converts collected sound signals into electrical signals, which are received by audio circuit 460, converted into audio data, and then processed by processor 480 before being transmitted via RF circuit 410 to, for example, another smartphone, or the audio data can be output to memory 420 for further processing.

[0243] WiFi is a short-range wireless transmission technology. Smartphones, through their WiFi modules (470), can help users send and receive emails, browse web pages, and access streaming media, providing wireless broadband internet access. Although Figure 12 WiFi module 470 is shown, but it is understood that it is not an essential component of a smartphone and can be omitted as needed without changing the nature of the invention.

[0244] The processor 480 is the control center of the smartphone, connecting various parts of the smartphone through various interfaces and lines. It performs various functions and processes data by running or executing software programs and / or modules stored in the memory 420, and by calling data stored in the memory 420, thereby providing overall monitoring of the smartphone. Optionally, the processor 480 may include one or more processing units; optionally, the processor 480 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the aforementioned modem processor may also not be integrated into the processor 480.

[0245] The smartphone also includes a power supply 490 (such as a battery) that supplies power to various components. Optionally, the power supply can be logically connected to the processor 480 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.

[0246] Although not shown, smartphones may also include a camera, Bluetooth module, etc., which will not be described in detail here.

[0247] The steps performed by the terminal device in the above embodiments can be based on this Figure 12 The terminal device structure is shown.

[0248] This application also provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the methods described in the foregoing embodiments.

[0249] This application also provides a computer program product including a program, which, when run on a computer, causes the computer to perform the methods described in the foregoing embodiments.

[0250] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0251] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0252] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0253] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0254] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0255] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A data processing method, characterized in that, include: Obtain the data update request sent by the target service, wherein the data update request carries a target key and a preset value; A target update request is sent to the database. The target update request carries the target key and the preset value. The target update request is generated based on the data update request. The database is used to store the data generated by the target service in the form of key-value pairs. Obtain the target update result sent by the database, wherein the target update result indicates whether the value corresponding to the target key has been successfully updated to the preset value; When the target key is stored in the first storage space, the target key and the value corresponding to the target key are deleted. The first storage space is used to cache the data generated by the target service in the form of key-value pairs. The first storage space is the memory storage space provided by the Internet Data Center. An update result is sent to the target service. The update result indicates whether the value corresponding to the target key has been successfully updated to the preset value. The update result is generated based on the target update result.

2. The method according to claim 1, characterized in that, The first storage space is set up on multiple cache nodes, which include a root node and descendant nodes of the root node. The root node and the descendant nodes are distributed in a binary tree. The first storage space reads and writes data in the root node and the descendant nodes through the root node.

3. The method according to claim 2, characterized in that, Deleting the target key and the value corresponding to the target key includes: Generate a target deletion request, the target deletion request indicating the deletion of the target key and the value corresponding to the target key in the cache node; The target deletion request is sent to the root node, so that if the root node has the target key and the value corresponding to the target key cached in the root node, the target key and the value corresponding to the target key are deleted, and the target deletion request is forwarded to the child nodes of the root node, wherein the child nodes of the root node are included in the descendant nodes of the root node.

4. The method according to claim 2 or 3, characterized in that, Before sending the update result to the target service, the method further includes: Based on the target update result, cache the target key and the value corresponding to the updated target key in the first storage space; Sending the update result to the target service includes: If the target key and the updated value corresponding to the target key are successfully cached, the update result is sent to the target service.

5. The method according to claim 4, characterized in that, The target update result carries the target key and the value corresponding to the updated target key; The step of caching the target key and the value corresponding to the updated target key to the first storage space according to the target update result includes: Parse the target update result to obtain the target key and the value corresponding to the updated target key; The target key and the updated value corresponding to the target key are cached in the first storage space.

6. The method according to claim 2 or 3, characterized in that, The target node runs a target thread, and the target node is contained within the plurality of cache nodes; The method further includes: The target time is the moment when the first storage space caches the target key and the updated value corresponding to the target key. If the cached value corresponding to the target key and the updated target key expires, the cached value corresponding to the target key and the updated target key is deleted. The target thread is used to analyze whether the cached value corresponding to the target key and the updated target key has expired based on the target time.

7. The method according to any one of claims 1 to 3, characterized in that, If the preset value is empty, the data update request is used to delete the target key and the value corresponding to the target key.

8. The method according to any one of claims 1 to 3, characterized in that, When the target key is stored in the first storage space, deleting the target key and the value corresponding to the target key includes: If the target key is stored in the first storage space, and the target update result indicates that the value corresponding to the target key has been successfully updated to the preset value, then the target key and the value corresponding to the target key are deleted.

9. The method according to any one of claims 1 to 3, characterized in that, The method further includes: Obtain the data query request sent by the target service, wherein the data query request carries the target key; If the target key is not stored in the first storage space, a target query request is sent to the database. The target query request carries the target key and is generated based on the data query request. Obtain the target query result sent by the database, wherein the target query result carries the value corresponding to the target key; Send a query result to the target service. The query result is generated based on the target query result and carries the value corresponding to the target key.

10. The method according to claim 9, characterized in that, The target query request also carries a target value, and the target value and the target key form a target key-value pair; After obtaining the target query result sent by the database, the method further includes: Cache the target value and the target key in the first storage space; Sending the query results to the target service includes: If the target value and the target key are successfully cached in the first storage space, the query result is sent to the target service.

11. The method according to claim 9, characterized in that, The method further includes: If the target key is stored in the first storage space, a data query result is sent to the target service. The data query result carries a target value, and the target value and the target key form a target key-value pair.

12. A data processing apparatus, characterized in that, include: The acquisition unit is used to acquire data update requests sent by the target service. The data update requests carry a target key and a preset value. The sending unit is used to send a target update request to the database. The target update request carries a target key and a preset value. The target update request is generated based on the data update request. The database is used to store the data generated by the target service in the form of key-value pairs. The acquisition unit is further configured to acquire the target update result sent by the database, wherein the target update result indicates whether the value corresponding to the target key has been successfully updated to the preset value; The processing unit is configured to delete the target key and the value corresponding to the target key when the target key is stored in the first storage space. The first storage space is used to cache the data generated by the target service in the form of key-value pairs. The first storage space is the memory storage space provided by the Internet Data Center. The sending unit is further configured to send an update result to the target service. The update result indicates whether the value corresponding to the target key has been successfully updated to the preset value. The update result is generated based on the target update result.

13. A computer device, characterized in that, include: Memory, processor, and bus system; The memory is used to store programs; The processor is configured to execute a program in the memory, and the processor is configured to execute the method of any one of claims 1 to 11 according to instructions in the program code; The bus system is used to connect the memory and the processor to enable communication between the memory and the processor.

14. A computer-readable storage medium comprising instructions that, when executed on a computer, cause the computer to perform the method as claimed in any one of claims 1 to 11.

15. A computer program product, comprising a computer program, characterized in that, The computer program is executed by a processor using the method as described in any one of claims 1 to 11.