Data cache processing method, device, cache grid platform and storage medium
By decoupling business caching logic and business logic in service development, and using cache agents and processing processes to process request data, the problems of complex code development and increased maintenance workload are solved, and data access speed is increased and system performance is improved.
Patent Information
- Application Number
- CN202111217735.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-19
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-10-19
AI Technical Summary
During the service development process, business caching logic is coupled with business logic, resulting in complex code development and increased maintenance workload.
Receive business request information through the first cache agent of the target service, determine the target request interface corresponding to the uniform resource locator, and if the target cache processing process configured in the interface is enabled, call the target cache processing process to process the request data in the cache database , to achieve the decoupling of caching logic and business logic.
Accelerate data access through caching, reduce load pressure on back-end applications and data storage, improve system performance, reduce storage access pressure, and reduce code development and maintenance workload.
Smart Images

Figure CN113973135B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to a data cache processing method, a data cache processing device, a cache grid platform and a storage medium. Background Art
[0002] With the rapid development of Internet technology, Service Mesh is a dedicated infrastructure layer for handling service-to-service communication. It is responsible for securely and reliably delivering requests through complex service topologies that include modern cloud-native applications. Service Mesh technology is becoming more and more popular as the basic technology and architectural pattern for microservices and cloud-native architectures. Service Mesh is mainly a network infrastructure component that enables enterprises to offload network communication logic from microservice-based applications so that enterprises can focus entirely on the business logic of the service. At the same time, in order to increase the speed of service access, enterprises provide business caching functions for each service.
[0003] Related technologies In the service development process, the business cache logic is coupled with the business logic in the service code, so that the implementation of the business cache logic is bound to the business service, thereby realizing the business cache function of the service. However, this method at least has the problem of complex code development and increased maintenance workload. Summary of the invention
[0004] The embodiments of the present application are intended to provide a data cache processing method, a data cache processing device, a cache grid platform and a storage medium to solve at least the problems of complex code development and increased maintenance workload in the related art.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] In a first aspect, an embodiment of the present application provides a data cache processing method, the method comprising:
[0007] Receiving, through a first cache proxy for a target service, service request information sent by at least one second cache proxy for a request service, wherein the service request information includes a uniform resource locator;
[0008] Determine the target request interface corresponding to the uniform resource locator, and if the target cache processing process configured by the target request interface is in an enabled state, call the target cache processing process to process the request data in the cache database requested by the business request information.
[0009] In a second aspect, an embodiment of the present application provides a data cache processing device, the device comprising:
[0010] A receiving module, configured to receive, through a first cache proxy for a target service, service request information sent by at least one second cache proxy for a request service, wherein the service request information includes a uniform resource locator;
[0011] A determination module, used for determining a target request interface corresponding to the uniform resource locator;
[0012] The processing module is used to call the target cache processing process if the target cache processing process configured by the target request interface is in an enabled state, and process the request data in the cache database requested by the business request information.
[0013] In a third aspect, an embodiment of the present application provides a cache grid platform, the cache grid platform comprising: a cache management center, a cache grid and a cache database; the cache management center comprises an information management module and an information synchronization module;
[0014] Wherein, the information management module is used to configure interface configuration information for the request interface, and configure cache configuration information for the cache processing process corresponding to the request interface;
[0015] The information synchronization module is used to send and synchronize the interface configuration information and the cache configuration information to the cache agents of each service included in the cache grid;
[0016] The cache grid includes a plurality of services and a cache proxy corresponding to each of the plurality of services, wherein the plurality of cache proxies include a first cache proxy and a second cache proxy;
[0017] The first cache proxy is used to receive service request information sent by at least one second cache proxy requesting a service, wherein the service request information includes a uniform resource locator;
[0018] Determine a target request interface corresponding to the uniform resource locator, and if a target cache processing process configured by the target request interface is in an enabled state, call the target cache processing process through the first cache proxy to process the request data in the cache database requested by the service request information;
[0019] The cache database is used to store the request data requested by the service request information.
[0020] In a fourth aspect, an embodiment of the present application provides a storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the above-mentioned data cache processing method.
[0021] The following beneficial effects are achieved by applying the embodiments of the present application: accelerating data access speed through caching to reduce the load pressure on back-end applications and data storage, improving system performance, increasing the number of data reads, reducing storage access pressure, and at the same time, reducing the workload of code development and the workload of maintaining the system platform.
[0022] Because the business request information sent by at least one second cache agent requesting the service is received through the first cache agent of the target service, wherein the business request information includes a uniform resource locator; the target request interface corresponding to the uniform resource locator is determined, and if the target cache processing process configured by the target request interface is in an enabled state, the target cache processing process is called through the first cache agent to process the request data in the cache database requested by the business request information; in this way, by configuring the target cache processing process of the target request interface to be in an enabled state, the target cache processing process is called through the first cache agent to process the request data in the cache database requested by the business request information, thereby achieving faster data access speed through caching, thereby reducing the load pressure of back-end applications and data storage, improving system performance, increasing the number of data reads, reducing storage access pressure, and at the same time, reducing the workload of code development and the workload of maintaining the system platform. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 An optional flow chart of a data cache processing method provided in an embodiment of the present application;
[0024] Figure 2 An optional flow chart of a data cache processing method provided in an embodiment of the present application;
[0025] Figure 3 A schematic diagram of an optional architecture of a cache grid platform provided in an embodiment of the present application;
[0026] Figure 4 An optional structural block diagram of the cache grid platform provided in the embodiment of the present application;
[0027] Figure 5 An optional flow chart of a data cache processing method provided in an embodiment of the present application;
[0028] Figure 6 An optional flow chart of a data cache processing method provided in an embodiment of the present application;
[0029] Figure 7 An optional flow chart of a data cache processing method provided in an embodiment of the present application;
[0030] Figure 8An optional flow chart of a data cache processing method provided in an embodiment of the present application;
[0031] Fig. 9 An optional structural diagram of a data cache processing device provided in an embodiment of the present application;
[0032] Fig.10 An optional structural diagram of a cache grid platform provided in an embodiment of the present application. DETAILED DESCRIPTION
[0033] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0034] It should be understood that the "embodiments of the present application" or "the aforementioned embodiments" mentioned throughout the specification mean that specific features, structures or characteristics related to the embodiments are included in at least one embodiment of the present application. Therefore, "in the embodiments of the present application" or "in the aforementioned embodiments" appearing throughout the specification may not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. In the various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The above-mentioned sequence numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments.
[0035] The present application embodiment provides a data cache processing method applied to a cache grid platform, referring to Figure 1 As shown, the method comprises the following steps:
[0036] Step 101: Receive service request information sent by at least one second cache proxy requesting a service through a first cache proxy of a target service.
[0037] The service request information includes a uniform resource locator.
[0038] In the embodiment of the present application, the cache proxy can be understood as a proxy introduced by the cache grid platform for each service deployment node for the microservice process, so that the cache proxy and the microservice process are bound and deployed. Among them, the cache proxy is used to intercept all business request information of the service, and the cache proxy is also used to forward all business request information of the service. Here, the cache proxy is also called a cache side car proxy, and the service is also called a microservice.
[0039] In an embodiment of the present application, the cache proxy includes a network proxy, which is responsible for basic network communication functions such as service registration, service discovery, and service governance in a microservice environment, so that the microservice itself no longer needs to focus on the basic capabilities of network communication.
[0040] In the embodiment of the present application, the first cache agent is an agent for receiving business request information, the second cache agent is an agent for sending business request information, and there can be multiple second cache agents that send business request information, and the first cache agent and multiple second cache agents are connected through networking to form a mesh communication grid in the cache grid platform. Here, the first cache agent and the service corresponding to the first cache agent, and at least one first cache agent and the service corresponding to the first cache agent constitute a cache grid, and the cache grid platform includes a cache grid (Cache Mesh).
[0041] In the embodiment of the present application, the service request information is request information for at least one request service to obtain request data associated with the service from the target service. The service request information includes a uniform resource locator, which is a representation method for specifying the location of information on the World Wide Web service program of the Internet.
[0042] In an embodiment of the present application, the cache grid platform receives business request information sent by at least one second cache agent requesting a service through a first cache agent of the target service, and parses the business request information through the second cache agent to obtain a uniform resource locator included in the business request information, so that the first cache agent processes it according to the uniform resource locator.
[0043] In an achievable application scenario, in the process of building a cache grid platform, the present application uses a service grid as the infrastructure layer of the microservice technology architecture in the cache grid platform, thereby making network communication and other functions in the cache grid platform more flexible, more reliable and faster.
[0044] Step 102: determine the target request interface corresponding to the uniform resource locator. If the target cache processing process configured by the target request interface is in an enabled state, call the target cache processing process through the first cache proxy to process the request data in the cache database requested by the business request information.
[0045] In the embodiment of the present application, each service provides multiple request interfaces to the outside, and the cache management center in the cache grid platform configures corresponding interface configuration information and cache configuration information for each request interface. It should be noted that the interface configuration information includes the usage status of the cache processing process configured for the request interface; wherein the usage status of the cache processing process includes an enabled state and a disabled state.
[0046] In the embodiment of the present application, the cache database is a database that stores data in the form of key-value pairs, wherein the cache database is also called a cache storage cluster.
[0047] In the embodiment of the present application, when the cache grid platform receives the business request information sent by at least one second cache agent requesting the service through the first cache agent of the target service, the first cache agent is used to obtain the uniform resource locator included in the business request information, and the target request interface corresponding to the uniform resource locator is determined based on the uniform resource locator. Further, the target interface configuration information configured for the target request interface by the cache management center in the cache grid platform is obtained through the first cache agent, and the target interface configuration information includes that the use status of the target cache processing process configured for the target request interface is in the enabled state, and the target cache processing process is called through the first cache agent to enable the target cache processing process to process the request data in the cache database requested by the business request information.
[0048] An embodiment of the present application provides a data cache processing method, which receives business request information sent by at least one second cache agent of a request service through a first cache agent of a target service, wherein the business request information includes a uniform resource locator; determines a target request interface corresponding to the uniform resource locator, and if a target cache processing process configured by the target request interface is in an enabled state, calls the target cache processing process through the first cache agent to process the request data in the cache database requested by the business request information; in this way, by configuring the target cache processing process of the target request interface to be in an enabled state, calling the target cache processing process through the first cache agent to process the request data in the cache database requested by the business request information, it is achieved that the access speed of data is accelerated through caching, so as to reduce the load pressure of back-end applications and data storage, improve system performance, increase the number of data reads, reduce the access pressure of storage, and at the same time, reduce the workload of code development and the workload of maintaining the system platform.
[0049] The present application embodiment provides a data cache processing method applied to a cache grid platform, referring to Figure 2 As shown, the method comprises the following steps:
[0050] Step 201: Receive service request information sent by at least one second cache proxy requesting a service through a first cache proxy of a target service.
[0051] The service request information includes a uniform resource locator.
[0052] Step 202: parse the uniform resource locator to determine the transmission protocol and corresponding interface path used by the uniform resource address.
[0053] In the embodiment of the present application, the transmission protocol is the rule for mutual communication between the browser and the World Wide Web server, and is a data transmission protocol for transmitting World Wide Web documents through the Internet. The transmission protocol includes the transmission protocol type and the method requested in the transmission protocol; here, the transmission protocol type includes Hypertext transfer protocol (http), Secure Hypertext transfer protocol (https) and Real-time Transport Protocol (RTP); the transmission protocol type also includes Transmission Control Protocol (TCP) and Remote Procedure Call (RPC); the method requested in the transmission protocol includes GET request method, POST request method, PUT request method and DELETE request method; among them, GET is used to obtain or query data resource information, POST is used to update data resource information, PUT is used to add data resource information, and DELETE is used to delete data resource information. It should be noted that this application does not make specific restrictions on the transmission protocol.
[0054] In the embodiment of the present application, the interface path is the location information of the interface provided by the cache grid platform for the service.
[0055] In an embodiment of the present application, the cache management center in the cache grid platform configures corresponding interface configuration information and cache configuration information for each request interface, wherein the interface configuration information includes an interface identifier (Identity document, ID), a service identifier (service ID), an interface name, a transmission protocol, an interface path, metadata configuration rules, the usage status of the cache processing process, and a cache event type. The cache configuration information includes a serial number, an interface identifier, a cache event type, a cache service identifier, a business primary key construction rule, and a tenant identifier (tenantid). It should be noted that there is a one-to-one correspondence between the interface configuration information and the cache configuration information. Exemplarily, as shown in Table 1,
[0056]
[0057] In the embodiment of the present application, the cache management center of the cache grid platform configures corresponding interface configuration information and cache configuration information for each request interface to achieve the purpose of decoupling the cache logic from the business service logic, thereby achieving complete independence of the cache capability of each request interface and the deployment of each request interface, which is completely transparent and imperceptible to the business service, so that the business service development no longer needs to pay attention to cache-related logic, thereby speeding up the access speed of data, reducing the load pressure on the back-end application and data storage, improving the performance of the system, increasing the number of data reads, and reducing the access pressure on the storage; at the same time, it is achieved that the interface configuration information and cache configuration information of the business can be dynamically updated in the cache management center without stopping the service process.
[0058] In other embodiments of this application, refer to Figure 3 and Figure 4 As shown, Figure 3 FIG. 1 is a schematic diagram of an optional architecture of a cache grid platform provided in an embodiment of the present application. Figure 4 The illustrated embodiment of the present application provides a cache grid platform of an optional structural block diagram wherein the cache grid platform 4 comprises a cache management center 41, a cache grid 42 and a cache database 43, wherein the cache database 43 is also called a cache storage cluster.
[0059] The cache management center 41 is a centralized cache management service that implements the overall management and configuration of the cache grid. The cache management center 41 includes a cache telemetry processing module 411, an information management module 412, an information synchronization module 413, a cache statistics monitoring module 414, and a node deployment management module 415. Among them, the cache telemetry processing module 411 is used to uniformly monitor and manage the operation status, heartbeat and other telemetry data of each service system uploaded by the cache agent, so as to determine the communication status of each cache node according to the telemetry data, and then control the use status of the cache processing process of the service corresponding to each request interface based on the communication status of each cache node, so as to ensure the operation capability of the service. The information management module 412 is used to manage the configuration of interface configuration information for the request interface of each service, and the configuration of cache configuration information for the cache processing process corresponding to the request interface. The information synchronization module 413 is used to send and synchronize the interface configuration information and cache configuration information to the cache agents of each service included in the cache grid 42. The cache statistics monitoring module 414 is used to monitor the cached data information. The node deployment management module 415 is used to deploy and manage the nodes in the cache grid.
[0060] The cache grid 42 includes multiple services (also called microservices) and cache proxies corresponding to each of the multiple services, wherein the multiple cache proxies include a first cache proxy and a second cache proxy. The service node where each service is located adopts the deployment method of the cache proxy, and the cache proxy and the microservice process are bound and deployed, wherein the cache proxy is used to receive all network requests of the microservice process, and the network proxy in the cache proxy is responsible for basic network communication functions such as service registration, service discovery, and service governance in the microservice environment, so that the microservice itself no longer pays attention to the basic capabilities of network communication. In addition, the cache grid adds interface configuration information and cache configuration information for the request interface configuration in the cache proxy of each service. The cache proxy judges the request business information through the interface configuration information and the cache configuration information. If the request business information hits the request data in the cache database, the cache proxy directly returns the request data without the service being aware, that is, no longer requests the microservice.
[0061] It should be noted that in a microservice architecture, there are many service nodes, and each cache proxy has interface configuration information and cache configuration information for each request interface. Among them, the interface configuration information and cache configuration information for each request interface in the cache proxy can also be obtained in the following three ways:
[0062] Method 1: When the service node is deployed and started, the cache proxy pulls the corresponding interface configuration information and cache configuration information from the cache configuration center according to the deployed service ID or application ID to complete the initialization loading of the cache configuration of this service node.
[0063] Method 2: The cache proxy can access the cache configuration center at fixed intervals based on the service ID or application ID to pull the latest interface configuration information and cache configuration information.
[0064] Method 3: Each time the cache configuration center updates the interface configuration information and cache configuration information, it pushes the latest interface configuration information and cache configuration information to the cache proxy based on the service ID or application ID, service Internet Protocol (IP) and other information. In this way, it is ensured that the management and distribution of configuration information is achieved through the centralized cache management center. When the interface configuration information and / or cache configuration information in the cache management center changes, there is no need to restart the cache proxy. The cache proxy can pull the latest interface configuration information and cache configuration information from the cache management center to complete dynamic configuration and dynamic update. In addition, the cache proxy will also report the operation status of each service system, heartbeat and other telemetry data to the cache management center for unified management and monitoring.
[0065] The cache database 43 is also called a cache storage cluster. The cache storage cluster serves as the cache storage layer of the cache grid. Each service node's cache proxy has a cache storage adapter interface, and operations on cache data in the cache storage cluster are implemented through the interface.
[0066] In an embodiment of the present application, the cache grid platform receives business request information sent by at least one second cache agent requesting a service through a first cache agent of the target service, parses the uniform resource locator in the business request information, and determines the transmission protocol and corresponding interface path adopted by the uniform resource address.
[0067] In other embodiments of the present application, the cache grid platform embeds a WebAssembly engine in the service of each cache proxy, and defines a general extended application programming interface (Application Programming Interface, API) inside the cache proxy to interact with it. The cache management center can dynamically encode and expand each environment for cache processing by the cache proxy, theoretically supporting all development languages, and finally sending the development language to the cache proxy service in the form of WASM bytecode. Through the WASM engine, the code logic can be dynamically switched without stopping the service, ensuring that the cache capability is efficient, dynamic, flexible, and configurable, and supporting microservice scenarios for multiple development languages and cross-technology stacks, and can realize dynamic configuration of the cache function without restarting the service, making the cache function truly a universal infrastructure capability, making the cache capability completely transparent and imperceptible to the business logic, greatly reducing the development, deployment and maintenance costs of the service cache function.
[0068] Here, WebAssembly (WASM) is a front-end technology used to solve the performance problems of front-end scripting languages. WASM is a bytecode standard. WASM technology can compile the bytecode compiled by the execution language through the WASM engine (similar in function to the JAVA virtual machine) into machine code across CPU architectures to achieve cross-platform capabilities.
[0069] Step 203: Determine a target request interface that matches the transmission protocol and the interface path.
[0070] In the embodiment of the present application, the cache grid platform determines the target request interface that matches the transmission protocol and the interface path through the first cache agent.
[0071] Step 204: Obtain target interface configuration information configured by the cache management center for the target request interface.
[0072] In the embodiment of the present application, the target interface configuration information is the interface information configured by the cache management center for the target request interface. The target interface configuration information includes but is not limited to the interface name, transmission protocol, interface path, metadata configuration rules and the usage status of the cache processing process.
[0073] Step 205: If it is determined based on the target interface configuration information that the target cache processing process configured by the target request interface is in an enabled state, obtain the target cache configuration information configured by the cache management center for the target cache processing process.
[0074] In the embodiment of the present application, the target cache configuration information is the cache information configured by the cache management center for the target cache processing process. The target cache configuration information includes but is not limited to the interface identifier, cache event type, cache service identifier, and business primary key construction rules.
[0075] In an embodiment of the present application, if the cache management platform determines, based on the target interface configuration information, that the usage status of the target cache processing process configured by the target request interface is in an enabled state, the target cache configuration information configured by the cache management center for the target cache processing process is obtained.
[0076] Step 206: Based on the target interface configuration information and the target cache configuration information, the target cache processing process is called through the first cache proxy to process the request data in the cache database requested by the business request information.
[0077] In the present application, refer to Figure 5 As shown, step 206, based on the target interface configuration information and the target cache configuration information, calls the target cache processing process through the first cache proxy to process the request data in the cache database requested by the business request information, which can be implemented by the following steps:
[0078] Step 2061: Obtain the metadata configuration rules configured by the cache management center for the target request interface, and the business primary key construction rules configured for the target cache processing process.
[0079] The target interface configuration information includes metadata configuration rules, and the target cache configuration information includes business primary key construction rules.
[0080] In the embodiment of the present application, the metadata configuration rule is a rule set for extracting the business data included in the business request information. Here, if the business data is transmitted in the form format, the metadata configuration rule includes a rule for extracting the business data transmitted in the form format; if the business data is transmitted in the uniform resource locator, the metadata configuration rule includes a rule for extracting the business data transmitted in the uniform resource locator. Exemplarily, the format of the business data in the business request information included in the uniform resource locator for transmission can be http / GET / api / CacheMesh / test?orderid=123, where the business data is orderid=123.
[0081] In the embodiment of the present application, the business primary key construction rule is used to construct the business primary key setting rule, and illustratively, the business primary key construction rule may be key_+#id, wherein key represents the business, and id represents the object identifier of the object to be operated corresponding to the business.
[0082] In the embodiment of the present application, the cache management center in the cache grid platform is configured with corresponding target interface configuration information and target cache configuration information for the target request interface, and the target interface configuration information includes metadata configuration rules, and the target cache configuration information includes business primary key construction rules. At this time, the cache grid platform obtains the metadata configuration rules in the target interface configuration information configured by the cache management center for the target request interface, and obtains the business primary key construction rules in the target cache configuration information configured for the target cache processing process.
[0083] Step 2062: extract business metadata from the business request information according to the metadata configuration rule.
[0084] Step 2063: Construct the business primary key of the business metadata according to the business primary key construction rule.
[0085] In an embodiment of the present application, after the cache grid platform obtains the metadata configuration rules configured by the cache management center for the target request interface and the business primary key construction rules configured for the target cache processing process through the first cache agent, the cache grid platform extracts business metadata from the business request information according to the metadata configuration rules through the first cache agent, and constructs the business primary key of the business metadata according to the business primary key construction rules.
[0086] In an achievable application scenario, taking the business data included in the business request information being transmitted in the uniform resource locator as an example, http / GET / api / CacheMesh / test? orderid=123 is used to query the order with id=123; http / GET / api / CacheMesh / test? productid=123 is used to query the product with id=123. At this time, the cache grid platform extracts the business metadata from the business request information through the first cache proxy according to the metadata configuration rule, and obtains the business metadata of the order business as orderid=123, and the business metadata of the product business as productid=123; further, the cache grid platform constructs the business primary key of the business metadata corresponding to the order business as order_+#123 and the business primary key of the business metadata corresponding to the product business as product_+#123 through the first cache proxy according to the business primary key rule.
[0087] Step 2064: Call the target cache processing process through the first cache proxy to process the requested data in the cache database based on the business primary key.
[0088] In the embodiment of the present application, processing the request data in the cache database based on the business primary key includes: querying the request data in the cache database based on the business primary key, or deleting the request data in the cache database.
[0089] In the embodiment of the present application, step 2064 calls the target cache processing process through the first cache proxy to process the request data in the cache database based on the business primary key, which can be implemented in the following two ways:
[0090] Method 1: If the cache event type configured by the cache management center for the target cache processing process is a cache write type, the target cache processing process is called through the first cache proxy to search for request data corresponding to the business primary key from the cache database.
[0091] The target cache configuration information includes the cache event type.
[0092] In the embodiment of the present application, the cache write type can be expressed as Cacheable.
[0093] In an embodiment of the present application, if the cache event type configured by the cache management center for the target cache processing process is a cache write type, the target cache processing process is called through the first cache agent, and the request data corresponding to the business primary key is found from the cache database, that is, a cache hit; at the same time, the first cache agent sends the request data for the business request information to the second cache agent; in this way, the first cache agent hits the cache data in the cache database through the business primary key request, and directly obtains the request data for the business request information in the cache database, and no longer requests the target service, that is, the target service is unaware. At the same time, the higher the cache hit rate of the cache data in the cache database, the higher the cache utilization rate.
[0094] Method 2: If the cache event type configured by the cache management center for the target cache processing process is a cache cleaning type, the target cache processing process is called through the first cache proxy to delete the request data corresponding to the business primary key from the cache database.
[0095] In the embodiment of the present application, the cache cleaning type can be expressed as CacheEvict.
[0096] In the present application, refer to Figure 6 As shown, step 2064 calls the target cache processing process through the first cache proxy to process the request data in the cache database based on the business primary key, which can be achieved through the following steps:
[0097] Step A1: If the target cache processing process is called through the first cache proxy, and the request data corresponding to the business primary key is not found in the cache database, a first call request is sent to the target service through the first cache proxy.
[0098] The first call request is used to request to call the target service and search for request data corresponding to the business primary key from the relational database.
[0099] In the embodiment of the present application, the priority of the cache database is higher than the priority of the relational database.
[0100] In an embodiment of the present application, after the cache grid platform determines the business primary key of the business metadata through the first cache agent, it first calls the target cache processing process through the first cache agent to search for request data corresponding to the business primary key from a cache database with a high priority. If the request data corresponding to the business primary key is not found in the cache database, the first cache agent is sent to the target service to request to call the target service, so that the target service searches for the first call request for the request data corresponding to the business primary key from the relational data.
[0101] Step A2: Receive request data fed back by the target service in response to the first call request.
[0102] In an embodiment of the present application, after the cache grid platform sends a first call request to the target service through the first cache proxy, the target service searches for request data corresponding to the business primary key from the relational data based on the first call request, and sends the request data obtained for the first call request to the first cache proxy; the cache grid platform receives the request data fed back by the target service for the first call request through the first cache proxy, and at the same time, the first cache proxy sends the request data for the business request information to the second cache proxy.
[0103] Step A3: Send the request data to the cache database to store the request data in the cache database.
[0104] In the embodiment of the present application, after receiving the request data fed back by the target service for the first call request through the first cache proxy, the cache grid platform sends the request data to the cache database to store the request data in the cache database.
[0105] As can be seen from the above, the present application sets interface configuration information and cache configuration information for each request interface, and then obtains the business primary key in the business request information based on the transmission protocol, interface path, metadata configuration rules, target cache processing process usage status and cache event type in the interface configuration information, and the business primary key construction rules in the cache configuration information; and first searches for the request data corresponding to the business primary key from the cache database with a high priority based on the business primary key; if the request data corresponding to the business primary key is not found in the cache database, the target service will be further requested to be called, so that the target service searches for the request data corresponding to the business primary key from the relational database. In this way, the access speed of data is accelerated by caching first, so as to reduce the load pressure of back-end applications and data storage, improve the performance of the system, increase the number of data reads, reduce the access pressure of storage, and at the same time, let limited resources serve more users; further, it is realized that the interface configuration information and cache configuration information of the business can be dynamically updated in the cache management center without stopping the service process.
[0106] The present application embodiment provides a data cache processing method applied to a cache grid platform, referring to Figure 7 As shown, the method comprises the following steps:
[0107] Step 301: Receive service request information sent by at least one second cache proxy requesting a service through a first cache proxy of a target service.
[0108] The service request information includes a uniform resource locator.
[0109] Step 302: parse the uniform resource locator to determine the transmission protocol and corresponding interface path used by the uniform resource address.
[0110] Step 303: Determine a target request interface that matches the transmission protocol and the interface path.
[0111] Step 304: Obtain target interface configuration information configured by the cache management center for the target request interface.
[0112] Step 305: If it is determined based on the target interface configuration information that the target cache processing process configured for the target request interface is in a disabled state, a second call request is sent to the target service through the first cache proxy.
[0113] The second call request is used to request to call the target service and search for request data corresponding to the business request information from the relational database.
[0114] Step 306: Receive request data fed back by the target service in response to the second call request.
[0115] In an embodiment of the present application, the cache grid platform receives business request information sent by at least one second cache proxy requesting a service through a first cache proxy, parses the uniform resource locator included in the business request information, and determines the transmission protocol and corresponding interface path adopted by the uniform resource address; further, if the target cache processing process configured by the target request interface is in a disabled state, a second call request is sent to the target service through the first cache proxy; then, the target service searches for request data corresponding to the business request information from the relational data based on the second call request, and sends the request data obtained for the second call request to the first cache proxy, and sends the request data for the business request information to the second cache proxy through the first cache proxy. In this way, when the target cache processing process configured by the target request interface is in a disabled state and cannot obtain cache data from the cache database, the cache grid platform sends a second call request to the target service through the first cache proxy, so that the target service searches for request data corresponding to the business request information from the relational database.
[0116] The present application embodiment provides a data cache processing method applied to a cache grid platform, referring to Figure 8 As shown, the method includes the following steps 401 to 404; or steps 401 to 403, and steps 405 to 408; or steps 401 to 403, steps 405 to 407, and step 409; or steps 401 to 403, step 405, and step 410:
[0117] Step 401: Receive service request information sent by at least one second cache proxy requesting a service through a first cache proxy of a target service.
[0118] The service request information includes a uniform resource locator.
[0119] Step 402: parse the uniform resource locator, determine the transmission protocol and corresponding interface path adopted by the uniform resource address, and determine the target request interface that matches the transmission protocol and interface path.
[0120] Step 403: Determine whether the cache management center has configured the target interface configuration information for the target request interface.
[0121] In an embodiment of the present application, if the cache grid platform determines through the first cache agent that the cache management center has not configured the target request interface with target interface configuration information, step 404 is executed; if it is determined that the cache management center has configured the target request interface with target interface configuration information, step 405 is executed.
[0122] Step 404: Send a second call request to the target service through the first cache proxy, and receive request data fed back by the target service in response to the second call request.
[0123] The second call request is used to request to call the target service and search for request data corresponding to the business request information from the relational database.
[0124] Step 405: If, based on the target interface configuration information, it is determined that the target cache processing process configured by the target request interface is in an enabled state, obtain the target cache configuration information configured by the cache management center for the target cache processing process, and determine the cache event type configured by the cache management center for the target cache processing process based on the target cache configuration information.
[0125] The target cache configuration information includes the cache event type.
[0126] Step 406: If the cache event type configured by the cache management center for the target cache processing process is a cache write type, obtain the metadata configuration rules in the target interface configuration information and the business primary key construction rules in the target cache configuration information; extract the business metadata from the business request information according to the metadata configuration rules; and construct the business primary key of the business metadata according to the business primary key construction rules.
[0127] The target interface configuration information includes metadata configuration rules, and the target cache configuration information includes business primary key construction rules.
[0128] Step 407: Call the target cache processing process through the first cache proxy to determine whether the requested data for the business primary key exists in the cache database.
[0129] In an embodiment of the present application, if the cache grid platform calls the target cache processing process through the first cache agent and determines that the request data for the business primary key in the cache database exists, step 408 is executed; if the cache grid platform calls the target cache processing process through the first cache agent and determines that the request data for the business primary key in the cache database does not exist, step 409 is executed.
[0130] Step 408: Search the cache database for request data corresponding to the business primary key, and send the request data for the business request information to the second cache agent.
[0131] Step 409: Send a first call request to the target service through the first cache proxy, and receive request data fed back by the target service in response to the first call request.
[0132] The first call request is used to request to call the target service and search for request data corresponding to the business primary key from the relational database.
[0133] Step 410: If the cache event type configured by the cache management center for the target cache processing process is a cache clearing type, obtain the metadata configuration rules in the target interface configuration information and the business primary key construction rules in the target cache configuration information; extract the business metadata from the business request information according to the metadata configuration rules; construct the business primary key of the business metadata according to the business primary key construction rules, call the target cache processing process, and delete the request data corresponding to the business primary key from the cache database.
[0134] The target interface configuration information includes metadata configuration rules, and the target cache configuration information includes business primary key construction rules.
[0135] From the above, it can be seen that the present application realizes the acceleration of data access through caching first, so as to reduce the load pressure of back-end applications and data storage, improve the performance of the system, increase the number of data reads, reduce the access pressure of storage, and at the same time, allow limited resources to serve more users; further, it realizes that the interface configuration information and cache configuration information of the service can be dynamically updated in the cache management center without stopping the service process.
[0136] It should be noted that, for the description of the same steps and the same contents in this embodiment as those in other embodiments, reference can be made to the description in other embodiments and will not be repeated here.
[0137] The present invention provides a data cache processing device, which can be applied to Figure 1-2 , Figure 5 to Figure 7 In a data cache processing method provided in a corresponding embodiment, referring to Fig. 9 As shown, the data cache processing device 9 includes:
[0138] The receiving module 901 is configured to receive, through a first cache proxy for a target service, service request information sent by at least one second cache proxy for a request service, wherein the service request information includes a uniform resource locator;
[0139] A determination module 902 is used to determine a target request interface corresponding to the uniform resource locator;
[0140] The processing module 903 is used to call the target cache processing process through the first cache agent to process the request data in the cache database requested by the business request information if the target cache processing process configured by the target request interface is in an enabled state.
[0141] In other embodiments of the present application, the data cache processing device 9 also includes an acquisition module, which is used to obtain target interface configuration information configured by the cache management center for the target request interface; if it is determined based on the target interface configuration information that the target cache processing process configured for the target request interface is in an enabled state, the target cache configuration information configured by the cache management center for the target cache processing process is obtained; the processing module 903 is also used to call the target cache processing process through the first cache agent based on the target interface configuration information and the target cache configuration information, and process the request data in the cache database requested by the business request information.
[0142] In other embodiments of the present application, the acquisition module is also used to obtain the metadata configuration rules configured by the cache management center for the target request interface and the business primary key construction rules configured for the target cache processing process, wherein the target interface configuration information includes the metadata configuration rules, and the target cache configuration information includes the business primary key construction rules; according to the metadata configuration rules, the business metadata is extracted from the business request information; according to the business primary key construction rules, the business primary key of the business metadata is constructed; and the target cache processing process is called through the first cache agent, and the request data in the cache database is processed based on the business primary key.
[0143] In other embodiments of the present application, processing module 903 is also used to call the target cache processing process through the first cache agent if the cache event type configured by the cache management center for the target cache processing process is a cache write type, and search the cache database for request data corresponding to the business primary key, wherein the target cache configuration information includes the cache event type.
[0144] In other embodiments of the present application, the processing module 903 is also used to call the target cache processing process through the first cache agent to delete the request data corresponding to the business primary key from the cache database if the cache event type configured by the cache management center for the target cache processing process is a cache clearing type.
[0145] In other embodiments of the present application, the processing module 903 is also used to send a first call request to the target service through the first cache proxy if the target cache processing process is called through the first cache proxy and the request data corresponding to the business primary key is not found from the cache database; wherein the first call request is used to request to call the target service and search for the request data corresponding to the business primary key from the relational database; the receiving module 901 is also used to receive the request data fed back by the target service for the first call request; the sending module is used to send the request data to the cache database to store the request data in the cache database.
[0146] In other embodiments of the present application, the processing module 903 is also used to send a second call request to the target service through the first cache agent if it is determined based on the target interface configuration information that the target cache processing process configured for the target request interface is in a disabled state, wherein the second call request is used to request to call the target service and search for request data corresponding to the business request information from the relational database; the receiving module 901 is also used to receive request data fed back by the target service for the second call request.
[0147] In other embodiments of the present application, the processing module 903 is also used to parse the uniform resource locator to determine the transmission protocol and corresponding interface path adopted by the uniform resource address; the determination module 902 is also used to determine the target request interface that matches the transmission protocol and interface path.
[0148] The present application embodiment provides a cache grid platform, which can be used to implement Figure 1-2 , Figure 5 to Figure 7 A data cache processing method provided by the corresponding embodiment, referring to Fig.10 As shown, the cache grid platform 4 includes: a cache management center 41, a cache grid 42 and a cache database 43; the cache management center 41 includes an information management module 411 and an information synchronization module 412;
[0149] The information management module 411 is used to configure interface configuration information for the request interface, and configure cache configuration information for the cache processing process corresponding to the request interface; the information synchronization module 412 is used to send and synchronize the interface configuration information and the cache configuration information to the cache agents of each service included in the cache grid;
[0150] The cache grid 42 includes a plurality of services and a cache proxy corresponding to each of the plurality of services, wherein the plurality of cache proxies include a first cache proxy and a second cache proxy;
[0151] The first cache proxy is used to receive business request information sent by at least one second cache proxy requesting a service, wherein the business request information includes a uniform resource locator;
[0152] Determine a target request interface corresponding to the uniform resource locator, and if a target cache processing process configured by the target request interface is in an enabled state, call the target cache processing process through a first cache proxy to process request data in a cache database requested by the business request information;
[0153] The cache database is used to store the request data requested by the service request information.
[0154] Based on the foregoing embodiments, an embodiment of the present application provides a computer storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the following steps:
[0155] Receiving, through a first cache proxy for a target service, service request information sent by at least one second cache proxy for a request service, wherein the service request information includes a uniform resource locator;
[0156] Determine the target request interface corresponding to the uniform resource locator, and if the target cache processing process configured by the target request interface is in an enabled state, call the target cache processing process through the first cache proxy to process the request data in the cache database requested by the business request information.
[0157] In other embodiments of the present application, the one or more programs may be executed by one or more processors, and the following steps may also be implemented:
[0158] Obtain target interface configuration information configured by the cache management center for the target request interface; if, based on the target interface configuration information, it is determined that the target cache processing process configured by the target request interface is in an enabled state, obtain target cache configuration information configured by the cache management center for the target cache processing process; based on the target interface configuration information and the target cache configuration information, call the target cache processing process through the first cache agent to process the request data in the cache database requested by the business request information.
[0159] In other embodiments of the present application, the one or more programs may be executed by one or more processors, and the following steps may also be implemented:
[0160] Obtain metadata configuration rules configured by the cache management center for the target request interface and business primary key construction rules configured for the target cache processing process, wherein the target interface configuration information includes metadata configuration rules, and the target cache configuration information includes business primary key construction rules; extract business metadata from the business request information according to the metadata configuration rules; construct a business primary key for the business metadata according to the business primary key construction rules; call the target cache processing process through the first cache agent, and process the request data in the cache database based on the business primary key.
[0161] In other embodiments of the present application, the one or more programs may be executed by one or more processors, and the following steps may also be implemented:
[0162] If the cache event type configured by the cache management center for the target cache processing process is a cache write type, the target cache processing process is called through the first cache agent to search the cache database for request data corresponding to the business primary key, wherein the target cache configuration information includes the cache event type.
[0163] In other embodiments of the present application, the one or more programs may be executed by one or more processors, and the following steps may also be implemented:
[0164] If the cache event type configured by the cache management center for the target cache processing process is a cache cleaning type, the target cache processing process is called through the first cache proxy to delete the request data corresponding to the business primary key from the cache database.
[0165] In other embodiments of the present application, the one or more programs may be executed by one or more processors, and the following steps may also be implemented:
[0166] If the target cache processing process is called through the first cache proxy, and the request data corresponding to the business primary key is not found in the cache database, a first call request is sent to the target service through the first cache proxy; wherein the first call request is used to request to call the target service, and to search for the request data corresponding to the business primary key from the relational database; receive the request data fed back by the target service for the first call request; and send the request data to the cache database to store the request data in the cache database.
[0167] In other embodiments of the present application, the one or more programs may be executed by one or more processors, and the following steps may also be implemented:
[0168] If it is determined based on the target interface configuration information that the target cache processing process configured by the target request interface is in a disabled state, a second call request is sent to the target service through the first cache agent, wherein the second call request is used to request a call to the target service, and to search for request data corresponding to the business request information from the relational database; and the request data fed back by the target service in response to the second call request is received.
[0169] In other embodiments of the present application, the one or more programs may be executed by one or more processors, and the following steps may also be implemented:
[0170] Parse the uniform resource locator, determine the transmission protocol and corresponding interface path adopted by the uniform resource address; determine the target request interface that matches the transmission protocol and interface path.
[0171] It should be noted that the above-mentioned computer storage medium / memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory (Flash Memory), a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM) and other memories; it can also be various terminals including one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.
[0172] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0173] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0174] In addition, all functional units in the embodiments of the present application can be integrated into one processing module, or each unit can be a separate unit, or two or more units can be integrated into one unit; the above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units. A person of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium, which, when executed, executes the steps of the above method embodiments; and the aforementioned storage medium includes: mobile storage devices, read-only memory (ROM), random access memory (RAM), disks or optical disks, and other media that can store program codes.
[0175] The features disclosed in several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0176] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A data cache processing method, characterized in that: The method comprises: Receiving, through a first cache proxy for a target service, service request information sent by at least one second cache proxy for a request service, wherein the service request information includes a uniform resource locator; Determine a target request interface corresponding to the uniform resource locator, and if a target cache processing process configured by the target request interface is in an enabled state, call the target cache processing process through the first cache proxy to process the request data in the cache database requested by the business request information; Wherein, if the target cache processing process configured by the target request interface is in an enabled state, calling the target cache processing process through the first cache proxy to process the request data in the cache database requested by the business request information includes: If, based on the target interface configuration information configured by the cache management center for the target request interface, it is determined that the target cache processing process configured by the target request interface is in an enabled state, the target cache processing process is called through the first cache agent to process the request data in the cache database requested by the business request information.
2. The method according to claim 1, characterized in that If the target cache processing process configured by the target request interface is in an enabled state, calling the target cache processing process through the first cache proxy to process the request data in the cache database requested by the business request information includes: Obtain target interface configuration information configured by a cache management center for the target request interface; If it is determined based on the target interface configuration information that the target cache processing process configured by the target request interface is in an enabled state, obtaining the target cache configuration information configured by the cache management center for the target cache processing process; Based on the target interface configuration information and the target cache configuration information, the target cache processing process is called through the first cache agent to process the request data in the cache database requested by the service request information.
3. The method according to claim 2, characterized in that The calling the target cache processing process through the first cache agent based on the target interface configuration information and the target cache configuration information to process the request data in the cache database requested by the service request information includes: Obtaining the metadata configuration rules configured by the cache management center for the target request interface and the business primary key construction rules configured for the target cache processing process, wherein the target interface configuration information includes the metadata configuration rules, and the target cache configuration information includes the business primary key construction rules; Extracting service metadata from the service request information according to the metadata configuration rule; Constructing the business primary key of the business metadata according to the business primary key construction rule; The target cache processing process is called through the first cache proxy to process the request data in the cache database based on the business primary key.
4. The method according to claim 3, characterized in that The calling the target cache processing process through the first cache proxy and processing the request data in the cache database based on the business primary key includes: If the cache event type configured by the cache management center for the target cache processing process is a cache write type, the target cache processing process is called through the first cache agent to search the cache database for the request data corresponding to the business primary key, wherein the target cache configuration information includes the cache event type.
5. The method according to claim 4, characterized in that The method further comprises: If the cache event type configured by the cache management center for the target cache processing process is a cache cleaning type, the target cache processing process is called through the first cache agent to delete the request data corresponding to the business primary key from the cache database.
6. The method according to claim 3, characterized in that The calling the target cache processing process through the first cache proxy and processing the request data in the cache database based on the business primary key includes: If the target cache processing process is called through the first cache proxy, and the request data corresponding to the business primary key is not found in the cache database, a first call request is sent to the target service through the first cache proxy; wherein the first call request is used to request to call the target service and find the request data corresponding to the business primary key from the relational database; Receiving the request data fed back by the target service in response to the first call request; The request data is sent to the cache database to store the request data in the cache database.
7. The method according to claim 2, characterized in that The method further comprises: If it is determined based on the target interface configuration information that the target cache processing process configured by the target request interface is in a disabled state, a second call request is sent to the target service through the first cache proxy, wherein the second call request is used to request to call the target service and search for request data corresponding to the business request information from a relational database; The request data fed back by the target service in response to the second call request is received.
8. The method according to any one of claims 1 to 7, characterized in that: The determining of the target request interface corresponding to the uniform resource locator includes: Parsing the uniform resource locator to determine the transmission protocol and corresponding interface path adopted by the uniform resource address; The target request interface that matches the transport protocol and the interface path is determined.
9. A data cache processing device, characterized in that: The device comprises: A receiving module, configured to receive, through a first cache proxy for a target service, service request information sent by at least one second cache proxy for a request service, wherein the service request information includes a uniform resource locator; A determination module, used for determining a target request interface corresponding to the uniform resource locator; A processing module is used to determine that the target cache processing process configured for the target request interface is in an enabled state based on the target interface configuration information configured by the cache management center for the target request interface, and to call the target cache processing process through the first cache agent to process the request data in the cache database requested by the business request information.
10. A cache grid platform, characterized in that: The cache grid platform includes: a cache management center, a cache grid and a cache database; the cache management center includes an information management module and an information synchronization module; Wherein, the information management module is used to configure interface configuration information for the request interface, and configure cache configuration information for the cache processing process corresponding to the request interface; The information synchronization module is used to send and synchronize the interface configuration information and the cache configuration information to the cache agents of each service included in the cache grid; The cache grid includes a plurality of services and a cache proxy corresponding to each of the plurality of services, wherein the plurality of cache proxies include a first cache proxy and a second cache proxy; The first cache proxy is used to receive service request information sent by at least one second cache proxy requesting a service, wherein the service request information includes a uniform resource locator; Determine a target request interface corresponding to the uniform resource locator, and if it is determined that a target cache processing process configured for the target request interface is in an enabled state based on target interface configuration information configured for the target request interface by a cache management center, call the target cache processing process through the first cache proxy to process request data in a cache database requested by the service request information; The cache database is used to store the request data requested by the service request information.
11. A storage medium, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the data cache processing method according to any one of claims 1 to 8.
