CN106603613A - Request processing method and apparatus - Google Patents

Request processing method and apparatus Download PDF

Info

Publication number
CN106603613A
CN106603613A CN201510684388.6A CN201510684388A CN106603613A CN 106603613 A CN106603613 A CN 106603613A CN 201510684388 A CN201510684388 A CN 201510684388A CN 106603613 A CN106603613 A CN 106603613A
Authority
CN
China
Prior art keywords
target
server
request
target data
history
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
CN201510684388.6A
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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201510684388.6A priority Critical patent/CN106603613A/en
Publication of CN106603613A publication Critical patent/CN106603613A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Abstract

The embodiments of the invention provide a request processing method and apparatus wherein when an object accessing request for obtaining object data is detected and if a historical accessing request is transmitted to a server before the object accessing request is detected, then a terminal does not have to transmit the object accessing request to the server and it only needs to buffer the object accessing request locally; after that, when the terminal receives the object data transmitted by the server according to the historical accessing request, it can respond to the target accessing request using the target data. According to the embodiments of the invention, through the buffering of target accessing request locally, it is possible to save network resources without transmitting the target accessing request to a server. And secondly, the server does not process the target accessing request because it does not receive the target accessing request, therefore, reducing the load of the server.

Description

Request processing method and device
Technical field
The present invention relates to field of computer technology, more particularly to a kind of request processing method and device.
Background technology
Currently, in LAN or wide area network, data, services are provided by a server usually, other-end can be from the clothes Data are obtained in business device.For example, the server is the server for providing Time Service, and other-end can utilize the server The Time Service of offer is obtaining the unified time from the server.
When terminal needs to obtain target data from server, terminal can be generated asks for the acquisition for obtaining target data, Then send the acquisition to server to ask;When server receives the acquisition asks, target data will be obtained at once simultaneously Return to terminal;The terminal target data that the reception server is returned again.
In some cases, terminal may need repeatedly to obtain target data from server at short notice, need every time to obtain Acquisition request will be generated when taking target data, multiple acquisition requests in such terminal short time, will be generated, and then to clothes Multiple acquisition requests can be all sent to server by business device, but multiple acquisition requests is sent to server from terminal During can take very many Internet resources;Secondly, after multiple acquisition requests are received in the server short time, will Obtain is asked all to process more, can so increase the load of server.
The content of the invention
To overcome problem present in correlation technique, the present invention to provide a kind of request processing method and device.
First aspect according to embodiments of the present invention, there is provided a kind of request processing method, methods described include:
When detecting for obtaining the Target Acquisition request of target data, judged before the Target Acquisition request is detected Whether it is transmitted across obtaining request for the history for obtaining the target data to server;
When the server described in detect the forward direction of the Target Acquisition request is transmitted across the history obtains request, local Cache the Target Acquisition request;
Judge whether that receiving the server obtains the target data that request sends according to the history;
When the target data that the server is sent according to history acquisition request is received, responded with the target data The Target Acquisition request.
Wherein, it is described to judge whether be transmitted across for obtaining the mesh to server before the Target Acquisition request is detected The history of mark data obtains request, including:
Obtain the detection moment when detecting the Target Acquisition and asking;
Obtain the default corresponding relation between locally stored acquisition request and delivery time;
When the target transmission corresponding with the acquisition request for obtaining the target data is searched in the default corresponding relation Carve;
Calculate the time span between the detection moment and the target delivery time;
When the time span is less than the first predetermined time period, it is determined that taking in the forward direction for detecting the Target Acquisition request Business device is transmitted across obtaining request for the history for obtaining the target data.
Further, methods described also includes:
When the history acquisition request was not transmitted across to the server before the Target Acquisition request is detected, to institute State server and send the Target Acquisition request, so that the server returns the number of targets according to Target Acquisition request According to.
Further, after the Target Acquisition request to server transmission, also include:
Obtain current time local when the Target Acquisition is asked is sent to the server and send as Target Acquisition request Moment;
The target delivery time corresponding with the acquisition request for obtaining the target data is updated to the Target Acquisition please Seek delivery time.
Wherein, it is described to judge whether that receiving the server obtains the target data that request sends according to the history, including:
Obtain it is after the target delivery time, and with the time span between the target delivery time be second preset The object time of time span;
Time period between the detection moment and the object time judges whether that receiving the server goes through according to described History obtains the target data that request sends;
Obtained according to the history when the time period between the current time and the object time receives the server During the target data that request sends, it is determined that receiving the server obtains the target data that request sends according to the history.
Further, methods described also includes:
Obtained according to the history when the time period between the current time and the object time does not receive the server When taking the target data that request sends, the Target Acquisition request is sent to the server;So that the server is according to institute State Target Acquisition request and return the target data.
Further, after the Target Acquisition request with target data response, also include:
Ask from the Target Acquisition is locally deleted.
Second aspect according to embodiments of the present invention, there is provided a kind of request processing meanss, described device include:
First judge module, for when detecting for obtaining the Target Acquisition request of target data, judging detecting Whether it is transmitted across obtaining request for the history for obtaining the target data to server before stating Target Acquisition request;
Cache module, for being transmitted across the history acquisition when the server described in detect the forward direction of the Target Acquisition request During request, ask in Target Acquisition described in local cache;
Second judge module, for judging whether that receiving the server obtains the number of targets that request sends according to the history According to;
Respond module, for when the target data that the server is sent according to history acquisition request is received, with institute State target data and respond the Target Acquisition request.
Wherein, first judge module includes:
First acquisition unit, for obtaining the detection moment when detecting the Target Acquisition and asking;
Second acquisition unit, for obtaining the default corresponding relation between locally stored acquisition request and delivery time;
Searching unit, it is relative with the acquisition request for obtaining the target data for searching in the default corresponding relation The target delivery time answered;
Computing unit, for calculating the time span between the detection moment and the target delivery time;
First determining unit, for when the time span is less than the first predetermined time period, it is determined that detecting the mesh Mark obtains the forward direction server of request and is transmitted across obtaining request for the history for obtaining the target data.
Further, described device also includes:
Sending module, obtains for not being transmitted across the history to the server before the Target Acquisition request is detected When taking request, the Target Acquisition request is sent to the server, so that the server is asked according to the Target Acquisition Return the target data.
Wherein, first judge module also includes:
3rd acquiring unit, send current time local when the Target Acquisition is asked to the server and make for obtaining Delivery time is asked for Target Acquisition;
Updating block, for will be updated to the corresponding target delivery time of request that obtains for obtaining the target data The Target Acquisition asks delivery time.
Wherein, second judge module includes:
4th acquiring unit, for obtain it is after the target delivery time, and between the target delivery time Time span is the object time of the second predetermined time period;
Judging unit, judged whether to receive the clothes for the time period between the detection moment and the object time Business device obtains the target data that request sends according to the history;
Second determining unit, for receiving the service when the time period between the current time and the object time When device obtains the target data that request sends according to the history, ask it is determined that receiving the server and being obtained according to the history Seek the target data of transmission.
Further, second judge module also includes:
Transmitting element, for not receiving the server when the time period between the current time and the object time When the target data that request sends is obtained according to the history, send the Target Acquisition request to the server;So that institute State server and the target data is returned according to Target Acquisition request.
Further, described device also includes:
Removing module, for from locally deleting Target Acquisition request.
The technical scheme that embodiments of the invention are provided can include following beneficial effect:In the present invention, when detect for When obtaining the Target Acquisition request of target data, if be transmitted across history in the forward direction server for detecting Target Acquisition request obtained Request is taken, and now terminal only need to be asked in local cache Target Acquisition without the need for Target Acquisition request being sent to server, Afterwards when terminal receives server obtains the target data that request sends according to history, it is possible to respond mesh with target data Mark obtains request.In embodiments of the present invention, ask in local cache Target Acquisition, and obtain without the need for target being sent to server Take request and can save Internet resources, secondly server will not also receive Target Acquisition request, also would not be to Target Acquisition Request is processed, so as to reduce the load of server.
Especially detect at short notice it is multiple for obtain target data Target Acquisitions ask when, if detected The forward direction server of the plurality of Target Acquisition request is transmitted across obtaining request for the history for obtaining target data, compared to existing Need all to send to server the request of the plurality of Target Acquisition in technology;The embodiment of the present invention is by the plurality of for obtaining mesh Mark data are buffered in locally, and the effect saved Internet resources and reduce the load of server becomes apparent from.
It should be appreciated that the general description of the above and detailed description hereinafter are only exemplary and explanatory, can not limit The system present invention.
Description of the drawings
During accompanying drawing herein is merged in description and the part of this specification is constituted, shows and meet embodiments of the invention, And be used to explain the principle of the present invention together with description.
Fig. 1 is a kind of flow chart of the request processing method according to an exemplary embodiment;
Fig. 2 is a kind of flow chart of the request processing method according to an exemplary embodiment;
Fig. 3 is a kind of flow chart of the request processing method according to an exemplary embodiment;
Fig. 4 is a kind of flow chart of the request processing method according to an exemplary embodiment;
Fig. 5 is a kind of block diagram of the request processing meanss according to an exemplary embodiment.
Specific embodiment
Here in detail exemplary embodiment will be illustrated, its example is illustrated in the accompanying drawings.Explained below is related to accompanying drawing When, unless otherwise indicated, the same numbers in different accompanying drawings represent same or analogous key element.In following exemplary embodiment Described embodiment does not represent all embodiments consistent with the present invention.Conversely, they are weighed with as appended by The example of consistent apparatus and method in terms of some described in detail in sharp claim, the present invention.
Fig. 1 is a kind of flow chart of the request processing method according to an exemplary embodiment, as shown in figure 1, the method Comprise the following steps.
In step S101, when detect ask for the Target Acquisition for obtaining target data when, judge to obtain detecting target Whether it is transmitted across obtaining request for the history for obtaining target data to server before taking request;
When history acquisition request is transmitted across in the forward direction server for detecting acquisition request, in step s 102, locally delaying Deposit Target Acquisition request;
In step s 103, judge whether that receiving server obtains the target data that request sends according to history;
When the target data that server is sent according to history acquisition request is received, in step S104, rung with target data Target Acquisition is answered to ask.
Wherein, the executive agent of the embodiment of the present invention can be terminal.
In the embodiment shown in Fig. 1 of the present invention, when detecting for obtaining the Target Acquisition request of target data, if History is transmitted across in the forward direction server for detecting Target Acquisition request and obtains request, now terminal is without the need for sending mesh to server Mark obtains request, only need to ask in local cache Target Acquisition, is obtained according to history when terminal receives server afterwards During the target data that request sends, it is possible to target data response Target Acquisition request.In embodiments of the present invention, at this Ground caching of target obtains request, and can save Internet resources without the need for sending Target Acquisition request to server, secondly server Target Acquisition request will not be also received, also Target Acquisition request would not be processed, so as to reduce the negative of server Lotus.
Especially detect at short notice it is multiple for obtain target data Target Acquisitions ask when, if detected The forward direction server of the plurality of Target Acquisition request is transmitted across obtaining request for the history for obtaining target data, compared to existing Need all to send to server the request of the plurality of Target Acquisition in technology;The embodiment of the present invention is by the plurality of for obtaining mesh Mark data are buffered in locally, and the effect saved Internet resources and reduce the load of server becomes apparent from.
Fig. 2 is a kind of flow chart of the request processing method according to an exemplary embodiment, as shown in Fig. 2 the method Comprise the following steps.
In step s 201, when detect ask for the Target Acquisition for obtaining target data when, judge to obtain detecting target Whether it is transmitted across obtaining request for the history for obtaining target data to server before taking request;
Wherein, target data can be price of international uniform time or a certain commodity etc., and contrast of the invention is not limited.
Wherein, Target Acquisition request can be that terminal receives other equipment transmission in locally directly generate, or terminal Etc., the embodiment of the present invention is not limited to the source that Target Acquisition is asked.
In embodiments of the present invention, if when terminal is detected exist locally for obtaining target data Target Acquisition and asking, Terminal will judge whether be transmitted across obtaining for the history for obtaining target data to server before Target Acquisition request is detected Take request.
When history acquisition request is transmitted across in the forward direction server for detecting Target Acquisition request, in step S202, at this Ground caching of target obtains request;Then execution step S204;
Generally, whenever terminal to server sends an acquisition request for being used to obtain target data, and in server After receiving the acquisition request, server will be returned according to the acquisition acquisition request target data and by the target data for obtaining To terminal;So terminal can just receive the target information that server is returned according to the acquisition request.
Therefore, in embodiments of the present invention, if be transmitted across for obtaining in the forward direction server for detecting Target Acquisition request The history of target data obtains request, then server will necessarily obtain request according to history and return target data to terminal;Due to Target Acquisition is asked and history obtains request and is provided to obtain target data;So, when terminal receives server according to going through After history obtains the target data that request is returned, terminal just can be with target data response Target Acquisition request.
So, when history acquisition request is transmitted across in the forward direction server for detecting Target Acquisition request, in order to save network Resource and reduce the load of server, then without the need for sending Target Acquisition request to server, only need to Target Acquisition request it is slow Exist locally, then execution step S204.
When history acquisition request was not transmitted across to server before Target Acquisition request is detected, in step S203, to Server sends Target Acquisition request;
So that server returns target data according to Target Acquisition request.
In embodiments of the present invention, if terminal needs target data is obtained from server, need to server to send to use In the acquisition request for obtaining target data, just meeting basis is used for the acquisition acquisition request target for obtaining target data to such server Data, and target data is returned to into terminal, such terminal can just receive the target data of server return, so as to realize Obtain the purpose of target data.
Therefore, when detect Target Acquisition request before not to server be transmitted across for obtain target data history obtain During request, server also would not return target data to terminal, and terminal would not also receive the number of targets of server return According to, also just cannot with target data response Target Acquisition request.
So, when history acquisition request was not transmitted across to server before Target Acquisition request is detected, in order to sound Target Acquisition is answered to ask, terminal needs to send Target Acquisition request to server, and so, server is receiving Target Acquisition After request, just according to Target Acquisition acquisition request target data and terminal is returned to, terminal receives server according to target Just can be with target data response Target Acquisition request, so as to realize responding Target Acquisition after obtaining the target data that request is returned The purpose of request.
In step S204, judge whether that receiving server obtains the target data that request sends according to history;
Have been described that in abovementioned steps description:If terminal to server is transmitted across history and obtains request, server one As can according to history obtain request to terminal return target data.Therefore, after the request of local cache Target Acquisition, terminal Need to only judge whether that receiving server obtains the target data that request sends according to history, and work as and receive server When obtaining the target data that request sends according to history, execution step S205.
When the target data that server is sent according to history acquisition request is received, in step S205, rung with target data Target Acquisition is answered to ask;
In step S206, obtain from local delete target and ask.
Wherein, in embodiments of the present invention, after with target data response Target Acquisition request, then just have been realized in this The purpose of scheme, if being further continued for asking in local cache Target Acquisition, can waste local memory space, therefore, it is Saving memory space, after with target data response Target Acquisition request, from the local Target Acquisition request for deleting caching.
In the embodiment shown in Fig. 2 of the present invention, when detecting for obtaining the Target Acquisition request of target data, if History is transmitted across in the forward direction server for detecting Target Acquisition request and obtains request, now terminal is without the need for sending mesh to server Mark obtains request, only need to ask in local cache Target Acquisition, is obtained according to history when terminal receives server afterwards During the target data that request sends, it is possible to target data response Target Acquisition request.In embodiments of the present invention, at this Ground caching of target obtains request, and can save Internet resources without the need for sending Target Acquisition request to server, secondly server Target Acquisition request will not be also received, also Target Acquisition request would not be processed, so as to reduce the negative of server Lotus.
Especially detect at short notice it is multiple for obtain target data Target Acquisitions ask when, if detected The forward direction server of the plurality of Target Acquisition request is transmitted across obtaining request for the history for obtaining target data, compared to existing Need all to send to server the request of the plurality of Target Acquisition in technology;The embodiment of the present invention is by the plurality of for obtaining mesh Mark data are buffered in locally, and the effect saved Internet resources and reduce the load of server becomes apparent from.
Wherein, in embodiments of the present invention, target data is stored in server, and target data may be over time Change and change, such server is accomplished by being updated target data.
Wherein, the change frequency of some target datas is higher, and server is needed constantly to these updating target datas, for example, The international uniform time of real-time change, or, being accomplished by updating the price of a stock every 5 seconds.And some target datas Change frequency it is relatively low, server may every some time just need to updating target data, for example, the price of some mobile phones Usually stablize constant, just make a price reduction once within three months, such server updated once the price of the mobile phone every three months.
In the case where the change frequency of target data is higher, the ageing requirement of terminal-pair target data is just higher, so, Even if be transmitted across obtaining for the history for obtaining target data in the forward direction server for detecting Target Acquisition request ask, but such as Fruit terminal to server sends the delivery time and terminal of history acquisition request and detects between the detection moment of Target Acquisition request It is distant, then when the server that terminal is received just is likely to meet according to the target data that history obtains request return Effect property is required, i.e. according to the target data that history obtains request return, the server for receiving disclosure satisfy that response history is obtained The ageing demand of request, but the ageing demand of response Target Acquisition request can not be met, otherwise, standard can be led to not Really response Target Acquisition request.
Therefore, the target information of raising acquisition is ageing, and then can accurately respond Target Acquisition request, technical staff's meeting The first predetermined time period is set in terminal in advance, when being transmitted across for obtaining in the forward direction server for detecting Target Acquisition request After taking the history acquisition request of target data, needs judge to server transmission history to obtain the delivery time distance asked eventually Whether end detects time span between detection moment when Target Acquisition is asked less than the first predetermined time period, when being less than During the first predetermined time period, just can determine that and be transmitted across for obtaining target data in the forward direction server for detecting acquisition request History obtain request.
Specifically, referring to Fig. 3, the method can be realized by following flow process:
In step S301, the detection moment when detecting Target Acquisition and asking is obtained;
In step s 302, obtain the default corresponding relation between locally stored acquisition request and delivery time;
Wherein, in embodiments of the present invention, whenever terminal to server sends an acquisition request for being used to obtain target data, Then terminal will obtain local current time and as send for obtain target data acquisition request delivery time, so The default corresponding relation between locally stored acquisition request and delivery time is obtained afterwards, is judged whether in default corresponding relation Presence includes the record asked for the acquisition for obtaining target data.
Include for obtaining when obtaining the record asked of target data, then before illustrating once when existing in default corresponding relation It is transmitted across asking for the acquisition for obtaining target data to server, it is possible to use the delivery time of acquisition is replaced in the record Including delivery time, with to send for obtain target data acquisition request delivery time be updated.
When not existing in default corresponding relation including for obtaining the record of acquisition request of target data, then before illustrating not Once to server be transmitted across for obtain target data acquisition ask, can will be used for obtain target data acquisition request with The delivery time for obtaining is as a record storage in default corresponding relation.
In step S303, the target corresponding with the acquisition request for obtaining target data is searched in default corresponding relation Delivery time;
Wherein, in embodiments of the present invention, if never being transmitted across obtaining for obtaining obtaining for target data to server before Request is taken, is not then just existed in presetting corresponding relation including for obtaining the record of the acquisition request of target data, that is, is searched not To the target delivery time corresponding with the acquisition request for obtaining target data, therefore, in this case, in order to be able to Target Acquisition request is responded enough, terminal needs to send Target Acquisition request to server;So, server is receiving terminal Then target data will be returned to by terminal according to Target Acquisition acquisition request target data after the Target Acquisition request of transmission, So terminal can just receive the target data of server return, and with target data response Target Acquisition request, so as to reality The purpose of Target Acquisition request is responded now.
If once be transmitted across obtaining to server asked for the acquisition for obtaining target data before, in this step, exist In default corresponding relation, it is possible to find the target delivery time corresponding with the acquisition request for obtaining target data,
In step s 304, calculate the time span between detection moment and target delivery time;
Wherein it is possible to target delivery time and detection moment are carried out subtraction, a time span is obtained, by the time Length is used as the time span between detection moment and target delivery time.
In step S305, when the time span is less than the first predetermined time period, it is determined that detecting Target Acquisition request Forward direction server be transmitted across for obtain target data history obtain request.
Wherein, the first predetermined time period is the time span that technical staff is arranged in advance in the terminal, generally, eventually Hold to server the request for sending that a period of time can be spent in network transmission process, the data that server is returned to terminal are in net A period of time can be also spent in network transmitting procedure;Therefore, terminal to server sends the delivery time of request and terminal receives clothes The time of reception of the data that business device is returned according to request is inconsistent.
Wherein, when terminal to server sends a request, technical staff can record the delivery time for sending the request, And when terminal receives the data that server is returned according to the request, technical staff can be recorded when receiving the reception of the data Carve;Then calculate the time span between the delivery time and the time of reception;So, when terminal is repeatedly sent out to server After sending request and repeatedly receiving data of the server according to request return;Technical staff will calculate multiple time spans, The average length of time of the plurality of time span is counted, and as predetermined time period.
Certainly, in embodiments of the present invention, technical staff can determine the first predetermined time period also by additive method, The present invention is not limited to this, need to only cause the first predetermined time period determined to meet the demand of the present invention.
Wherein, when the time span is less than the first predetermined time period, illustrate between detection moment distance objective delivery time Closer to the distance, server also disclosure satisfy that the timeliness of response Target Acquisition request according to the target data that history obtains request return Property, thus may determine that be transmitted across obtaining for the history for obtaining target data in the forward direction server for detecting acquisition request asking Ask.
When the time span is more than or equal to the first predetermined time period, illustrate between detection moment distance objective delivery time It is distant, server according to history obtain request return target data possibly cannot meet response Target Acquisition request when Effect property, can only send Target Acquisition request to server, so that server returns target data according to Target Acquisition request, and Target data response Target Acquisition request is returned according to Target Acquisition request with the server for receiving, to meet response Target Acquisition That what is asked is ageing.Therefore, when the time span is more than or equal to the first predetermined time period, it is determined that detecting acquisition It is not transmitted across obtaining request for the history for obtaining target data to server before request.
Wherein, in the aforementioned embodiment, if terminal needs target data is obtained from server, need to server to send out Send and ask for the acquisition for obtaining target data, just meeting basis is used for the acquisition acquisition request for obtaining target data to such server Target data, and target data is returned to into terminal, such terminal can just receive the target data of server return, so as to Realize obtaining the purpose of target data.
However, in actual scene, data in transmitting procedure may be lost or malfunction, and for example, terminal to server The history of transmission obtains request and in transmitting procedure may lose or malfunction, and causes server receive completely or just True history obtains request, and server also just cannot return the target data that terminal is wanted to obtain, such terminal according to terminal Always all without the target data that server is returned according to history acquisition request is received, also cannot just realize timely responding to target Obtain the purpose of request.
Therefore, in still another embodiment of the process, can join in time with target data response Target Acquisition request to ensure See Fig. 4, step S204 includes:
In step S401, obtain it is after target delivery time, and be the with the time span between target delivery time The object time of two predetermined time periods;
Second predetermined time period can be identical with the first Preset Time, it is also possible to different from the first Preset Time, and the present invention is right This is than being limited.
In step S402, the time period between the detection moment and object time when detecting Target Acquisition and asking judges Whether receive server and the target data that request sends is obtained according to history;
Wherein, if server was received before the time reaches object time obtains the target data that request sends according to history, Then execution step S403;
If server is not also received when the time object time is reached obtains the target data that request sends according to history, Execution step S404.
The number of targets that request sends is obtained according to history when the time period between current time and object time receives server According to when, in step S403, it is determined that receive server according to history obtain request send target data;
The target that request sends is obtained according to history when the time period between current time and object time does not receive server During data, in step s 404, Target Acquisition request is sent to server.
The target that request sends is obtained according to history when the time period between detection moment and object time does not receive server During data, then illustrate that history obtains request loss or error during sending to server from terminal and causes server to fail Receive the request of complete or correct Target Acquisition, or, server according to history obtain the target data of acquisition request from Server is lost during sending to terminal or error causes terminal receive complete or correct target data, so Server cannot just receive server and obtain the target data that request is returned according to history, also just cannot be with server according to going through History obtains the target data response Target Acquisition request that request is returned, therefore, in order in time and respond Target Acquisition request, Terminal needs to send Target Acquisition request to server, so that server is asking to return number of targets to terminal according to Target Acquisition According to such terminal is after the target data that server is returned according to Target Acquisition request is received, it is possible to realize response target Obtain the purpose of request.
Wherein, in embodiments of the present invention, when terminal to server sends Target Acquisition asks, terminal can obtain local Current time simultaneously asks delivery time as Target Acquisition;Then in default corresponding relation, will with for obtaining target data The acquisition corresponding target delivery time of request be updated to Target Acquisition request delivery time.
Fig. 5 is a kind of block diagram of the request processing meanss according to an exemplary embodiment, as shown in figure 5, the device bag Include:
First judge module 11, for when detecting for obtaining the Target Acquisition request of target data, judging detecting Whether it is transmitted across obtaining request for the history for obtaining the target data to server before the Target Acquisition request;
Cache module 12, for obtaining when the server described in detect the forward direction of the Target Acquisition request is transmitted across the history When taking request, ask in Target Acquisition described in local cache;
Second judge module 13, for judging whether that receiving the server obtains the target that request sends according to the history Data;
Respond module 14, for when receive the server according to the history obtain request send target data when, with The target data responds the Target Acquisition request.
In the embodiment shown in Fig. 5 of the present invention, when detecting for obtaining the Target Acquisition request of target data, if History is transmitted across in the forward direction server for detecting Target Acquisition request and obtains request, now terminal is without the need for sending mesh to server Mark obtains request, only need to ask in local cache Target Acquisition, is obtained according to history when terminal receives server afterwards During the target data that request sends, it is possible to target data response Target Acquisition request.In embodiments of the present invention, at this Ground caching of target obtains request, and can save Internet resources without the need for sending Target Acquisition request to server, secondly server Target Acquisition request will not be also received, also Target Acquisition request would not be processed, so as to reduce the negative of server Lotus.
Especially detect at short notice it is multiple for obtain target data Target Acquisitions ask when, if detected The forward direction server of the plurality of Target Acquisition request is transmitted across obtaining request for the history for obtaining target data, compared to existing Need all to send to server the request of the plurality of Target Acquisition in technology;The embodiment of the present invention is by the plurality of for obtaining mesh Mark data are buffered in locally, and the effect saved Internet resources and reduce the load of server becomes apparent from.
Wherein, first judge module 11 includes:
First acquisition unit, for obtaining the detection moment when detecting the Target Acquisition and asking;
Second acquisition unit, for obtaining the default corresponding relation between locally stored acquisition request and delivery time;
Searching unit, it is relative with the acquisition request for obtaining the target data for searching in the default corresponding relation The target delivery time answered;
Computing unit, for calculating the time span between the detection moment and the target delivery time;
First determining unit, for when the time span is less than the first predetermined time period, it is determined that detecting the mesh Mark obtains the forward direction server of request and is transmitted across obtaining request for the history for obtaining the target data.
Further, described device also includes:
Sending module, obtains for not being transmitted across the history to the server before the Target Acquisition request is detected When taking request, the Target Acquisition request is sent to the server, so that the server is asked according to the Target Acquisition Return the target data.
Wherein, first judge module 11 also includes:
3rd acquiring unit, send current time local when the Target Acquisition is asked to the server and make for obtaining Delivery time is asked for Target Acquisition;
Updating block, for will be updated to the corresponding target delivery time of request that obtains for obtaining the target data The Target Acquisition asks delivery time.
Wherein, second judge module 13 includes:
4th acquiring unit, for obtain it is after the target delivery time, and between the target delivery time Time span is the object time of the second predetermined time period;
Judging unit, judged whether to receive the clothes for the time period between the detection moment and the object time Business device obtains the target data that request sends according to the history;
Second determining unit, for receiving the service when the time period between the current time and the object time When device obtains the target data that request sends according to the history, ask it is determined that receiving the server and being obtained according to the history Seek the target data of transmission.
Further, second judge module 13 also includes:
Transmitting element, for not receiving the server when the time period between the current time and the object time When the target data that request sends is obtained according to the history, send the Target Acquisition request to the server;So that institute State server and the target data is returned according to Target Acquisition request.
Further, described device also includes:
Removing module, for from locally deleting Target Acquisition request.
With regard to the device in above-described embodiment, wherein modules perform the concrete mode of operation in the reality about the method It has been described in detail in applying example, explanation will be not set forth in detail herein.
Those skilled in the art will readily occur to other realities of the present invention after considering description and putting into practice invention disclosed herein Apply scheme.The application is intended to any modification of the present invention, purposes or adaptations, these modifications, purposes or Adaptations follow the general principle of the present invention and including the undocumented common knowledge or used in the art of the present invention Use technological means.Description and embodiments are considered only as exemplary, and true scope and spirit of the invention are by appended right Requirement is pointed out.
It should be appreciated that the precision architecture for being described above and being shown in the drawings is the invention is not limited in, and can To carry out various modifications and changes without departing from the scope.The scope of the present invention is limited only by appended claim.

Claims (14)

1. a kind of request processing method, it is characterised in that methods described includes:
When detecting for obtaining the Target Acquisition request of target data, judged before the Target Acquisition request is detected Whether it is transmitted across obtaining request for the history for obtaining the target data to server;
When the server described in detect the forward direction of the Target Acquisition request is transmitted across the history obtains request, local Cache the Target Acquisition request;
Judge whether that receiving the server obtains the target data that request sends according to the history;
When the target data that the server is sent according to history acquisition request is received, responded with the target data The Target Acquisition request.
2. method according to claim 1, it is characterised in that the judgement asks it detecting the Target Acquisition It is front whether to be transmitted across obtaining request for the history for obtaining the target data to server, including:
Obtain the detection moment when detecting the Target Acquisition and asking;
Obtain the default corresponding relation between locally stored acquisition request and delivery time;
When the target transmission corresponding with the acquisition request for obtaining the target data is searched in the default corresponding relation Carve;
Calculate the time span between the detection moment and the target delivery time;
When the time span is less than the first predetermined time period, it is determined that taking in the forward direction for detecting the Target Acquisition request Business device is transmitted across obtaining request for the history for obtaining the target data.
3. method according to claim 1 and 2, it is characterised in that methods described also includes:
When the history acquisition request was not transmitted across to the server before the Target Acquisition request is detected, to institute State server and send the Target Acquisition request, so that the server returns the number of targets according to Target Acquisition request According to.
4. method according to claim 3, it is characterised in that it is described send the Target Acquisition to the server please After asking, also include:
Obtain current time local when the Target Acquisition is asked is sent to the server and send as Target Acquisition request Moment;
The target delivery time corresponding with the acquisition request for obtaining the target data is updated to the Target Acquisition please Seek delivery time.
5. method according to claim 2, it is characterised in that described to judge whether to receive the server according to institute State history and obtain the target data that request sends, including:
Obtain it is after the target delivery time, and with the time span between the target delivery time be second preset The object time of time span;
Time period between the detection moment and the object time judges whether that receiving the server goes through according to described History obtains the target data that request sends;
Obtained according to the history when the time period between the current time and the object time receives the server During the target data that request sends, it is determined that receiving the server obtains the target data that request sends according to the history.
6. method according to claim 5, it is characterised in that methods described also includes:
Obtained according to the history when the time period between the current time and the object time does not receive the server When taking the target data that request sends, the Target Acquisition request is sent to the server;So that the server is according to institute State Target Acquisition request and return the target data.
7. method according to claim 1, it is characterised in that described that the Target Acquisition is responded with the target data After request, also include:
Ask from the Target Acquisition is locally deleted.
8. it is a kind of to ask processing meanss, it is characterised in that described device includes:
First judge module, for when detecting for obtaining the Target Acquisition request of target data, judging detecting Whether it is transmitted across obtaining request for the history for obtaining the target data to server before stating Target Acquisition request;
Cache module, for being transmitted across the history acquisition when the server described in detect the forward direction of the Target Acquisition request During request, ask in Target Acquisition described in local cache;
Second judge module, for judging whether that receiving the server obtains the number of targets that request sends according to the history According to;
Respond module, for when the target data that the server is sent according to history acquisition request is received, with institute State target data and respond the Target Acquisition request.
9. device according to claim 8, it is characterised in that first judge module includes:
First acquisition unit, for obtaining the detection moment when detecting the Target Acquisition and asking;
Second acquisition unit, for obtaining the default corresponding relation between locally stored acquisition request and delivery time;
Searching unit, it is relative with the acquisition request for obtaining the target data for searching in the default corresponding relation The target delivery time answered;
Computing unit, for calculating the time span between the detection moment and the target delivery time;
First determining unit, for when the time span is less than the first predetermined time period, it is determined that detecting the mesh Mark obtains the forward direction server of request and is transmitted across obtaining request for the history for obtaining the target data.
10. device according to claim 8 or claim 9, it is characterised in that described device also includes:
Sending module, obtains for not being transmitted across the history to the server before the Target Acquisition request is detected When taking request, the Target Acquisition request is sent to the server, so that the server is asked according to the Target Acquisition Return the target data.
11. devices according to claim 10, it is characterised in that first judge module also includes:
3rd acquiring unit, send current time local when the Target Acquisition is asked to the server and make for obtaining Delivery time is asked for Target Acquisition;
Updating block, for will be updated to the corresponding target delivery time of request that obtains for obtaining the target data The Target Acquisition asks delivery time.
12. devices according to claim 9, it is characterised in that second judge module includes:
4th acquiring unit, for obtain it is after the target delivery time, and between the target delivery time Time span is the object time of the second predetermined time period;
Judging unit, judged whether to receive the clothes for the time period between the detection moment and the object time Business device obtains the target data that request sends according to the history;
Second determining unit, for receiving the service when the time period between the current time and the object time When device obtains the target data that request sends according to the history, ask it is determined that receiving the server and being obtained according to the history Seek the target data of transmission.
13. devices according to claim 12, it is characterised in that second judge module also includes:
Transmitting element, for not receiving the server when the time period between the current time and the object time When the target data that request sends is obtained according to the history, send the Target Acquisition request to the server;So that institute State server and the target data is returned according to Target Acquisition request.
14. devices according to claim 8, it is characterised in that described device also includes:
Removing module, for from locally deleting Target Acquisition request.
CN201510684388.6A 2015-10-20 2015-10-20 Request processing method and apparatus Pending CN106603613A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510684388.6A CN106603613A (en) 2015-10-20 2015-10-20 Request processing method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510684388.6A CN106603613A (en) 2015-10-20 2015-10-20 Request processing method and apparatus

Publications (1)

Publication Number Publication Date
CN106603613A true CN106603613A (en) 2017-04-26

Family

ID=58555114

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510684388.6A Pending CN106603613A (en) 2015-10-20 2015-10-20 Request processing method and apparatus

Country Status (1)

Country Link
CN (1) CN106603613A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109614407A (en) * 2018-12-10 2019-04-12 北京奇艺世纪科技有限公司 A kind of request processing method and equipment
CN113746868A (en) * 2021-11-04 2021-12-03 杭州安恒信息技术股份有限公司 Method, device, equipment and medium for optimizing server performance

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130178195A1 (en) * 2012-01-05 2013-07-11 Seven Networks, Inc. Detection and management of user interactions with foreground applications on a mobile device in distributed caching
CN103620576A (en) * 2010-11-01 2014-03-05 七网络公司 Caching adapted for mobile application behavior and network conditions
CN104035923A (en) * 2013-03-04 2014-09-10 阿里巴巴集团控股有限公司 Data inquiry method and device
CN104834370A (en) * 2014-02-12 2015-08-12 株式会社东芝 Data processing device, semiconductor device, display device, and control method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103620576A (en) * 2010-11-01 2014-03-05 七网络公司 Caching adapted for mobile application behavior and network conditions
US20130178195A1 (en) * 2012-01-05 2013-07-11 Seven Networks, Inc. Detection and management of user interactions with foreground applications on a mobile device in distributed caching
CN104035923A (en) * 2013-03-04 2014-09-10 阿里巴巴集团控股有限公司 Data inquiry method and device
CN104834370A (en) * 2014-02-12 2015-08-12 株式会社东芝 Data processing device, semiconductor device, display device, and control method

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109614407A (en) * 2018-12-10 2019-04-12 北京奇艺世纪科技有限公司 A kind of request processing method and equipment
CN113746868A (en) * 2021-11-04 2021-12-03 杭州安恒信息技术股份有限公司 Method, device, equipment and medium for optimizing server performance
CN113746868B (en) * 2021-11-04 2022-01-04 杭州安恒信息技术股份有限公司 Method, device, equipment and medium for optimizing server performance

Similar Documents

Publication Publication Date Title
CN105900391A (en) Real-time communications using RESTLIKE API
US9929930B2 (en) Reducing an amount of captured network traffic data to analyze
CN107871221B (en) Method and device for acquiring amount of marketable inventory
CN108810047B (en) Method and device for determining information push accuracy rate and server
CN110851290A (en) Data synchronization method and device, electronic equipment and storage medium
US20220369278A1 (en) Object monitoring methods and apparatuses, electronic devices and computer readable storage media
CN109783258A (en) A kind of message treatment method, device and server
CN109218041B (en) Request processing method and device for server system
CN106603613A (en) Request processing method and apparatus
CN112838980B (en) Message processing method, system, device, electronic equipment and storage medium
CN107634854B (en) Service data processing method and device
CN110222034A (en) A kind of database maintenance method and device
CN107688978B (en) Method and device for detecting repeated order information
CN102984138B (en) A kind of methods, devices and systems obtaining object
CN106506640A (en) A kind of processing method and processing device of SNMP requests
CN110765392A (en) Data loading method and device, storage medium and terminal
CN103051722B (en) A kind ofly determine the method whether page is held as a hostage and relevant device
CN112887162B (en) Method and apparatus for detecting anomalies
CN114465919A (en) Network service testing method, system, electronic equipment and storage medium
CN110493291A (en) A kind of method and apparatus handling HTTP request
CN112187842B (en) Local area network data processing system and local area network data processing method
CN114500036A (en) Method, device and medium for transmitting data
CN106407307A (en) Interaction method and interaction device for node data of distributed database
CN110377020B (en) Driving method, device and system of unmanned equipment
CN110941568A (en) Cache updating method, device, system, electronic equipment and 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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20170426