CN113961601A - Request processing method, device, medium and electronic equipment - Google Patents

Request processing method, device, medium and electronic equipment Download PDF

Info

Publication number
CN113961601A
CN113961601A CN202111258042.1A CN202111258042A CN113961601A CN 113961601 A CN113961601 A CN 113961601A CN 202111258042 A CN202111258042 A CN 202111258042A CN 113961601 A CN113961601 A CN 113961601A
Authority
CN
China
Prior art keywords
data
response data
target response
request
expiration time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111258042.1A
Other languages
Chinese (zh)
Inventor
杨轩嘉
石慧兴
陈洋
赵晨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202111258042.1A priority Critical patent/CN113961601A/en
Publication of CN113961601A publication Critical patent/CN113961601A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure provides a request processing method, a request processing device, a request processing medium and electronic equipment, and relates to the technical field of computers. The request processing method comprises the following steps: receiving a current data acquisition request sent by data request equipment; if the response data set comprises target response data, determining the expiration time of the target response data; determining whether the target response data is expired or not according to the request time and the expiration time of the target response data; and if the target response data is not expired, sending the target response data to the data request equipment. The invention provides an expiration updating strategy for data maintained based on an LRU cache mechanism, and the accuracy of response data acquired by data request equipment is improved.

Description

Request processing method, device, medium and electronic equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a request processing method, a request processing apparatus, a computer-readable storage medium, and an electronic device.
Background
The LRU cache (Least Recently Used) is a cache replacement mechanism, and its principle is that under a fixed cache space, when new cache data needs to be cached, if the cache space is already close to saturation, the cache data which is Used Least frequently Recently can be deleted to reserve a storage space for the latest cache data.
In the related art, in the data processing process, response data corresponding to the data acquisition request can be acquired from the database and returned to the data requester, and the response data is stored in the cache space. The LRU cache mechanism may be utilized to process the response data in the cache space.
However, since the LRU cache mechanism can generally solve the situation that the cache space is not enough, and does not care whether the answer data corresponding to the data acquisition request in the cache space is updated in the database, the situation that the expired data is returned to the data requester usually occurs.
Disclosure of Invention
The present disclosure provides a request processing method, a request processing apparatus, a computer-readable storage medium, and an electronic device, thereby improving the accuracy of response data acquired by a data request device at least to a certain extent.
According to a first aspect of the present disclosure, there is provided a request processing method, the method comprising:
receiving a current data acquisition request sent by data request equipment, wherein the current data acquisition request comprises a data identifier and a request moment;
if the response data set comprises target response data, determining the expiration time of the target response data, wherein the target response data are response data corresponding to the data identification;
determining whether the target response data is expired or not according to the request time and the expiration time of the target response data;
and if the target response data is not expired, sending the target response data to the data request equipment.
According to a second aspect of the present disclosure, there is provided a request processing apparatus, the apparatus comprising:
the receiving module is configured to receive a current data acquisition request sent by data request equipment, wherein the current data acquisition request comprises a data identifier and a request moment;
a first determining module configured to determine an expiration time of target response data if the response data set includes the target response data, where the target response data is response data corresponding to the data identifier
The second determination module is configured to determine whether the target response data is expired according to the request time and the expiration time of the target response data;
a sending module configured to send the target response data to the data requesting device if the target response data is not expired.
According to a third aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of the first aspect.
According to a fourth aspect of the present disclosure, there is provided an electronic device comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of the first aspect via execution of the executable instructions.
The technical scheme of the disclosure has the following beneficial effects:
the request processing method can determine whether the target response data is overdue or not according to the request time and the target response data expiration time after the response data set comprises the target response data required to be acquired by the current data acquisition request after receiving the current data acquisition request, and can send the target response data to the data request equipment when determining that the target response data is not overdue so as to improve the accuracy of the response data acquired by the data request equipment.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is apparent that the drawings in the following description are only some embodiments of the present disclosure, and that other drawings can be obtained from those drawings without inventive effort for a person skilled in the art.
FIG. 1 illustrates a schematic architecture diagram of a request processing system in the present exemplary embodiment;
FIG. 2 illustrates a flow chart of a request processing method in the exemplary embodiment;
FIG. 3 is a flow diagram illustrating a method of request processing in the exemplary embodiment;
FIG. 4 is a schematic diagram showing the structure of a request processing apparatus in the present exemplary embodiment;
fig. 5 shows a schematic structural diagram of an electronic device in the present exemplary embodiment.
Detailed Description
Exemplary embodiments will now be described more fully with reference to the accompanying drawings. The exemplary embodiments, however, may be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and the like. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the steps. For example, some steps may be decomposed, and some steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
In the related art, a scheme for processing a data acquisition request based on an LRU cache mechanism has appeared. In general, after receiving a current data acquisition request sent by a data request device, a data cache device may determine whether response data corresponding to the current data acquisition request exists in the data cache device, and if so, send the response data corresponding to the current data acquisition request to the data request device; if the current data acquisition request does not exist, acquiring response data corresponding to the current data acquisition request from the database service equipment, and sending the response data to the data request equipment; and storing the response data in the data cache device, and after receiving the data acquisition request which is the same as the current data acquisition request again, directly acquiring the corresponding response data from the data cache device and sending the response data to the data request device. In order to save the cache space, the data cache device may replace the data in the cache space with an LRU cache mechanism.
However, the principle of the LRU cache mechanism is that when the cache space is close to saturation, the response data which is requested in the recent time with the lowest frequency is deleted, and thus, the LRU cache mechanism can always store the response data which is frequently requested in the cache space into the cache space; and if the data volume of the response data in the cache space is always in an unsaturated state, the LRU cache mechanism can also keep the response data in the cache space all the time. Under these circumstances, if the response data corresponding to a certain data acquisition request in the database service device has been updated, and the data cache device receives the data acquisition request, the response data returned to the data request device is still old response data, which results in inconsistency between the response data acquired by the data request device and the actual response data.
In view of the foregoing, exemplary embodiments of the present disclosure provide a request processing method, which is directed to a service scenario for processing a data acquisition request based on an LRU cache mechanism. The application scenarios of the request processing method include but are not limited to: in the process of acquiring data by a user terminal, after the data cache equipment receives a current data acquisition request sent by the user terminal, if the cache space of the data cache equipment is determined to store response data corresponding to a data identifier in the current data acquisition request, whether the response data corresponding to the data identifier in the current data acquisition request is overdue can be judged, and if the response data corresponding to the data identifier in the current data acquisition request is determined to be unexpired, the response data corresponding to the data acquisition request can be sent to the user terminal; if the response data corresponding to the data identifier in the current data acquisition request is determined to be expired, the response data corresponding to the current data acquisition request can be acquired again from the database service equipment, and the acquired response data is sent to the user terminal, meanwhile, an expiration time can be set for the acquired response data again, so that after the data acquisition request which is the same as the data identifier in the current data acquisition request is received next time, the acquired response data can be determined to be directly sent to the data request equipment, or the response data corresponding to the data identifier is acquired and updated. The method and the device can ensure that the response data acquired by the user terminal at the current moment is consistent with the response data in the database service equipment, and improve the accuracy of the response data acquired by the user terminal.
In order to implement the request processing method described above, exemplary embodiments of the present disclosure provide a request processing system. Fig. 1 shows a schematic architecture diagram of the request processing system, which may be applied in a data service business scenario. As shown in fig. 1, the request processing system 100 may include at least one data requesting device 110, a data caching device 120, and a database service device 130. The data requesting device may be a terminal device or an electronic device used by a data requesting party, the data requesting party may be a user or another data invoking party (such as an enterprise), the data caching device may be an electronic device providing a caching space, and the database service device may be an electronic device storing business data generated in a business scenario, where the terminal device may be a smart phone, a personal computer, a tablet computer, or the like. The electronic device may be a server, a computer, or the like; the server can be one server or a cluster formed by a plurality of servers, and the specific architecture of the server is not limited in the disclosure; the data request device 110 and the data cache device 120 may establish a connection through a network, and the data cache device 120 and the database service device 130 may establish a connection through a network, so as to implement data acquisition request processing.
The data caching device may process a data obtaining request sent by the data requesting device based on the LRU cache mechanism and the data response expiration mechanism, and specifically, the data caching device 120 may receive a current data obtaining request sent by the data requesting device 110, where the current data obtaining request includes a data identifier and a request time; the data caching device 120 may search for target response data in a response data set maintained in the data caching device 120 according to the data identifier, and if the response data set includes the target response data, determine an expiration time of the target response data, where the target response data is response data corresponding to the data identifier; determining whether the target response data is expired or not according to the request time and the expiration time of the target response data; if the targeted response data is not expired, the targeted response data may be sent to the data requesting device 110. If the target response data is expired, the updated target response data can be acquired from the database service equipment 130; the updated target response data is sent to the data request device 110, and meanwhile, the data cache device 120 may set an expiration time for the updated response data, so that after receiving a data acquisition request with the same data identifier as that in the current data acquisition request next time, it may be determined to send the updated response data directly to the data request device, or update the response data corresponding to the data identifier again. The number of the response data in the response data set maintained by the data caching device can be determined based on the size of the caching space, which is not limited in the embodiment of the disclosure, so that the response data acquired by the data requesting device is ensured to be the latest response data, and the accuracy of the response data returned by the data requesting device is improved.
In an optional implementation manner, the data request device may be a user terminal, the database service device may be a database service device of an ETCD data storage system, and is configured to store business data generated in a business scenario, and the data caching device may be a remote procedure call Proxy service device (Grpc-Proxy) configured to provide a response data caching service; the remote process call proxy service equipment can establish network connection with the user terminal and the ETCD database service equipment respectively, process a data acquisition request of the user terminal based on the LRU cache mechanism and the response data expiration mechanism, and can ensure that the latest response data are returned to the user terminal.
The following describes a request processing method from the perspective of a data caching device. Fig. 2 shows an exemplary flow of a request processing method performed by a server, which may include:
step S201, a current data acquisition request sent by the data request device is received.
Step S202, if the response data set comprises the target response data, determining the expiration time of the target response data.
Step S203, determining whether the target response data is expired according to the request time and the expiration time of the target response data.
And step S204, if the target response data is not expired, sending the target response data to the data request equipment.
In this disclosure, the data requesting device may send a current data obtaining request to the data caching device, where the current data obtaining request may include a data identifier and a request time, so that the data caching device may determine, in the data caching device, target response data that needs to be obtained by the current data obtaining request according to the data identifier. The target response data is response data corresponding to the data identifier in the current data acquisition request in a response data set maintained by the data caching device.
It should be noted that the response data set includes at least one data identifier and a data identifier corresponding to each response data, and a correspondence between the response data in the response data set and the data identifier is determined by the data caching device according to the data identifier in the historical data acquisition request and the response data acquired from the database service device according to the data identifier in the historical data acquisition request, where due to a limitation of a cache space in the data caching device, the response data set may be maintained based on an LRU cache mechanism, and the historical data acquisition request may be a data acquisition request received by the data caching device at any time before the data acquisition request is received.
Meanwhile, after the data caching device acquires the response data corresponding to the data identifier in the historical data acquisition request from the database service device, the expiration time of the response data needs to be determined, so that after the data caching device receives the current data acquisition request and determines that the response data set comprises the target response data, the data caching device can send the target response data to the data request device by using the request time and the expiration time of the target response data under the condition that the target response data is determined not to be expired, the data request device finally acquires the latest response data, and the accuracy of the response data acquired by the data request device is improved.
To sum up, according to the request processing method provided by the embodiment of the present disclosure, after the current data acquisition request is received, after the response data set includes the target response data that needs to be acquired by the current data acquisition request, it is required to determine whether the target response data is expired according to the request time and the expiration time of the target response data, and when it is determined that the target response data is not expired, the target response data may be sent to the data request device, so as to ensure that the response data finally acquired in the data request device is the latest response data corresponding to the current time, and improve the accuracy of the response data acquired by the data request device.
In an optional embodiment, in step S201, the data caching device may receive a current data obtaining request sent by the data requesting device.
In this disclosure, a data requesting device may send a current data obtaining request to a data caching device, where the current data obtaining request may include a data identifier, and a request time when the data requesting device generates the current data obtaining request.
In an optional implementation manner, the data caching device may receive a current data obtaining request sent by the data requesting device, and at the same time, may parse the current data obtaining request to obtain a data identifier and a request time in the current data obtaining request.
In an optional embodiment, in step S202, if the data caching device determines that the response data set includes the target response data, the expiration time of the target response data is determined.
In the embodiment of the present disclosure, the data cache device may maintain the response data set, and the correspondence between the data identifier in the response data set and the response data is determined by the data cache device according to the received historical data acquisition request, and meanwhile, the data cache device may maintain the response data set based on an LRU cache mechanism.
The process of determining the corresponding relationship between the data identifier in the response data set and the response data by the data caching device according to the received historical data acquisition request may include: after the data cache device receives the historical data acquisition request, the historical data acquisition request can be analyzed to obtain a data identifier and a request time in the historical data acquisition request, if the response data set does not include response data corresponding to the data identifier, the response data corresponding to the data identifier can be acquired from the database service device according to the data identifier, and the data identifier and the response data corresponding to the data identifier are added into the response data set.
Further, after determining the response data in the response data set according to the received historical data acquisition request, the data caching device needs to determine the expiration time of the response data, so that after receiving the current data acquisition request which is the same as the historical data acquisition request, the data caching device determines whether the target response data is expired according to the request time in the current data acquisition request and the expiration time of the target response data, and when determining that the target response data is not expired, the data caching device can send the target response data to the data requesting device, thereby ensuring that the data requesting device acquires the latest response data corresponding to the current data acquisition request, and improving the accuracy of the response data acquired by the data requesting device. The current data acquisition request identical to the historical data acquisition request refers to the current data acquisition request with the data identifier identical to the data identifier in the historical data request
The process of determining the expiration time of the response data by the data caching device may include: after acquiring the response data corresponding to the data identifier in the historical data acquisition request from the database service device, the data caching device may determine an expiration time of the response data based on a preconfigured data retention time and an acquisition time of the response data, where the determining the expiration time of the response data based on the preconfigured data retention time and the acquisition time of the response data may include: and delaying the acquisition time of the response data by the preset data retention time to determine the acquisition time as the expiration time of the response data. The preconfigured data retention time may be determined based on an actual service scenario, which is not limited in the embodiment of the present disclosure.
For example, assuming that the preset data retention time is 3 minutes, and the data caching device obtains the response data corresponding to the data identifier a1 from the database service device at 14 points 25 points 14 at 6 months and 5 days at 2021, the expiration time of the response data corresponding to the data identifier a1 may be determined to be 28 points 14 at 6 months and 5 days at 2021.
In an alternative embodiment, the process of the data caching device determining whether the target response data is included in the response data set may include: the data cache device may compare the data identifier in the current data acquisition request with each data identifier in the response data set, and if the response data set includes a data identifier that is the same as the data identifier in the current data acquisition request, it may be determined that the response data set includes the target response data; if the reply data set does not include the data identifier that is the same as the data identifier in the current data acquisition request, it may be determined that the reply data set does not include the target reply data.
In an optional implementation manner, when the data caching device adds the response data in the response data set, the response data may also carry an expiration time of the response data, and the process of the data caching device determining the expiration time of the target response data may include: when a certain to-be-deleted response data in the response data set needs to be deleted, the response data to be deleted and the data identifier of the to-be-deleted response data and the expiration time are deleted simultaneously, so that no redundant data exists in the response data set.
In an optional implementation manner, an expiration time data set may be further maintained in the data caching device, where the expiration time data set includes an expiration time and a data identifier of each piece of response data in the response data set, and the process of the data caching device determining the expiration time of the target response data may include: and acquiring the expiration time of the target response data in the expiration time data set.
The process of acquiring the expiration time of the target response data in the expiration time dataset may include: and searching the expiration time of the response data corresponding to the data identifier which is the same as the data identifier in the current data acquisition request in the expiration time data set by using the data identifier in the current data acquisition request to obtain the expiration time of the target response data. The response data and the expiration time of the response data can be respectively stored in different data sets without modifying codes capable of realizing an LRU cache mechanism, the workload of developers in the configuration process of the data cache equipment can be reduced,
in an optional embodiment, in step S203, the data caching device may determine whether the target response data is expired according to the request time and the expiration time of the target response data.
In an alternative embodiment, the process of determining, by the data caching device, whether the target response data is expired according to the request time and the expiration time of the target response data may include: comparing the request time in the current data acquisition request with the expiration time of the target response data, and if the request time is less than or equal to the expiration time of the target response data, determining that the target response data is not expired; and if the request time is greater than the expiration time of the target response data, determining that the target response data is expired.
For example, assuming that the data identifier in the current data acquisition request is a1, the request time is 14: 26: 6/5/2021, and after the data caching device receives the current data acquisition request, if it is determined that the response data set includes the response data a1 corresponding to the data identifier a1, it may be determined that the response data set includes the target response data a1, and the expiration time for acquiring the target response data a1 is 28: 6/5/2021, and since the request time 26: 6/5/28: 2021 is smaller than the expiration time 28: 6/5/2021 of the target response data a1, it may be determined that the target response data a1 in the data caching device is not expired.
In an optional embodiment, in step S204, if the data caching device determines that the target response data is not expired, the target response data may be sent to the data requesting device.
In an optional embodiment, if the data caching device determines that the target response data is out of date, the updated target response data may be acquired from the database service device; and sending the updated target response data to the data request equipment to ensure that the data request equipment acquires the latest response data and improve the accuracy of the response data acquired by the data acquisition request.
The process of acquiring, by the data caching device, the updated target response data from the database service device may include: generating a response data acquisition request according to the data identification in the current data acquisition request, sending the response data acquisition request to the database service equipment, receiving response data which is sent by the database service equipment and corresponds to the data identification, and obtaining updated target response data; the response data acquisition request includes a data identifier in the current data acquisition request, and the database service device may determine, according to the data identifier, response data corresponding to the data identifier in the database service device.
It can be understood that, in the embodiment of the present disclosure, after the data caching device acquires the updated target response data from the database service device, the target response data in the response data set needs to be updated to the updated target response data, and the expiration time of the updated target response data is determined according to the acquisition time of the updated target response data and the pre-configured data retention time, so as to ensure that the data caching device can return the latest target response data to the data request device after receiving the same data acquisition request as the current data acquisition request again, and ensure the accuracy of the response data acquired by the data request device. The process of updating the target response data in the response data set to the updated target response data may include: and replacing the target response data in the response data set by the updated target response data. The data acquisition request identical to the current data acquisition request refers to a data acquisition request with the same data identifier as the current data acquisition request.
In an optional implementation manner, when the target response data in the response data set is updated to the updated target response data, the data caching device may further update the expiration time of the updated target response data in the response data set, so that in the process that the LRU cache mechanism maintains the response data set, when a certain response data to be deleted in the response data set needs to be deleted, the response data to be deleted, the data identifier of the response data to be deleted, and the expiration time may be deleted at the same time, so that there is no redundant data in the response data set.
In an optional implementation manner, after determining the expiration time of the updated target response data, the data caching device may further replace the expiration time of the target response data in the expiration time data set with the expiration time of the updated target data.
The process of replacing the expiration time of the target response data in the expiration time data set with the expiration time of the updated target data may include: and determining the expiration time of the response data corresponding to the data identifier by using the data identifier in the current data acquisition request to obtain the expiration time of the target response data, and replacing the expiration time of the target response data with the updated expiration time of the target response data.
In an optional embodiment, if the data caching device determines that the response data set does not include the target response data, the target response data is obtained from the database service device, and the target response data is sent to the data requesting device.
It can be understood that, after the data caching device acquires the target response data from the database service device, the data identifier and the target response data are further added to the response data set, and the expiration time of the target response data is determined according to the acquisition time of the target response data and the preconfigured data retention time. After the data caching device acquires the data acquisition request which is the same as the current data acquisition request again, the latest target response data can be returned to the data request device, and the accuracy of the response data acquired by the data request device is ensured.
In an optional implementation manner, when the data identifier and the target response data are added to the response data set, the data caching device may further add the expiration time of the target response data to the response data set, so that in the process of maintaining the response data set by the LRU cache mechanism, when a certain to-be-deleted response data in the response data set needs to be deleted, the to-be-deleted response data, the data identifier and the expiration time of the to-be-deleted response data may be deleted at the same time, and no redundant data exists in the response data set.
In an optional implementation manner, after determining the expiration time of the target response data, the data caching device may further add the expiration time of the target response data to the expiration time data set, where adding the expiration time of the target response data to the expiration time data set may include: and adding the data identifier in the current data acquisition request and the corresponding relation of the expiration time of the target response data into an expiration time data set.
In an optional implementation manner, since the response data set is maintained based on the LRU cache mechanism, if the response data set does not include the target response data, there may be a case that the response data corresponding to the data identifier is deleted, if the data caching device stores the expiration time of the response data in the response data set through the expiration time data set, before obtaining the target response data from the database service device, the data caching device may further determine whether the expiration time of the deleted target data is included in the expiration time data set, and if the expiration time of the deleted target response data is included in the expiration time data set, delete the expiration time of the deleted target response data. The corresponding relations between the response data set and the expiration data set, the response data corresponding to the data identification and the expiration of the response data are kept consistent, and redundant data in the expiration data set are prevented.
The process of determining whether the past due time data set contains the past due time of the deleted target data may include: and determining whether a data identifier which is the same as the data identifier in the current data request exists in the data set at the expiration time or not according to the data identifier in the current data request, if so, determining the expiration time of the deleted target response data contained in the data set at the expiration time, and if not, determining the expiration time of the deleted target response data not contained in the data set at the expiration time.
In an optional implementation manner, as shown in fig. 3, after the data cache receives the current data obtaining request sent by the data requesting device, the process of returning the request result to the data requesting device may include:
step S301, analyzing the current data acquisition request to obtain a data identifier and a request time;
step S302, judging whether target response data exist in the response data set according to the data identification;
step S303, if the target response data exist in the response data set, determining whether the target response data are overdue according to the overdue time and the request time of the target response data;
step S304, if the target response data is not overdue, sending the target response data to the data request equipment;
step S305, if the target response data is overdue, acquiring updated target response data from the database service equipment, and sending the updated target response data to the data request equipment;
in this step 305, after acquiring the updated target response data from the database service device, the target response data in the response data set is updated to the updated target response data, and the expiration time of the updated target response data is determined according to the acquisition time of the updated target response data and the pre-configured data retention time, and the expiration time of the updated target response data is determined according to the expiration time of the target response data in the expiration time data set.
Step S306, if the response data set does not have the target response data, acquiring the target response data from the database service equipment, and sending the target response data to the data request equipment;
in step 306, after the target response data is acquired from the database service device, the data identifier and the target response data are further added to the response data set, the expiration time of the target response data is determined according to the acquisition time of the target response data and the pre-configured data retention time, and the expiration time of the data identifier and the target response data is stored and the expiration time data set.
For example, it is assumed that the answering data set of the data caching device includes three answering data, which are answering data a1 corresponding to data identifier a1, answering data a2 corresponding to data identifier a2, and answering data A3 corresponding to data identifier A3, and the expiration times of the answering data are stored in the expiration time data set, the expiration times of the three answering data included in the expiration time data set are the expiration times 2021 year 7 month 5 day 13 point 26 of the answering data a1 corresponding to data identifier a1, the expiration time 2021 year 7 month 5 day 13 point 30 of the answering data a2 corresponding to data identifier a2, and the expiration time 2021 year 7 month 5 day 13 point 10 of the answering data A3 corresponding to data identifier A3, and meanwhile, in the current service scenario, the preconfigured data is reserved for 5 minutes.
After receiving the current data acquisition request sent by the data request device, the data cache device analyzes the current data acquisition request to obtain a data identifier a2 and a request time 2021, 7, month, 5, day, 13 point 28, may determine that the target response data a2 exists in the response data set according to the data identifier a2, determine that the expiration time of the target response data a2 in the expiration time data set is 2021, 7, month, 5, day, 13 point 30 according to the data identifier a2, and return the target response data a2 to the data request device because the request time 2021, 7, month, 5, day, 13 point 28 point is smaller than the expiration time 2021, 7, month, 5, day, 13 point 30 point 2021 of the target response data a 2.
If the data caching device receives the current data acquisition request sent by the data request device, analyzes the current data acquisition request to obtain a data identifier A3, and requests the time 2021, 7, month, 5, day, 13 points 29, it may determine that the target response data A3 exists in the response data set according to the data identifier A3, and determines that the expiration time of the target response data A3 is 2021, 7, month, 5, day, 13 points 10, in the expiration time data set according to the data identifier A3, and since the request time 2021, 7, month, 5, day, 13 points 29 is greater than the expiration time 2021, 7, month, 5, 13 points 10, in the target response data A3, it may determine that the target response data A3 has expired, it may send a response data acquisition request to the database service device, where the response data acquisition request includes the data identifier 3, and may receive updated response data A3 ', corresponding to the data identifier A3, sent by the database service device, and the updated response data identifier A3', which is corresponding to the data identifier A3, may be received by the database service device, obtaining updated target response data A3 ', and sending the updated target response data A3' to the data request equipment;
meanwhile, the answer data A3 corresponding to the data identifier A3 in the answer data set is replaced by the updated answer data A3'; and if the time for acquiring the updated target response data A3 ' can be determined to be 30 minutes from 13 points on 5/7/2021, the expiration time of the updated target response data A3 ' can be determined to be 35 minutes from 13 points on 5/7/2021 according to the preset data retention time of 5 minutes, and the expiration time data set is replaced by 35 minutes from 13 points on 5/7/5/2021 of the expiration time of the response data A3 corresponding to the data identifier A3 to 35 points on 5/7/13/7 of the expiration time of the updated response data A3 ' corresponding to the data identifier A3.
If the data caching device receives a current data acquisition request sent by the data request device, analyzes the current data acquisition request to obtain a data identifier a5, and requests 13 o' clock at 2021, 7, 5, 7 and 26, it may determine that no target response data exists in a response data set according to the data identifier a5, and sends a response data acquisition request to the database service device, where the response data acquisition request includes the data identifier a5, and may receive response data a5 corresponding to the data identifier a5 sent by the database service device to obtain target response data a5, and send the target response data a5 to the data request device; before sending the request for obtaining the response data to the database service device, it may be determined whether the expiration time of the deleted response data corresponding to the data identifier a5 exists in the expiration time dataset according to the data identifier a5, and if the expiration time of the deleted response data corresponding to the data identifier a5 exists, the expiration time of the deleted response data corresponding to the data identifier a5 may need to be deleted, so that the response data corresponding to the data identifier in the response dataset and the expiration time dataset may be consistent with the expiration time.
Meanwhile, the data identifier a5 and the response data A5 corresponding to the data identifier a5 are also added to the response data set; and the time for acquiring the target response data a5 can be determined to be 13 points on 7/5/2021, then the expiration time of the target response data a5 can be determined to be 33 points on 13 points on 5/7/2021 according to the preset data retention time of 5 minutes, and the expiration time 2021, 7/5/13 points on 3 points of the response data a5 corresponding to the data identifier a5 in the data identifier a5 is stored in the expiration time data set.
The embodiment of the present disclosure provides a request processing apparatus, as shown in fig. 4, the request processing apparatus 400 includes:
a receiving module 401 configured to receive a current data obtaining request sent by a data requesting device, where the current data obtaining request includes a data identifier and a request time;
a first determining module 402, configured to determine an expiration time of the target response data if the response data set includes the target response data, where the target response data is response data corresponding to the data identifier;
a second determining module 403, configured to determine whether the target response data is expired according to the request time and the expiration time of the target response data;
a sending module 404 configured to send the target response data to the data requesting device if the target response data is not expired.
In an alternative embodiment, as shown in fig. 4, the request processing apparatus 400 further includes:
an obtaining module 405 configured to obtain updated target response data from the database service device if the target response data is expired;
the sending module 404 is further configured to send the updated target response data to the data requesting device.
In an alternative embodiment, as shown in fig. 4, the request processing apparatus 400 further includes:
an updating module 406 configured to update the target response data in the response data set to the updated target response data.
In an alternative embodiment, the first determining module 402 is further configured to:
and determining the expiration time of the updated target response data according to the acquisition time of the updated target response data and the preset data retention time.
In an alternative embodiment, the second determining module 403 is configured to:
if the request time is less than or equal to the expiration time of the target response data, determining that the target response data is not expired;
and if the request time is greater than the expiration time of the target response data, determining that the target response data is expired.
In an alternative embodiment, the first determining module 402 is configured to:
and acquiring the expiration time of the target response data in the expiration time data set.
In an optional embodiment, the obtaining module 405 is configured to obtain the target response data from the database service device if the response data set does not include the target response data;
the sending module 404 is further configured to send the target response data to the data requesting device.
In an alternative embodiment, as shown in fig. 4, the request processing apparatus 400 further includes:
an adding module 407 configured to: and adding the data identification and the target response data into the response data set.
In an alternative embodiment, the first determining module 402 is further configured to:
and determining the expiration time of the target response data according to the acquisition time of the target response data and the preset data retention time.
In an alternative embodiment, as shown in fig. 4, the request processing apparatus 400 further includes:
the deleting module 408 is configured to delete the expiration time of the deleted target response data if the expiration time data set contains the expiration time of the deleted target response data.
Exemplary embodiments of the present disclosure also provide a computer-readable storage medium, which may be implemented in the form of a program product, including program code for causing an electronic device to perform the steps according to various exemplary embodiments of the present disclosure described in the above-mentioned "exemplary method" section of this specification, when the program product is run on the electronic device. In one embodiment, the program product may be embodied as a portable compact disc read only memory (CD-ROM) and include program code, and may be run on an electronic device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Exemplary embodiments of the present disclosure also provide an electronic device, which may be a background server of a data caching unit. The electronic device is explained below with reference to fig. 5. It should be understood that the electronic device 500 shown in fig. 5 is only an example and should not bring any limitations to the function and scope of use of the embodiments of the present disclosure.
As shown in fig. 5, the electronic device 500 is embodied in the form of a general purpose computing device. The components of the electronic device 500 may include, but are not limited to: at least one processing unit 510, at least one memory unit 520, and a bus 530 that couples various system components including the memory unit 520 and the processing unit 510.
Where the storage unit stores program code, which may be executed by the processing unit 510, to cause the processing unit 510 to perform the steps according to various exemplary embodiments of the present invention as described in the above-mentioned "exemplary methods" section of this specification. For example, processing unit 510 may perform method steps, etc., as shown in fig. 2.
The storage unit 520 may include volatile storage units such as a random access memory unit (RAM)521 and/or a cache memory unit 522, and may further include a read only memory unit (ROM) 523.
The storage unit 520 may also include a program/utility 524 having a set (at least one) of program modules 525, such program modules 525 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 530 may include a data bus, an address bus, and a control bus.
The electronic device 500 may also communicate with one or more external devices 600 (e.g., keyboard, pointing device, bluetooth device, etc.), which may be through an input/output (I/O) interface 540. The electronic device 500 may also communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via a network adapter 550. As shown, the network adapter 550 communicates with the other modules of the electronic device 500 over the bus 530. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functions of two or more modules or units described above may be embodied in one module or unit, according to exemplary embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system. Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is to be limited only by the following claims.

Claims (13)

1. A method for processing a request, the method comprising:
receiving a current data acquisition request sent by data request equipment, wherein the current data acquisition request comprises a data identifier and a request moment;
if the response data set comprises target response data, determining the expiration time of the target response data, wherein the target response data are response data corresponding to the data identification;
determining whether the target response data is expired or not according to the request time and the expiration time of the target response data;
and if the target response data is not expired, sending the target response data to the data request equipment.
2. The method of claim 1, further comprising:
if the target response data is overdue, acquiring updated target response data from the database service equipment;
and sending the updated target response data to the data request equipment.
3. The method of claim 2, wherein after obtaining the updated target response data from the database service device, the method further comprises:
and updating the target response data in the response data set into the updated target response data.
4. The method of claim 2, wherein after obtaining the updated target response data from the database service device, the method further comprises:
and determining the expiration time of the updated target response data according to the acquisition time of the updated target response data and the preset data retention time.
5. The method of claim 1, wherein determining whether the target response data is expired according to the request time and the expiration time of the target response data comprises:
if the request time is less than or equal to the expiration time of the target response data, determining that the target response data is not expired;
and if the request time is greater than the expiration time of the target response data, determining that the target response data is expired.
6. The method of claim 1, wherein determining an expiration time of the target response data comprises:
and acquiring the expiration time of the target response data in the expiration time data set.
7. The method of claim 1, wherein after receiving the current data acquisition request sent by the data requesting device, the method further comprises:
if the response data set does not comprise the target response data, acquiring the target response data from database service equipment;
and sending the target response data to the data request equipment.
8. The method of claim 7, wherein after obtaining the target response data from a database service device, the method further comprises:
adding the data identification and the target response data to the response data set.
9. The method of claim 7, wherein after obtaining the target response data from a database service device, the method further comprises:
and determining the expiration time of the target response data according to the acquisition time of the target response data and the preset data retention time.
10. The method of claim 7, wherein prior to obtaining the target response data from the database service device, the method further comprises:
and if the expiration time data set contains the expiration time of the deleted target response data, deleting the expiration time of the deleted target response data.
11. A request processing apparatus, characterized in that the apparatus comprises:
the receiving module is configured to receive a current data acquisition request sent by data request equipment, wherein the current data acquisition request comprises a data identifier and a request moment;
a first determining module configured to determine an expiration time of target response data if the response data set includes the target response data, where the target response data is response data corresponding to the data identifier
The second determination module is configured to determine whether the target response data is expired according to the request time and the expiration time of the target response data;
a sending module configured to send the target response data to the data requesting device if the target response data is not expired.
12. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method of any one of claims 1 to 10.
13. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of any of claims 1 to 10 via execution of the executable instructions.
CN202111258042.1A 2021-10-27 2021-10-27 Request processing method, device, medium and electronic equipment Pending CN113961601A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111258042.1A CN113961601A (en) 2021-10-27 2021-10-27 Request processing method, device, medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111258042.1A CN113961601A (en) 2021-10-27 2021-10-27 Request processing method, device, medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN113961601A true CN113961601A (en) 2022-01-21

Family

ID=79467625

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111258042.1A Pending CN113961601A (en) 2021-10-27 2021-10-27 Request processing method, device, medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN113961601A (en)

Similar Documents

Publication Publication Date Title
US8880634B2 (en) Cache sharing among branch proxy servers via a master proxy server at a data center
CN109492053B (en) Method and device for accessing data
CN109766362B (en) Data processing method and device
CN111198751B (en) Service processing method and device
CN109062563B (en) Method and device for generating page
CN112711730B (en) Data caching method and device, storage medium and electronic equipment
CN112579928A (en) Page jump method, page jump device, computer equipment and computer readable storage medium
CN111324615A (en) Data processing method, device, medium and electronic equipment
CN110955665A (en) Cache query method and device and electronic equipment
CN112948498A (en) Method and device for generating global identification of distributed system
CN111400350A (en) Configuration data reading method, system, electronic device and storage medium
CN113364887A (en) File downloading method based on FTP, proxy server and system
CN111176705B (en) Feature library upgrading method and device
CN112559560A (en) Metadata reading method and device, metadata updating method and device, and storage device
CN113961601A (en) Request processing method, device, medium and electronic equipment
CN115658171A (en) Method and system for solving dynamic refreshing of java distributed application configuration in lightweight mode
CN113779412A (en) Message reach method, node and system based on block chain network
CN113722007A (en) Configuration method, device and system of VPN branch equipment
CN113157722A (en) Data processing method, device, server, system and storage medium
CN114579167A (en) Method, device and storage medium for downloading application upgrade file
CN113220760B (en) Data processing method, device, server and storage medium
CN110825986B (en) Method, system, storage medium and electronic device for client to request data
CN113900895B (en) Information processing method, information processing apparatus, storage medium, and electronic device
CN117851664A (en) User portrait generation method, medium and equipment
CN116126897A (en) Advertisement delivery data query method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination