Request processing method and device

By storing and managing cached data in the terminal and processing requests according to the cache level, the problem of excessive waiting time in the front-end is solved and the user experience is improved.

CN119066287APending Publication Date: 2024-12-03CHINA CONSTRUCTION BANK +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411150162.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

In front-end development, when the server returns a large amount of data to the front-end page or application or the network is in poor condition, the interaction between the server and the front-end is too long, and the user needs to wait for a long time, which affects the user experience.

Method used

By storing cached data corresponding to multiple processing requests in the terminal and performing storage management according to the cache level, the storage location, update or delete of cached data is determined to reduce the waiting time. The specific method includes receiving the target request, determining the original and current cache levels, finding and using cache data to respond to the request, and performing migration processing at different cache levels.

Benefits of technology

Effectively reduce user waiting time, improve user experience, quickly respond to requests by cached data, and adapt to different application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119066287A_ABST
    Figure CN119066287A_ABST
Patent Text Reader

Abstract

The invention discloses a request processing method and device, and relates to the technical field of front-end development. A specific embodiment of the method comprises the following steps: receiving a target request, and determining an original cache level and a current cache level corresponding to the target request; determining whether cache data corresponding to the target request is stored in the terminal or not according to the original cache level corresponding to the target request; in response to cache data corresponding to the target request stored in the terminal, determining target storage according to an original cache level corresponding to the target request; searching cache data corresponding to the target request from a target cache; responding to the target request by utilizing the cache data corresponding to the target request; and in response to the fact that the original cache level is different from the current cache level, performing migration processing and storage management on cache data corresponding to the target request according to the current cache level. According to the embodiment, waiting time of a user can be shortened, and user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of front-end development, and in particular to a request processing method and device. Background Art

[0002] Users usually obtain the required data from the server through the front-end page or front-end application. The front-end page or front-end application displays the data returned by the server. However, if the server returns a large amount of data to the front-end page or front-end application, or the network condition is poor, the interaction time between the server and the front-end is often very long, and the user needs to spend a long time waiting, which is a bad user experience. Summary of the invention

[0003] In view of this, an embodiment of the present invention provides a request processing method and device, which can reduce the waiting time of users and improve user experience.

[0004] In a first aspect, an embodiment of the present invention provides a request processing method, which is applied to a terminal, wherein the terminal stores cache data corresponding to a plurality of processing requests, and the terminal stores and manages the cache data corresponding to the processing requests according to the cache level corresponding to the processing requests, and the method includes:

[0005] Receive a target request, and determine an original cache level and a current cache level corresponding to the target request;

[0006] Determining whether cache data corresponding to the target request is stored in the terminal according to the original cache level corresponding to the target request;

[0007] In response to the cache data corresponding to the target request being stored in the terminal, determining a target storage according to an original cache level corresponding to the target request;

[0008] searching the target cache for cache data corresponding to the target request, and responding to the target request using the cache data corresponding to the target request;

[0009] In response to the original cache level being different from the current cache level, the cache data corresponding to the target request is migrated and stored according to the current cache level.

[0010] Optionally, after searching the target cache for cache data corresponding to the target request, the method further includes:

[0011] Obtaining return data corresponding to the target request from the server;

[0012] The returned data corresponding to the target request is different from the cached data corresponding to the target request;

[0013] According to the returned data corresponding to the target request, update the data in the response page corresponding to the target request;

[0014] According to the returned data corresponding to the target request, the cache data corresponding to the target request is updated.

[0015] Optionally, after determining whether cache data corresponding to the target request is stored in the terminal according to the original cache level corresponding to the target request, the method further includes:

[0016] In response to the terminal not storing cache data corresponding to the target request, acquiring return data corresponding to the target request from a server;

[0017] The target request is responded to using the return data corresponding to the target request.

[0018] Optionally, after obtaining the return data corresponding to the target request from the server, the method further includes:

[0019] Determining whether the target request satisfies a cache condition;

[0020] In response to the target request satisfying a cache condition, determining current storage according to a current cache level corresponding to the target request;

[0021] storing the returned data corresponding to the target request in the current storage;

[0022] The level mapping information corresponding to the target request is saved; wherein the level mapping information includes: a request identifier of the target request and a current cache level of the target request.

[0023] Optionally, determining the original cache level corresponding to the target request includes:

[0024] Determine whether there is level mapping information corresponding to the request identifier of the target request;

[0025] In response to the existence of level mapping information corresponding to the request identifier of the target request, determining the original cache level corresponding to the target request according to the level mapping information corresponding to the request identifier of the target request;

[0026] In response to the absence of level mapping information corresponding to the request identifier of the target request, determining a default level as the original cache level corresponding to the target request.

[0027] Optionally, determining a cache current level corresponding to the target request includes:

[0028] Obtaining request information corresponding to the target request; wherein the request information includes at least one of the following: response time, data volume, and execution frequency;

[0029] A current cache level corresponding to the target request is determined according to the request information.

[0030] Optionally, performing migration processing and storage management on cache data corresponding to the target request according to the current cache level includes:

[0031] Determining a management parameter corresponding to the target request according to a current cache level corresponding to the target request;

[0032] According to the management parameters, cache data corresponding to the target request is stored and managed.

[0033] Optionally, the management parameters include: update frequency;

[0034] The storing and managing the cache data corresponding to the target request according to the management parameter includes:

[0035] Obtaining, from the server, return data corresponding to the target request at the update frequency;

[0036] According to the returned data corresponding to the target request, the cache data corresponding to the target request in the target storage is updated.

[0037] Optionally, the management parameters include: expiration time;

[0038] The storing and managing the cache data corresponding to the target request according to the management parameter includes:

[0039] Determining, according to the start cache time of the target request, whether the storage time of the cache data of the target request exceeds the expiration time;

[0040] In response to the storage time of the cache data of the target request exceeding the expiration time, determining whether the target request satisfies a retention condition;

[0041] In response to the target request satisfying the retention condition, setting the current time as the start caching time of the target request;

[0042] In response to the target request not satisfying the retention condition, deleting the cached data of the target request.

[0043] In a second aspect, an embodiment of the present invention provides a request processing device, which is applied to a terminal, wherein the terminal stores cache data corresponding to multiple processing requests, and the terminal stores and manages the cache data corresponding to the processing requests according to the cache level corresponding to the processing requests, wherein the device includes:

[0044] A level determination module, used for receiving a target request and determining an original cache level and a current cache level corresponding to the target request;

[0045] A data determination module, configured to determine whether cache data corresponding to the target request is stored in the terminal according to an original cache level corresponding to the target request;

[0046] A storage determination module, configured to determine a target storage according to an original cache level corresponding to the target request in response to the cache data corresponding to the target request being stored in the terminal;

[0047] A data search module, used to search the cache data corresponding to the target request from the target cache, and respond to the target request using the cache data corresponding to the target request;

[0048] The migration management module is used to perform migration processing and storage management on the cache data corresponding to the target request according to the current cache level in response to the original cache level being different from the current cache level.

[0049] Optionally, it also includes:

[0050] An update module, used for obtaining return data corresponding to the target request from the server;

[0051] The returned data corresponding to the target request is different from the cached data corresponding to the target request;

[0052] According to the returned data corresponding to the target request, update the data in the response page corresponding to the target request;

[0053] According to the returned data corresponding to the target request, the cache data corresponding to the target request is updated.

[0054] Optionally, it also includes:

[0055] A data acquisition module, configured to acquire return data corresponding to the target request from a server in response to the terminal not storing cache data corresponding to the target request;

[0056] The target request is responded to using the return data corresponding to the target request.

[0057] In a third aspect, an embodiment of the present invention provides an electronic device, including:

[0058] one or more processors;

[0059] A storage device is used to store 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 described in any of the above embodiments.

[0060] In a fourth aspect, an embodiment of the present invention provides a computer-readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method described in any of the above embodiments.

[0061] In a fifth aspect, an embodiment of the present invention provides a computer program product, including a computer program, which implements the method described in any of the above embodiments when executed by a processor.

[0062] An embodiment of the above invention has the following advantages or beneficial effects: the terminal stores cache data corresponding to multiple processing requests, and the terminal performs storage management on the cache data corresponding to each processing request according to the cache level corresponding to each processing request. The storage management includes: determining the storage location of the cache data, updating or deleting the cache data, etc.

[0063] When receiving a target request, it is determined whether the terminal stores cache data corresponding to the target request according to the original cache level corresponding to the target request. If the terminal stores cache data corresponding to the target request, it searches the target cache for cache data corresponding to the target request to respond to the target request. Therefore, it can reduce the user's waiting time and improve the user experience.

[0064] Determine the original cache level and current cache level corresponding to the target request. The original cache level is the cache level corresponding to the target request before receiving the target request. The current cache level is the cache level corresponding to the target request after receiving the target request. According to the original cache level, find the cache data corresponding to the target request. According to the current cache level, migrate and store the cache data corresponding to the target request to better adapt to the application scenario of the target request.

[0065] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0067] Figure 1 is a flowchart of a request processing method provided by the first embodiment of the present invention;

[0068] Figure 2 is a flowchart of a request processing method provided by the second embodiment of the present invention;

[0069] Figure 3 is a flowchart of a request processing method provided by the third embodiment of the present invention;

[0070] Figure 4is a structural diagram of a request processing device provided by an embodiment of the present invention;

[0071] Figure 5 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0072] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0073] The acquisition, transmission, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations.

[0074] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0075] An embodiment of the present invention provides a terminal that stores cache data corresponding to a plurality of processing requests, and manages the cache data corresponding to the processing requests according to the cache levels corresponding to the processing requests. Figure 1 is a flowchart of a request processing method provided by the first embodiment of the present invention, the method is applied to a terminal, such as Figure 1 As shown, the method includes:

[0076] Step 101: Receive a target request, and determine the original cache level and the current cache level corresponding to the target request.

[0077] Multiple cache levels can be set according to requirements, such as level 1-3, level 1-5, etc. The cache level represents the urgency of saving the return data of the request. The terminal stores and manages the cache data corresponding to the processing request according to the cache level corresponding to the processing request, so as to save the return data of the request with a long response time, a large amount of data or a high execution frequency in the terminal.

[0078] As the execution frequency and data volume of the target request change, the cache level of the request also changes dynamically. The original cache level is the cache level corresponding to the target request before receiving the target request. The current cache level is the cache level corresponding to the target request after receiving the target request.

[0079] The level mapping information corresponding to the multiple requests is saved in the system. The terminal stores the return data corresponding to the above requests, and the level mapping information includes: the request identifier of the request and the cache level of the request. The level mapping information corresponding to the target request is determined from the level mapping information corresponding to the above multiple requests, and the original cache level corresponding to the target request is determined according to the level mapping information corresponding to the target request.

[0080] In one embodiment of the present invention, the original cache level corresponding to the target request can be determined in the following manner: determine whether there is level mapping information corresponding to the request identifier of the target request; in response to the existence of level mapping information corresponding to the request identifier of the target request, determine the original cache level corresponding to the target request based on the level mapping information corresponding to the request identifier of the target request; in response to the absence of level mapping information corresponding to the request identifier of the target request, determine the default level as the original cache level corresponding to the target request.

[0081] If there is level mapping information corresponding to the request identifier of the target request, the cache level corresponding to the level mapping information corresponding to the request identifier of the target request is determined as the original cache level corresponding to the target request. If there is no level mapping information corresponding to the request identifier of the target request, the default level is determined to be the original cache level corresponding to the target request. If the original cache level corresponding to the target request is the default level, or the original cache level does not meet the cache condition, the cache data corresponding to the target request is not stored in the terminal.

[0082] In one embodiment of the present invention, the current cache level corresponding to the target request can also be determined in the following manner: obtaining request information corresponding to the target request; wherein the request information includes at least one of the following: response time, data volume, and execution frequency; determining the cache level corresponding to the target request according to the request information. Converting each request information into a preset value range respectively, and then calculating the weight sum corresponding to each request information according to the converted value and weight of each request information; and determining the current cache level corresponding to the target request according to the weight sum.

[0083] Step 102: Determine whether cache data corresponding to the target request is stored in the terminal according to the original cache level corresponding to the target request.

[0084] Level conditions can be set as needed. Level conditions can be: the cache level is greater than the level threshold, or the cache level is less than the preset level. If the original cache level corresponding to the target request meets the level condition, it is determined that the cache data corresponding to the target request is stored in the terminal. If the original cache level corresponding to the target request does not meet the cache condition, it is determined that the cache data corresponding to the target request is not stored in the terminal.

[0085] For example, if the level condition is not greater than level 3, then if the original cache level corresponding to the target request is level 4, then the terminal does not store cache data corresponding to the target request. For another example, if the level condition is greater than level 2, then if the original cache level corresponding to the target request is level 4, then the terminal stores cache data corresponding to the target request.

[0086] It is also possible to determine whether cache data corresponding to the target request is stored in the terminal based on the level mapping information corresponding to the multiple requests stored in the system. The request identifier of the target request is determined. If the mapping information corresponding to the request identifier of the target request does not exist in the level mapping information, it is determined that the cache data corresponding to the target request is not stored in the terminal. If the mapping information corresponding to the request identifier of the target request exists in the level mapping information, it is determined that the cache data corresponding to the target request is stored in the terminal.

[0087] Step 103: In response to the cache data corresponding to the target request being stored in the terminal, a target storage is determined according to the original cache level corresponding to the target request.

[0088] The terminal performs storage management on the cache data corresponding to the processing request according to the cache level corresponding to the processing request. Storage management includes: determining the storage location of the cache data, updating or deleting the cache data, etc. The storage location may include: memory, cache, hard disk, disk array, etc. The cache data of requests with long response time, large data volume, and high execution frequency are stored in a storage location with faster response speed. The storage mapping relationship between the cache level and the storage location is pre-stored in the system, and the target storage corresponding to the target request is determined according to the storage mapping relationship and the original cache level.

[0089] For example, the cache level is set to level 1-5. The terminal saves the cache data of requests with cache levels 1-3. The smaller the cache level, the more urgent it is to save the return data of the request corresponding to the cache level. Then the cache data of the request with cache level 1 can be stored in the memory, the cache data of the request with cache level 2 can be stored in the cache, and the cache data of the request with cache level 3 can be stored in the hard disk.

[0090] Step 104: searching the target cache for cache data corresponding to the target request, and responding to the target request using the cache data corresponding to the target request.

[0091] The server returns the return data for the target request, and the terminal saves the return data locally to generate cache data corresponding to the target request. The cache data corresponding to each request can be saved in the form of a key-value pair. According to the request identifier corresponding to the target request, the cache data corresponding to the target request is searched from the target cache.

[0092] Step 105: In response to the original cache level being different from the current cache level, the cache data corresponding to the target request is migrated and stored according to the current cache level.

[0093] The migration process is used to migrate the cache data corresponding to the target request from the target storage to the current storage, or to save the cache data corresponding to the target request to the current storage. The current storage is determined based on the storage mapping relationship and the current cache level. The migration process also includes: updating or creating the level mapping information corresponding to the target request. The updated or created level mapping information includes: the request identifier of the request and the current cache level of the request. Storage management includes: determining the storage location of the cache data, updating or deleting the cache data, etc.

[0094] If the original cache level is the same as the current cache level, the target storage is the same as the current storage, and step 105 does not need to be performed.

[0095] If the current cache level does not meet the level condition, the cache data corresponding to the target request is deleted from the terminal, and the level mapping information corresponding to the target request can also be deleted from the terminal, or the level mapping information corresponding to the target request in the terminal can be modified. The modified level mapping information corresponding to the target request includes: the request identifier of the target request and the current cache level of the target request.

[0096] Determine the original cache level and current cache level corresponding to the target request. According to the original cache level, find the cache data corresponding to the target request. According to the current cache level, migrate and store the cache data corresponding to the target request to better adapt to the application scenario of the target request.

[0097] In the scheme of the embodiment of the present invention, the terminal stores cache data corresponding to multiple processing requests, and the terminal stores and manages the cache data corresponding to each processing request according to the cache level corresponding to each processing request. When receiving a target request, it is determined whether the cache data corresponding to the target request is stored in the terminal according to the original cache level corresponding to the target request. If the cache data corresponding to the target request is stored in the terminal, the cache data corresponding to the target request is searched from the target cache to respond to the target request. Therefore, the user's waiting time can be reduced and the user experience can be improved.

[0098] In one embodiment of the present invention, the method provided by the embodiment of the present invention also includes: determining management parameters corresponding to the target request according to the current cache level corresponding to the target request; and storing and managing cache data corresponding to the target request according to the management parameters.

[0099] The management parameters may include: update frequency. According to the management parameters, the cache data corresponding to the target request in the target storage is stored and managed, including: obtaining the return data corresponding to the target request from the server at the update frequency; updating the cache data corresponding to the target request stored in the terminal according to the return data corresponding to the target request. Different update frequencies are set for different cache levels. This can reduce the risk of erroneous response requests due to the expiration of cache data due to long-term non-update of data.

[0100] In one embodiment of the present invention, the management parameters include: expiration time; based on the management parameters, storage management is performed on the cache data corresponding to the target request in the target storage, including: based on the start cache time of the target request, determining whether the storage time of the cache data of the target request exceeds the expiration time; in response to the storage time of the cache data of the target request exceeding the expiration time, determining whether the target request satisfies a retention condition; in response to the target request satisfying the retention condition, setting the current time as the start cache time of the target request; in response to the target request not satisfying the retention condition, deleting the cache data of the target request from the terminal.

[0101] Different expiration times are set for different cache levels. Retention conditions can be set according to business needs. Retention conditions may include: whether the target request has been received from the start of caching to the current time; whether the number of requests for the target request received from the start of caching to the current time exceeds the preset number; whether a data retention instruction for the target request has been received, etc. After deleting the cached data of the target request from the terminal, it also includes: deleting the level mapping information corresponding to the target request from the terminal. By determining whether the cached data of the target request is stored in the terminal through the level mapping information, it can also avoid excessive cache data and waste of terminal space.

[0102] Figure 2 is a flowchart of a request processing method provided by the second embodiment of the present invention, the method is applied to a terminal, such as Figure 2 As shown, the method includes:

[0103] Step 201: Receive a target request, and determine the original cache level and the current cache level corresponding to the target request.

[0104] Step 202: Determine whether cache data corresponding to the target request is stored in the terminal according to the original cache level corresponding to the target request.

[0105] Step 203: In response to the cache data corresponding to the target request being stored in the terminal, a target storage is determined according to the original cache level corresponding to the target request.

[0106] Step 204: Search the target cache for cache data corresponding to the target request; and respond to the target request using the cache data corresponding to the target request.

[0107] Step 205: In response to the original cache level being different from the current cache level, the cache data corresponding to the target request is migrated and stored according to the current cache level.

[0108] Step 206: Obtain return data corresponding to the target request from the server.

[0109] Step 207: In response to the return data corresponding to the target request being different from the cache data corresponding to the target request; based on the return data corresponding to the target request, update the data in the response page corresponding to the target request and the cache data corresponding to the target request.

[0110] In the solution of the embodiment of the present invention, it is first determined whether cache data is stored locally in the terminal. If cache data is stored, the cache data is used to render the page first. The server interface is requested, and the return data of the target request returned by the server is compared with the cache data. After the comparison, the cache data difference is modified. If there is no cache data, the return data that meets the cache conditions is stored locally in the front end.

[0111] Figure 3 is a flowchart of a request processing method provided by the first embodiment of the present invention, the method is applied to a terminal, such as Figure 3 As shown, the method includes:

[0112] Step 301: Receive a target request, and determine the original cache level and the current cache level corresponding to the target request.

[0113] Step 302: Determine whether cache data corresponding to the target request is stored in the terminal according to the original cache level corresponding to the target request.

[0114] The level mapping information corresponding to multiple requests is saved in the system. Among them, the cache data corresponding to the above requests is saved in the terminal. The level mapping information includes: the request identifier of the request and the cache level of the request. If there is no mapping information corresponding to the target request in the multiple level mapping information in the terminal, it is determined that the cache data corresponding to the target request is not stored in the terminal. If there is mapping information corresponding to the target request in the level mapping information, it is determined that the cache data corresponding to the target request is stored in the terminal.

[0115] The level condition may be set as required. The level condition may be: the cache level is greater than the level threshold, or the cache level is less than the preset level. In one embodiment of the present invention, it may be first determined whether the cache level of the target request meets the level condition. If the cache level of the target request does not meet the level condition, it is determined that no cache data corresponding to the target request is stored in the terminal.

[0116] If the cache level of the target request meets the level condition, it is further determined whether there is mapping information corresponding to the target request in the multiple level mapping information in the terminal. If there is level mapping information corresponding to the target request in the multiple level mapping information in the terminal, it is determined that cache data corresponding to the target request is stored in the terminal.

[0117] If the level mapping information corresponding to the target request does not exist in the multiple level mapping information in the terminal, it is determined that the cache data corresponding to the target request is not stored in the terminal. In this case, although the target request meets the level condition, the cache data corresponding to the target request is not stored in the terminal due to the first reception of the target request or other reasons.

[0118] Through the above-mentioned two-step determination of level conditions and level mapping information, the system can quickly determine whether cache data corresponding to the target request is stored in the terminal, thereby significantly improving the execution efficiency of the system.

[0119] If the terminal stores cache data corresponding to the target request, execute step 303. If the terminal does not store cache data corresponding to the target request, execute step 306.

[0120] Step 303: Determine the target storage according to the original cache level corresponding to the target request.

[0121] Step 304: Search the target cache for cache data corresponding to the target request, and respond to the target request using the cache data corresponding to the target request.

[0122] Step 305: In response to the original cache level being different from the current cache level, the cache data corresponding to the target request is migrated and stored according to the current cache level.

[0123] Step 306: Obtain the return data corresponding to the target request from the server; and respond to the target request using the return data corresponding to the target request.

[0124] Step 307: Determine whether the target request satisfies the cache condition.

[0125] The cache condition can be set according to business needs. The cache condition may include at least one of the following: response time exceeds a time threshold, data volume exceeds a data volume threshold, execution frequency exceeds a frequency threshold, etc.

[0126] Step 308: In response to the target request satisfying the cache condition, determine the current storage according to the current cache level corresponding to the target request.

[0127] The request information includes at least one of the following: response time, data volume, and execution frequency; according to the request information, the cache level corresponding to the target request is determined. Each request information is converted into a preset value range, and then the weight sum corresponding to each request information is calculated according to the converted value and weight of each request information; according to the weight sum, the cache level corresponding to the target request is determined.

[0128] A mapping relationship between cache levels and storage locations is pre-stored in the system, and a target storage corresponding to a target request is determined based on the mapping relationship.

[0129] Step 309: Store the returned data corresponding to the target request in the current storage, and perform storage management on the cache data corresponding to the target request according to the current cache level.

[0130] The terminal stores the level mapping information corresponding to the target request. The level mapping information includes: the request identifier of the target request and the target cache level of the target request. After receiving the target request, the terminal searches for multiple level mapping information in the terminal according to the request identifier of the target request to determine whether the cache data corresponding to the target request is stored in the terminal, and quickly responds to the target request.

[0131] In the solution of the embodiment of the present invention, if the terminal does not store cache data corresponding to the target request, the return data corresponding to the target request is obtained from the server. If the target request meets the cache condition, the return data corresponding to the target request is stored in the target storage corresponding to the current cache level, which can speed up the response speed of the terminal.

[0132] Figure 4 is a schematic diagram of a request processing device provided by an embodiment of the present invention. Figure 4 As shown, the device is applied to a terminal, the terminal stores cache data corresponding to multiple processing requests, and the terminal stores and manages the cache data corresponding to the processing requests according to the cache level corresponding to the processing requests. The device includes:

[0133] The level determination module 401 is used to receive a target request and determine the original cache level and the current cache level corresponding to the target request;

[0134] The data determination module 402 is used to determine whether cache data corresponding to the target request is stored in the terminal according to the original cache level corresponding to the target request;

[0135] The storage determination module 403 is used to determine the target storage according to the original cache level corresponding to the target request in response to the cache data corresponding to the target request being stored in the terminal;

[0136] The data search module 404 is used to search the cache data corresponding to the target request from the target cache, and respond to the target request using the cache data corresponding to the target request;

[0137] The migration management module 405 is used to perform migration processing and storage management on the cache data corresponding to the target request according to the current cache level in response to the original cache level being different from the current cache level.

[0138] Optionally, it also includes:

[0139] An update module is used to obtain the return data corresponding to the target request from the server;

[0140] The returned data corresponding to the target request is different from the cached data corresponding to the target request;

[0141] According to the return data corresponding to the target request, update the data in the response page corresponding to the target request;

[0142] According to the return data corresponding to the target request, the cache data corresponding to the target request is updated.

[0143] Optionally, it also includes:

[0144] A data acquisition module, configured to acquire return data corresponding to the target request from the server in response to the terminal not storing cache data corresponding to the target request;

[0145] Respond to the target request using the return data corresponding to the target request.

[0146] Optionally, it also includes:

[0147] A data storage module, used to determine whether a target request meets a cache condition;

[0148] In response to the target request satisfying the cache condition, determining the current storage according to the current cache level corresponding to the target request;

[0149] Store the return data corresponding to the target request in the current storage;

[0150] The level mapping information corresponding to the target request is saved; wherein the level mapping information includes: a request identifier of the target request and a cache level of the target request.

[0151] Optionally, the level determination module 401 is specifically configured to:

[0152] Determine whether there is level mapping information corresponding to the request identifier of the target request;

[0153] In response to the existence of level mapping information corresponding to the request identifier of the target request, determining the original cache level corresponding to the target request according to the level mapping information corresponding to the request identifier of the target request;

[0154] In response to the absence of level mapping information corresponding to the request identifier of the target request, a default level is determined to be the original cache level corresponding to the target request.

[0155] Optionally, the level determination module 401 is specifically configured to:

[0156] Obtaining request information corresponding to the target request; wherein the request information includes at least one of the following: response time, data volume, and execution frequency;

[0157] According to the request time, determine the current cache level corresponding to the target request.

[0158] Optionally, the migration management module 405 is specifically used to: determine the management parameter corresponding to the target request according to the current cache level corresponding to the target request;

[0159] According to the management parameters, the cache data corresponding to the target request is stored and managed.

[0160] Optionally, the management parameters include: update frequency;

[0161] The migration management module 405 is specifically used to: obtain the return data corresponding to the target request from the server at an update frequency;

[0162] According to the return data corresponding to the target request, the cache data corresponding to the target request is updated.

[0163] Optionally, the management parameters include: expiration time;

[0164] The migration management module 405 is specifically used to: determine whether the storage time of the cache data of the target request exceeds the expiration time according to the start cache time of the target request;

[0165] In response to the storage time of the cache data of the target request exceeding the expiration time, determining whether the target request satisfies the retention condition;

[0166] In response to the target request satisfying the retention condition, setting the current time as the start cache time of the target request;

[0167] In response to the target request not satisfying the retention condition, deleting cache data of the target request.

[0168] An embodiment of the present invention provides an electronic device, including:

[0169] one or more processors;

[0170] The storage device is used to store one or more programs. When the one or more programs are executed by one or more processors, the one or more processors implement the method of any of the above embodiments.

[0171] An embodiment of the present invention provides a computer program product, including a computer program. When the computer program is executed by a processor, the request processing method in the embodiment of the present invention is implemented.

[0172] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device suitable for implementing an embodiment of the present invention. Figure 5 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0173] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0174] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, 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, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.

[0175] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.

[0176] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0177] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0178] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be arranged in a processor, for example, they may be described as: a level determination module, a data determination module, a storage determination module, a data search module, and a migration management module. The names of these modules do not, in some cases, constitute limitations on the modules themselves, for example, the level determination module may also be described as "receiving a target request and determining a cache level corresponding to the target request".

[0179] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:

[0180] Receive a target request, and determine an original cache level and a current cache level corresponding to the target request;

[0181] Determining whether cache data corresponding to the target request is stored in the terminal according to the original cache level corresponding to the target request;

[0182] In response to the cache data corresponding to the target request being stored in the terminal, determining a target storage according to an original cache level corresponding to the target request;

[0183] searching the target cache for cache data corresponding to the target request, and responding to the target request using the cache data corresponding to the target request;

[0184] In response to the original cache level being different from the current cache level, the cache data corresponding to the target request is migrated and stored according to the current cache level.

[0185] According to the technical solution of the embodiment of the present invention, the terminal stores cache data corresponding to multiple processing requests, and the terminal stores and manages the cache data corresponding to each processing request according to the cache level corresponding to each processing request. When receiving a target request, it is determined whether the cache data corresponding to the target request is stored in the terminal according to the original cache level corresponding to the target request. If the cache data corresponding to the target request is stored in the terminal, the cache data corresponding to the target request is searched from the target cache to respond to the target request. Therefore, it is possible to reduce the user's waiting time and improve the user experience.

[0186] Determine the original cache level and current cache level corresponding to the target request. The original cache level is the cache level corresponding to the target request before receiving the target request. The current cache level is the cache level corresponding to the target request after receiving the target request. According to the original cache level, find the cache data corresponding to the target request. According to the current cache level, migrate and store the cache data corresponding to the target request to better adapt to the application scenario of the target request.

[0187] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A request processing method, characterized in that: Applied to a terminal, the terminal stores cache data corresponding to a plurality of processing requests, and the terminal performs storage management on the cache data corresponding to the processing requests according to the cache levels corresponding to the processing requests, the method comprising: Receive a target request, and determine an original cache level and a current cache level corresponding to the target request; Determining whether cache data corresponding to the target request is stored in the terminal according to the original cache level corresponding to the target request; In response to the cache data corresponding to the target request being stored in the terminal, determining a target storage according to an original cache level corresponding to the target request; searching the target cache for cache data corresponding to the target request, and responding to the target request using the cache data corresponding to the target request; In response to the original cache level being different from the current cache level, the cache data corresponding to the target request is migrated and stored according to the current cache level.

2. The method according to claim 1, characterized in that After searching the target cache for cache data corresponding to the target request, the method further includes: Obtaining return data corresponding to the target request from the server; The returned data corresponding to the target request is different from the cached data corresponding to the target request; According to the returned data corresponding to the target request, update the data in the response page corresponding to the target request; According to the returned data corresponding to the target request, the cache data corresponding to the target request is updated.

3. The method according to claim 1, characterized in that After determining whether cache data corresponding to the target request is stored in the terminal according to the original cache level corresponding to the target request, the method further includes: In response to the terminal not storing cache data corresponding to the target request, acquiring return data corresponding to the target request from a server; The target request is responded to using the return data corresponding to the target request.

4. The method according to claim 3, characterized in that After obtaining the return data corresponding to the target request from the server, the method further includes: Determining whether the target request satisfies a cache condition; In response to the target request satisfying a cache condition, determining current storage according to a current cache level corresponding to the target request; storing the returned data corresponding to the target request in the current storage; The level mapping information corresponding to the target request is saved; wherein the level mapping information includes: a request identifier of the target request and a current cache level of the target request.

5. The method according to claim 1, characterized in that Determining the original cache level corresponding to the target request includes: Determine whether there is level mapping information corresponding to the request identifier of the target request; In response to the existence of level mapping information corresponding to the request identifier of the target request, determining the original cache level corresponding to the target request according to the level mapping information corresponding to the request identifier of the target request; In response to the absence of level mapping information corresponding to the request identifier of the target request, determining a default level as the original cache level corresponding to the target request.

6. The method according to claim 1, characterized in that Determining a current cache level corresponding to the target request includes: Obtaining request information corresponding to the target request; wherein the request information includes at least one of the following: response time, data volume, and execution frequency; A current cache level corresponding to the target request is determined according to the request information.

7. The method according to claim 1, characterized in that The migrating and storing the cache data corresponding to the target request according to the current cache level includes: Determining a management parameter corresponding to the target request according to a current cache level corresponding to the target request; According to the management parameters, cache data corresponding to the target request is stored and managed.

8. The method according to claim 7, characterized in that The management parameters include: update frequency; The storing and managing the cache data corresponding to the target request according to the management parameter includes: Obtaining, from the server, return data corresponding to the target request at the update frequency; According to the returned data corresponding to the target request, the cache data corresponding to the target request is updated.

9. The method according to claim 7, characterized in that: The management parameters include: expiration time; The storing and managing the cache data corresponding to the target request according to the management parameter includes: Determining, according to the start cache time of the target request, whether the storage time of the cache data of the target request exceeds the expiration time; In response to the storage time of the cache data of the target request exceeding the expiration time, determining whether the target request satisfies a retention condition; In response to the target request satisfying the retention condition, setting the current time as the start caching time of the target request; In response to the target request not satisfying the retention condition, deleting the cached data of the target request.

10. A request processing device, characterized in that: Applied to a terminal, the terminal stores cache data corresponding to a plurality of processing requests, and the terminal performs storage management on the cache data corresponding to the processing requests according to the cache levels corresponding to the processing requests, the device comprising: A level determination module, used for receiving a target request and determining an original cache level and a current cache level corresponding to the target request; A data determination module, configured to determine whether cache data corresponding to the target request is stored in the terminal according to an original cache level corresponding to the target request; A storage determination module, configured to determine a target storage according to an original cache level corresponding to the target request in response to the cache data corresponding to the target request being stored in the terminal; A data search module, used to search the cache data corresponding to the target request from the target cache, and respond to the target request using the cache data corresponding to the target request; The migration management module is used to perform migration processing and storage management on the cache data corresponding to the target request according to the current cache level in response to the original cache level being different from the current cache level.

11. The device according to claim 10, characterized in that Also includes: An update module, used for obtaining return data corresponding to the target request from the server; The returned data corresponding to the target request is different from the cached data corresponding to the target request; According to the returned data corresponding to the target request, update the data in the response page corresponding to the target request; According to the returned data corresponding to the target request, the cache data corresponding to the target request is updated.

12. The device according to claim 10, characterized in that Also includes: A data acquisition module, configured to acquire return data corresponding to the target request from a server in response to the terminal not storing cache data corresponding to the target request; The target request is responded to using the return data corresponding to the target request.

13. An electronic device, characterized in that: include: one or more processors; a 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 according to any one of claims 1 to 9.

14. A computer readable medium having a computer program stored thereon, characterized in that When the program is executed by a processor, the method described in any one of claims 1 to 9 is implemented.

15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.