Request processing method and apparatus
By receiving data retrieval requests, determining the validity and expiration conditions of target data in the cache, obtaining and saving the second target data, and reasonably managing the cache lifecycle, the problem of cached data failing to meet the different timeliness requirements of multiple applications is solved, achieving efficient data support and resource management.
Patent Information
- Application Number
- CN202411432271.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2044-10-14
AI Technical Summary
In existing technologies, cached data cannot meet the different timeliness requirements of multiple applications, leading to errors in application business functions.
By receiving data retrieval requests, determining their expiration conditions, judging whether the target data exists in the cache and whether its cache time meets the expiration conditions, if not, retrieving and returning the second target data from the data source, and determining the cache retention time based on the expiration information of the associated application, thus reasonably managing the cache lifecycle.
It reduced application business function errors, improved data return efficiency, saved on external data source acquisition costs, managed cache resources effectively, and provided better data support.
Smart Images

Figure CN119376623B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of big data processing technology, and in particular to a request processing method and apparatus. Background Technology
[0002] A cache is a storage device capable of high-speed data exchange. It exchanges data with the CPU before main memory, thus achieving a very fast speed. Upon receiving a data retrieval request, the system typically first searches the cache for the corresponding target data. If the target data is found in the cache, it is directly returned to the application. However, because applications have time-sensitive requirements for cached data, this approach may cause errors in the application's business functions. Summary of the Invention
[0003] In view of this, embodiments of the present invention provide a request processing method and apparatus, which can reduce the occurrence of errors in the business functions of applications by taking into account the time limit conditions of data acquisition requests.
[0004] In a first aspect, embodiments of the present invention provide a request processing method, including:
[0005] Receive a data acquisition request and determine the time limit conditions corresponding to the data acquisition request;
[0006] Determine whether the first target data corresponding to the data retrieval request exists in the cache;
[0007] In response to the absence of the first target data in the cache, or the cache time of the first target data in the cache not meeting the time limit condition, the second target data corresponding to the data request is obtained from the data source and the second target data is returned;
[0008] Identify at least one associated application corresponding to the second target data, and determine the cache retention time corresponding to the second target data based on the term information of each associated application;
[0009] The second target data is stored in a cache, and the lifecycle of the second target data in the cache is managed according to the cache retention time.
[0010] Optionally, after determining whether the first target data corresponding to the data retrieval request exists in the cache, the method further includes:
[0011] In response to the presence of the first target data in the cache, determine whether the cache time of the first target data in the cache meets the expiration condition;
[0012] In response to the cache time of the first target data in the cache meeting the expiration condition, the first target data is retrieved from the cache and returned.
[0013] Optionally, determining whether the cache time of the first target data in the cache meets the expiration condition includes:
[0014] Determine the cache time for the first target data;
[0015] Determine the time difference between the current time and the cache time;
[0016] Based on the time difference, determine whether the caching time of the first target data meets the time limit condition.
[0017] Optionally, determining at least one associated application corresponding to the second target data includes:
[0018] Determine the data type corresponding to the second target data;
[0019] Based on the type mapping information, at least one associated application corresponding to the second target data is determined.
[0020] Optionally, determining the time limit condition corresponding to the data acquisition request includes:
[0021] Determine the authorization code corresponding to the data acquisition request, and determine the target application corresponding to the authorization code;
[0022] The time limit conditions corresponding to the target application are determined as the time limit conditions corresponding to the data acquisition request.
[0023] Optionally, the step of performing lifecycle management on the second target data in the cache based on the cache retention time includes:
[0024] The cache time for storing the second target data;
[0025] In response to the time difference between the current time and the cache time being greater than the cache retention time, the second target data in the cache is deleted.
[0026] Optionally, the cache includes: a first-level cache and a second-level cache;
[0027] The step of storing the second target data in a cache and managing the lifecycle of the second target data in the cache according to the cache retention time includes:
[0028] The second target data is stored in the first-level cache, and the cache time corresponding to the second target data is recorded.
[0029] In response to the time difference between the current time and the cache time being greater than the cache retention time, the second target data is deleted from the first-level cache and stored in the second-level cache.
[0030] Secondly, embodiments of the present invention provide a request processing apparatus, including:
[0031] The condition determination module is used to receive a data acquisition request and determine the time limit condition corresponding to the data acquisition request.
[0032] The data determination module is used to determine whether the first target data corresponding to the data acquisition request exists in the cache;
[0033] The data return module is used to retrieve the second target data corresponding to the data request from the data source and return the second target data in response to the absence of the first target data in the cache or the cache time of the first target data in the cache not meeting the time limit condition.
[0034] The time determination module is used to determine at least one associated application corresponding to the second target data, and to determine the cache retention time corresponding to the second target data based on the period information of each associated application.
[0035] The data management module is used to store the second target data in a cache and to perform lifecycle management on the second target data in the cache according to the cache retention time.
[0036] Optionally, the data return module is further configured to:
[0037] In response to the presence of the first target data in the cache, determine whether the cache time of the first target data in the cache meets the expiration condition;
[0038] In response to the cache time of the first target data in the cache meeting the expiration condition, the first target data is retrieved from the cache and returned.
[0039] Optionally, the data return module is further configured to:
[0040] Determine the cache time for the first target data;
[0041] Determine the time difference between the current time and the cache time;
[0042] Based on the time difference, determine whether the caching time of the first target data meets the time limit condition.
[0043] Optionally, the time determination module is specifically used for:
[0044] Determine the data type corresponding to the second target data;
[0045] Based on the type mapping information, at least one associated application corresponding to the second target data is determined.
[0046] Optionally, the condition determination module is specifically used for:
[0047] Determine the authorization code corresponding to the data acquisition request, and determine the target application corresponding to the authorization code;
[0048] The time limit conditions corresponding to the target application are determined as the time limit conditions corresponding to the data acquisition request.
[0049] Thirdly, embodiments of the present invention provide an electronic device, including:
[0050] One or more processors;
[0051] A storage device for storing one or more programs that, when executed by one or more processors, cause the one or more processors to perform the method described in any of the above embodiments.
[0052] Fourthly, embodiments of the present invention provide a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the methods described in any of the above embodiments.
[0053] Fifthly, embodiments of the present invention provide a computer program product, including a computer program that, when executed by a processor, implements the methods described in any of the above embodiments.
[0054] One embodiment of the above invention has the following advantages or beneficial effects: after receiving a data retrieval request, if the first target data is not present in the cache, or the cache time of the first target data in the cache does not meet the expiration condition, the second target data corresponding to the data request is retrieved from the data source and returned. By considering the expiration condition of the data retrieval request, the possibility of errors in the application's business functions can be reduced.
[0055] Furthermore, after obtaining the second target data from the data source, the second target data is stored in the cache. At least one associated application corresponding to the second target data is identified, and the cache retention time corresponding to the second target data is determined based on the expiration information of each associated application. Therefore, the solution of this embodiment of the invention can also utilize the cache retention time to reasonably manage the lifecycle of the second target data in the cache, better providing data support for each associated application.
[0056] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0057] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:
[0058] Figure 1 This is a flowchart illustrating a request processing method provided in the first embodiment of the present invention;
[0059] Figure 2 This is a flowchart illustrating a request processing method provided in the second embodiment of the present invention;
[0060] Figure 3 This is a flowchart illustrating a request processing method provided in the third embodiment of the present invention;
[0061] Figure 4 This is a schematic diagram of the structure of a request processing device provided in an embodiment of the present invention;
[0062] Figure 5 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation
[0063] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0064] The acquisition, transmission, storage, use, and processing of data in this application comply with relevant national laws and regulations. It should be noted that certain software, components, models, and other existing industry solutions may be mentioned in the embodiments of this application. These should be considered exemplary, intended only to illustrate the feasibility of implementing the technical solution of this application, and do not imply that the applicant has already used or necessarily used such solutions.
[0065] Figure 1 This is a flowchart illustrating a request processing method provided in the first embodiment of the present invention, as shown below. Figure 1 As shown, the method includes:
[0066] Step 101: Receive the data acquisition request and determine the time limit conditions corresponding to the data acquisition request.
[0067] Time limits are used to characterize the timeliness of the target application corresponding to the data retrieval request. Time limits can be set according to the business needs of the target application. Time limits can be less than 1 hour, less than 3 days, or no more than 1 month, etc.
[0068] Different applications have different requirements for data timeliness. For example, the time limit for the "Enterprise Inquiry" application is less than 7 days. For applications with lower timeliness requirements, such as "Industry Operation Platform" and "Customer Management and Maintenance," the time limit can be less than 15 days. The solution of this invention can solve the problem that cached data cannot meet the different timeliness requirements of multiple applications.
[0069] In one embodiment of the present invention, determining the time limit condition corresponding to the data acquisition request includes: determining the authorization code corresponding to the data acquisition request, and determining the target application corresponding to the authorization code; and determining the time limit condition corresponding to the target application as the time limit condition corresponding to the data acquisition request.
[0070] Different applications have different time limits. When an application retrieves data, it needs to request an authorization code, which identifies the application and its time-sensitive requirements for cached data. The target application generates a data retrieval request carrying the authorization code. The authorization code identifies the target application, thus determining the time limit for the data retrieval request. The time limit for the target application is determined by its time limit information. If the target application's time limit information is 1 day, then the corresponding time limit can be less than 1 day, or no more than 1 day, etc.
[0071] Step 102: Determine whether the first target data corresponding to the data retrieval request exists in the cache.
[0072] Based on the request information corresponding to the data retrieval request, the system searches the cache for the first target data corresponding to the request. The request information can be configured according to business requirements, such as user identifier, time information, and business identifier.
[0073] Step 103: In response to the absence of the first target data in the cache, or the cache time of the first target data in the cache not meeting the expiration condition, retrieve the second target data corresponding to the data request from the data source and return the second target data.
[0074] If the first target data is not in the cache, retrieve the second target data corresponding to the data retrieval request from the data source, which is used to store the real-time data corresponding to the data retrieval request.
[0075] If the first target data exists in the cache, and the cache time of the first target data in the cache does not meet the expiration condition, the second target data corresponding to the data request is retrieved from the data source. The cache time of the first target data is the point in time when the first target data is stored in the cache.
[0076] For example, if the time limit for the data retrieval request is less than 1 day, and the cache time of the first target data in the cache is 3 days ago, then the first target data has been stored in the cache for more than 1 day, which does not meet the time limit condition. The first target data is expired, and the second target data corresponding to the data request needs to be retrieved again from the data source.
[0077] Step 104: Determine at least one associated application corresponding to the second target data, and determine the cache retention time corresponding to the second target data based on the expiration information of each associated application.
[0078] The second set of target data includes data feature information. This data feature information can be set according to business needs, such as user identifiers, time information, and business identifiers.
[0079] The second target data corresponds to at least one associated application. The associated application sends a data retrieval request. If the request information of the data retrieval request matches the data characteristic information of the second target data, and the cache time of the second target data meets the time limit condition of the data retrieval request, then the second target data can be returned to the associated application.
[0080] In one embodiment of the present invention, determining at least one associated application corresponding to the second target data includes: determining the data type corresponding to the second target data; and determining at least one associated application corresponding to the second target data based on type mapping information.
[0081] The data type corresponding to the second target data can be determined based on the request type of the data acquisition request. For example, the second target data corresponding to a data acquisition request of the first request type is of type one, etc. The data type corresponding to the second target data can also be determined based on the data characteristic information or data source of the second target data. For example, if the data characteristic information of the second target data includes user identification and time information, then the data type corresponding to the second target data is type two. The data type corresponding to the second target data from the first data source is type three, etc.
[0082] The system pre-stores type mapping information, which is used to save the association between data types and various applications. Based on this association and the data type of the second target data, at least one associated application corresponding to the second target data is determined.
[0083] Based on business needs, different time limits are set for different applications. Time limits can be 1 hour, 3 days, 1 month, etc. The cache retention time corresponding to the second target data is determined based on the time limit information of each associated application. For example, the statistical value of the time limit information of each associated application can be used as the cache retention time corresponding to the second target data. The statistical value can be: maximum value, minimum value, or average value. In one embodiment of the invention, the weighted sum of the time limit information of each associated application is used as the cache retention time corresponding to the second target data. The weight of each associated application is determined by the frequency with which that associated application sends data retrieval requests.
[0084] If retrieving data from a data source incurs costs, the cache retention time can be determined by considering factors such as the billing rules and budget of the outbound data source. Specifically, the term information, frequency, billing rules, and budget of each associated application can be input into the cache evaluation model. Based on the output of the cache evaluation model, the cache retention time corresponding to the second target data can be determined.
[0085] Step 105: Store the second target data in the cache, and manage the lifecycle of the second target data in the cache according to the cache retention time.
[0086] Lifecycle management is used to manage the secondary target data throughout its entire lifecycle. Lifecycle management can include: data saving, data deletion, data transfer, and data degradation. For example, if the cache time of the secondary target data exceeds the cache retention time, then the secondary target data will be deleted, transferred, or downgraded.
[0087] After storing the second target data in the cache, if the first target data already exists in the cache, it is deleted. The second target data is updated from the first target data, providing more real-time data support for related applications.
[0088] In the solution of this embodiment of the invention, a data retrieval request is received. If the first target data does not exist in the cache, or the cache time of the first target data in the cache does not meet the expiration condition, the second target data corresponding to the data request is retrieved from the data source and returned. By considering the expiration condition of the data retrieval request, the possibility of errors in the application's business functions can be reduced.
[0089] Furthermore, after obtaining the second target data from the data source, the second target data is stored in the cache. At least one associated application corresponding to the second target data is identified, and the cache retention time corresponding to the second target data is determined based on the expiration information of each associated application. Therefore, the solution of this embodiment of the invention can also utilize the cache retention time to reasonably manage the lifecycle of the second target data in the cache, better providing data support for each associated application.
[0090] The solution in this invention, through interface caching, can improve application performance, reduce server load, and accelerate response speed. In scenarios where retrieving data from external data sources incurs costs, the solution in this embodiment can also save costs. Caching is a key optimization technique. The solution in this invention is suitable for services where data changes infrequently or where a certain degree of data latency is permissible, and can provide efficient and reasonable data support for multiple applications with different timeliness requirements.
[0091] Figure 2 This is a flowchart illustrating a request processing method provided in the second embodiment of the present invention, as shown below. Figure 2 As shown, the method includes:
[0092] Step 201: Receive the data acquisition request and determine the time limit conditions corresponding to the data acquisition request.
[0093] Step 202: Determine whether the first target data corresponding to the data retrieval request exists in the cache.
[0094] If the first target data exists in the cache, proceed to step 203. If the first target data does not exist in the cache, proceed to step 205.
[0095] Step 203: Determine whether the cache time of the first target data in the cache meets the expiration condition.
[0096] If the cache time of the first target data in the cache meets the expiration condition, then the first target data can meet the timeliness requirement of the data retrieval request, and proceed to step 204. If the cache time of the first target data in the cache does not meet the expiration condition, then the first target data cannot meet the timeliness requirement of the data retrieval request, and proceed to step 205.
[0097] In one embodiment of the present invention, determining whether the cache time of the first target data in the cache meets the expiration condition includes: determining the cache time of the first target data; determining the time difference between the current time and the cache time; and determining whether the cache time of the first target data meets the expiration condition based on the time difference.
[0098] If the time difference is not greater than the deadline condition, the cache time of the first target data is determined to meet the deadline condition. If the time difference is greater than the deadline condition, the cache time of the first target data is determined not to meet the deadline condition.
[0099] For example, if the deadline for a data retrieval request is less than 3 hours, and the cache time for the first target data in the cache is 1:30, then if the current time is 2:35, the time difference between the current time and the cache time is 1 hour and 5 minutes, which meets the deadline condition. If the current time is 6:00, the time difference between the current time and the cache time is 4 hours and 30 minutes, which does not meet the deadline condition. The first target data is expired, and the second target data corresponding to the data request needs to be retrieved again from the data source.
[0100] Step 204: Retrieve and return the first target data from the cache.
[0101] Step 205: Obtain the second target data corresponding to the data request from the data source and return the second target data.
[0102] Step 206: Determine at least one associated application corresponding to the second target data, and determine the cache retention time corresponding to the second target data based on the expiration information of each associated application.
[0103] Step 207: Store the second target data in the cache and manage the lifecycle of the second target data in the cache according to the cache retention time.
[0104] In the solution of this embodiment of the invention, after receiving a data acquisition request, the method for acquiring the target data corresponding to the data acquisition request is determined by determining whether the first target data corresponding to the data acquisition request exists in the cache and whether the cache time of the first target data meets the expiration condition. This ensures data accuracy and improves data return efficiency.
[0105] Figure 3 This is a flowchart illustrating a request processing method provided in the third embodiment of the present invention, as shown below. Figure 3 As shown, the method includes:
[0106] Step 301: Receive the data acquisition request and determine the time limit conditions corresponding to the data acquisition request.
[0107] Step 302: Determine whether the first target data corresponding to the data retrieval request exists in the cache.
[0108] Step 303: In response to the absence of the first target data in the cache, or the cache time of the first target data in the cache does not meet the expiration condition, retrieve the second target data corresponding to the data request from the data source and return the second target data.
[0109] Step 304: Determine at least one associated application corresponding to the second target data, and determine the cache retention time corresponding to the second target data based on the expiration information of each associated application.
[0110] Step 305: Save the second target data in the cache and save the cache time of the second target data.
[0111] The caching time for the second target data is the point in time when the second target data is stored in the cache. The caching time of the second target data determines how to manage it.
[0112] Step 306: Based on the comparison result of the time difference between the current time and the cache time, perform lifecycle management on the second target data in the cache.
[0113] The time difference between the current time and the cache time represents the storage duration of the second target data in the cache. The lifecycle management strategy for the cached second target data can be configured according to business needs. For example, if the time difference corresponding to the second target data is greater than the cache retention time, then the second target data can be deleted, transferred, or downgraded.
[0114] In one embodiment of the present invention, lifecycle management of second target data in the cache includes: deleting the second target data in the cache in response to a time difference between the current time and the cache time being greater than the cache retention time. For cached data where the time difference between the current time and the cache time is greater than the cache retention time, the cached data has expired and can no longer provide accurate data support for related applications; therefore, the cached data is deleted from the cache. This reduces the storage pressure on the cache while providing more storage space for updated cached data.
[0115] In one embodiment of the present invention, the cache includes: a first-level cache and a second-level cache; lifecycle management of the second target data in the cache includes: storing the second target data in the first-level cache and recording the cache time corresponding to the second target data; in response to the time difference between the current time and the cache time being greater than the cache retention time, deleting the second target data from the first-level cache and storing the second target data in the second-level cache.
[0116] Level 1 cache responds faster than level 2 cache. Level 1 cache requires less storage space than level 2 cache. Deleting cached data from level 1 cache and storing it in level 2 cache, or performing cache degradation, involves storing the most recent and more timely cached data in level 1 cache and storing less timely cached data in level 2 cache. By setting up multiple levels of caching, the timeliness and accuracy of returned data can be effectively improved.
[0117] In the solution of this embodiment of the invention, after obtaining the second target data corresponding to the data request from the data source, the cache retention time corresponding to the second target data is determined according to the time limit information of each associated application. Then, based on the comparison result between the current time and the cache time of the second target data, lifecycle management is performed on the second target data in the cache. This reduces the required cache resources and also improves the data return efficiency.
[0118] Figure 4 This is a schematic diagram of the structure of a request processing device provided in one embodiment of the present invention, as shown below. Figure 4 As shown, the device includes:
[0119] The condition determination module 401 is used to receive a data acquisition request and determine the time limit conditions corresponding to the data acquisition request.
[0120] Data determination module 402 is used to determine whether the first target data corresponding to the data retrieval request exists in the cache;
[0121] The data return module 403 is used to retrieve the second target data corresponding to the data request from the data source and return the second target data in response to the absence of the first target data in the cache or the cache time of the first target data in the cache not meeting the expiration condition.
[0122] The time determination module 404 is used to determine at least one associated application corresponding to the second target data, and to determine the cache retention time corresponding to the second target data based on the expiration information of each associated application.
[0123] The data management module 405 is used to store the second target data in the cache and to manage the lifecycle of the second target data in the cache according to the cache retention time.
[0124] Optionally, the data return module 403 is also used for:
[0125] In response to the presence of the first target data in the cache, determine whether the cache time of the first target data in the cache meets the expiration condition;
[0126] In response to the cache expiration condition being met for the first target data in the cache, the first target data is retrieved from the cache and returned.
[0127] Optionally, the data return module 403 is also used for:
[0128] Determine the caching time for the first target data;
[0129] Determine the time difference between the current time and the cache time;
[0130] Based on the time difference, determine whether the caching time of the first target data meets the time limit condition.
[0131] Optionally, the time determination module 404 is specifically used for:
[0132] Determine the data type corresponding to the second target data;
[0133] Based on the type mapping information, determine at least one associated application corresponding to the second target data.
[0134] Optionally, the condition determination module 401 is specifically used for:
[0135] Determine the authorization code corresponding to the data acquisition request, and determine the target application corresponding to the authorization code;
[0136] The deadline conditions corresponding to the target application are determined as the deadline conditions corresponding to the data acquisition request.
[0137] Optionally, the data management module 405 is specifically used for:
[0138] Cache time for storing second target data;
[0139] If the time difference between the current time and the cache time is greater than the cache retention time, delete the second target data from the cache.
[0140] Optionally, the cache includes: a first-level cache and a second-level cache;
[0141] Data management module 405 is specifically used for:
[0142] Store the second target data in the first-level cache and record the cache time corresponding to the second target data;
[0143] If the time difference between the current time and the cache time is greater than the cache retention time, the second target data is deleted from the first-level cache and stored in the second-level cache.
[0144] This invention provides an electronic device, comprising:
[0145] One or more processors;
[0146] A storage device for storing one or more programs that, when executed by one or more processors, cause the one or more processors to implement the methods of any of the above embodiments.
[0147] This invention provides a computer program product, including a computer program that, when executed by a processor, implements the request processing method of this invention.
[0148] The following is for reference. Figure 5It shows a schematic diagram of the structure of a computer system 500 suitable for implementing a terminal device of the present invention. Figure 5 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0149] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 502 or programs loaded from storage section 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the system 500. The CPU 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0150] The following components are connected to I / O interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to I / O interface 505 as needed. A removable medium 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 510 as needed so that computer programs read from it can be installed into storage section 508 as needed.
[0151] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by central processing unit (CPU) 501, it performs the functions defined above in the system of this invention.
[0152] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0153] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0154] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be located in a processor, and for example, can be described as: a condition determination module, a data determination module, a data return module, a time determination module, and a data management module. The names of these modules do not necessarily limit the module itself; for example, the condition determination module can also be described as "a module that receives a data acquisition request and determines the time limit conditions corresponding to the data acquisition request."
[0155] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include:
[0156] Receive a data acquisition request and determine the time limit conditions corresponding to the data acquisition request;
[0157] Determine whether the first target data corresponding to the data retrieval request exists in the cache;
[0158] In response to the absence of the first target data in the cache, or the cache time of the first target data in the cache not meeting the time limit condition, the second target data corresponding to the data request is obtained from the data source and the second target data is returned;
[0159] Identify at least one associated application corresponding to the second target data, and determine the cache retention time corresponding to the second target data based on the term information of each associated application;
[0160] The second target data is stored in a cache, and the lifecycle of the second target data in the cache is managed according to the cache retention time.
[0161] According to the technical solution of this embodiment of the invention, a data acquisition request is received. If the first target data does not exist in the cache, or the cache time of the first target data in the cache does not meet the expiration condition, the second target data corresponding to the data request is obtained from the data source and returned. By considering the expiration condition of the data acquisition request, the possibility of errors in the application's business functions can be reduced.
[0162] Furthermore, after obtaining the second target data from the data source, the second target data is stored in the cache. At least one associated application corresponding to the second target data is identified, and the cache retention time corresponding to the second target data is determined based on the expiration information of each associated application. Therefore, the solution of this embodiment of the invention can also utilize the cache retention time to reasonably manage the lifecycle of the second target data in the cache, better providing data support for each associated application.
[0163] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A request processing method, characterized in that, include: Receive a data acquisition request and determine the time limit conditions corresponding to the data acquisition request; Determine whether the first target data corresponding to the data retrieval request exists in the cache; In response to the absence of the first target data in the cache, or the cache time of the first target data in the cache not meeting the expiration condition, the second target data corresponding to the data retrieval request is obtained from the data source, and the second target data is returned; Identify at least one associated application corresponding to the second target data, and determine the cache retention time corresponding to the second target data based on the term information of each associated application; The second target data is stored in a cache, and the lifecycle of the second target data in the cache is managed according to the cache retention time. The step of determining the time limit condition corresponding to the data acquisition request includes: determining the authorization code corresponding to the data acquisition request, and determining the target application corresponding to the authorization code; and determining the time limit condition corresponding to the target application as the time limit condition corresponding to the data acquisition request. The step of determining at least one associated application corresponding to the second target data includes: determining the data type corresponding to the second target data; and determining at least one associated application corresponding to the second target data based on type mapping information. The cache includes a first-level cache and a second-level cache; the step of storing the second target data in the cache and managing the lifecycle of the second target data in the cache according to the cache retention time includes: storing the second target data in the first-level cache and recording the cache time corresponding to the second target data; in response to the time difference between the current time and the cache time being greater than the cache retention time, deleting the second target data from the first-level cache and storing the second target data in the second-level cache.
2. The method according to claim 1, characterized in that, After determining whether the first target data corresponding to the data retrieval request exists in the cache, the method further includes: In response to the presence of the first target data in the cache, determine whether the cache time of the first target data in the cache meets the expiration condition; In response to the cache time of the first target data in the cache meeting the expiration condition, the first target data is retrieved from the cache and returned.
3. The method according to claim 2, characterized in that, Determining whether the cache time of the first target data in the cache meets the expiration condition includes: Determine the cache time for the first target data; Determine the time difference between the current time and the cache time; Based on the time difference, determine whether the caching time of the first target data meets the time limit condition.
4. The method according to claim 1, characterized in that, The step of managing the lifecycle of the second target data in the cache according to the cache retention time includes: The cache time for storing the second target data; In response to the time difference between the current time and the cache time being greater than the cache retention time, the second target data in the cache is deleted.
5. A request processing apparatus, characterized in that, include: The condition determination module is used to receive a data acquisition request and determine the time limit condition corresponding to the data acquisition request. The data determination module is used to determine whether the first target data corresponding to the data acquisition request exists in the cache; The data return module is used to retrieve the second target data corresponding to the data retrieval request from the data source and return the second target data in response to the absence of the first target data in the cache or the cache time of the first target data in the cache not meeting the time limit condition. The time determination module is used to determine at least one associated application corresponding to the second target data, and to determine the cache retention time corresponding to the second target data based on the period information of each associated application. The data management module is used to store the second target data in a cache and to manage the lifecycle of the second target data in the cache according to the cache retention time. The condition determination module is specifically used to: determine the authorization code corresponding to the data acquisition request, and determine the target application corresponding to the authorization code; and determine the time limit condition corresponding to the target application as the time limit condition corresponding to the data acquisition request. The time determination module is specifically used to: determine the data type corresponding to the second target data; Based on the type mapping information, at least one associated application corresponding to the second target data is determined; The cache includes a first-level cache and a second-level cache; the data management module is specifically used to: store the second target data in the first-level cache and record the cache time corresponding to the second target data; in response to the time difference between the current time and the cache time being greater than the cache retention time, delete the second target data from the first-level cache and store the second target data in the second-level cache.
6. The apparatus according to claim 5, characterized in that, The data return module is also used for: In response to the presence of the first target data in the cache, determine whether the cache time of the first target data in the cache meets the expiration condition; In response to the cache time of the first target data in the cache meeting the expiration condition, the first target data is retrieved from the cache and returned.
7. The apparatus according to claim 6, characterized in that, The data return module is also used for: Determine the cache time for the first target data; Determine the time difference between the current time and the cache time; Based on the time difference, determine whether the caching time of the first target data meets the time limit condition.
8. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-4.
9. A computer-readable medium having a computer program stored thereon, characterized in that... When the program is executed by the processor, it implements the method as described in any one of claims 1-4.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-4.
Citation Information
Patent Citations
Data caching method, apparatus, computer device, and storage medium
CN109240613A
Data calling method and device, computer equipment and storage medium
CN118051284A