Summary of the invention
The purpose of the embodiment of the present application is to propose a kind of improved caching method and device, to solve background above technologyThe technical issues of part is mentioned.
In a first aspect, the embodiment of the present application provides a kind of caching method for proxy server, proxy server withCache server communication connection, this method comprises: extraction separately includes query statement and multiple historical datas of query time are looked intoAsk request;Extracted query time is parsed, determines multiple hot spot periods;For every in multiple hot spot periodsOne hot spot period, the query statement belonged in the inquiry of historical data request of hot spot period to query time are unitedMeter, the determining hotspot query sentence to match with the hot spot period;It extracts corresponding with identified hotspot query sentenceQuery result will be corresponding to the hotspot query sentence that matched with the period in the initial time of each hot spot periodQuery result store to cache server, and the finish time of the hot spot period delete cache server in inquiry knotFruit.
In some embodiments, this method further include: identified hotspot query sentence is parsed, abstract letter is generatedBreath;Initial time and finish time in each hot spot period update the summary info index pre-established, wherein pluckInformation index is wanted to be used to indicate the corresponding relationship of summary info with the query result being stored in cache server.
In some embodiments, proxy server is also communicated to connect with search server;And this method further include: responseIn receiving data inquiry request that client is sent, comprising target query sentence, target query sentence is parsed, it is rawAt target summary info, and determines in current summary info index and whether there is target summary info;It is current in response to determiningSummary info index in be not present target summary info, to search server send data inquiry request, receive search serviceThe data that device returns, and send data to client.
In some embodiments, this method further include: in response to there are targets to pluck in the current summary info index of determinationInformation is wanted, obtains corresponding with target summary info target query from cache server as a result, and by target query resultIt is sent to client.
In some embodiments, in response to receiving data query that client is sent, comprising target query sentenceAfter request, this method further include: determine whether data inquiry request includes to be used to indicate from cache server query caching numberAccording to inquiry mark;Do not include inquiry mark in response to determining, send data inquiry request to search server, receives search clothesThe data that business device returns, and send data to client.
In some embodiments, data inquiry request further includes cache way mark;And this method further include: in response toIt determines in current summary info index there is no target summary info, determines that the indicated cache way of cache way mark isNo is target cache mode;In response to determining that the indicated cache way of cache way mark is target cache mode, by dataInquiry request is determined as the inquiry of historical data request, periodically parses to each historical query request, to redefineHot spot period and hotspot query sentence, and caching clothes are carried out based on the hot spot period and hotspot query sentence redefinedThe storage and delete operation of business device.
In some embodiments, this method further include: in response to determining the indicated cache way of cache way mark notIt is target cache mode, is looked into target corresponding with target summary info based on the indicated cache way of cache way markIt askes result to store to cache server, and establishes and be used to indicate plucking for target summary info and the corresponding relationship of target query resultWant information index.
In some embodiments, it is parsed to extracted query time, it, should after determining multiple hot spot periodsMethod further include: it is time-consuming to extract inquiry corresponding to each the inquiry of historical data request in multiple the inquiry of historical data requests;Determine extracted query statement in the cache hit rate of each hot spot period and the time-consuming threshold value of inquiry, wherein extractedInquiry time-consuming threshold value of the query statement in each hot spot period be in the hot spot period, the historical data of preset ratioThe time-consuming minimum value of inquiry corresponding to inquiry request;Show that caching of the extracted query statement in each hot spot period is orderedMiddle rate and the time-consuming threshold value of inquiry.
Second aspect, the embodiment of the present application provide a kind of buffer storage for proxy server, which is characterized in that generationIt manages server and cache server communicates to connect, which includes: the first extraction unit, is configured to extraction and separately includes inquiryThe request of multiple the inquiry of historical data of sentence and query time;Resolution unit is configured to carry out extracted query timeParsing, determines multiple hot spot periods;Statistic unit was configured to for each of the multiple hot spot periods hot spot timeSection, the query statement belonged in the inquiry of historical data request of hot spot period to query time count, and determine and are somebody's turn to doThe hotspot query sentence that the hot spot period matches;First cache unit is configured to extract and identified hotspot query languageThe corresponding query result of sentence, in the initial time of each hot spot period, the hotspot query that will be matched with the periodQuery result corresponding to sentence is stored to cache server, and deletes cache server in the finish time of the hot spot periodIn query result.
In some embodiments, the device further include: generation unit, be configured to identified hotspot query sentence intoRow parsing, generates summary info;Updating unit is configured to initial time and finish time in each hot spot period,Update the summary info index pre-established, wherein summary info index is used to indicate summary info and is stored in buffer serviceThe corresponding relationship of query result in device.
In some embodiments, proxy server is also communicated to connect with search server;And device further include: firstDetermination unit is configured in response to receiving data inquiry request that client is sent, comprising target query sentence, to meshMark query statement is parsed, and target summary info is generated, and is determined and plucked in current summary info index with the presence or absence of targetWant information;First transmission unit is configured in response to target summary info is not present in the current summary info index of determination,Data inquiry request is sent to search server, receives the data that search server returns, and send data to client.
In some embodiments, device further include: the second transmission unit is configured to the abstract current in response to determinationThere are target summary infos in information index, and target query knot corresponding with target summary info is obtained from cache serverFruit, and target query result is sent to client.
In some embodiments, device further include: the second determination unit is configured to whether determine data inquiry requestIt is identified comprising being used to indicate from the inquiry of cache server query caching data;Third transmission unit, is configured in response to trueIt is fixed not include inquiry mark, data inquiry request is sent to search server, receives the data that search server returns, and will countAccording to being sent to client.
In some embodiments, data inquiry request further includes cache way mark;And device further include: third is trueOrder member is configured to determine cache way in response to there is no target summary infos in the current summary info index of determinationWhether the indicated cache way of mark is target cache mode;Second cache unit is configured in response to determining caching sideThe indicated cache way of formula mark is target cache mode, and data inquiry request is determined as the inquiry of historical data request, weekPhase property each historical query request is parsed, to redefine hot spot period and hotspot query sentence, and is based on instituteThe hot spot period redefined and hotspot query sentence carry out the storage and delete operation of cache server.
In some embodiments, device further include: third cache unit is configured in response to determining cache way markKnowing indicated cache way is not target cache mode, will be plucked with target based on the indicated cache way of cache way markThe corresponding target query result of information is wanted to store to cache server, and foundation is used to indicate target summary info and looks into targetAsk the summary info index of the corresponding relationship of result.
In some embodiments, device further include: the second extraction unit is configured to extract multiple the inquiry of historical dataInquiry corresponding to each the inquiry of historical data request in request is time-consuming;4th determination unit is configured to determination and is extractedQuery statement each hot spot period cache hit rate and inquire time-consuming threshold value, wherein extracted query statement existsThe time-consuming threshold value of the inquiry of each hot spot period is in the hot spot period, the inquiry of historical data of preset ratio request instituteThe time-consuming minimum value of corresponding inquiry;Display unit is configured to show extracted query statement in each hot spot periodCache hit rate and inquire time-consuming threshold value.
The third aspect, the embodiment of the present application provide a kind of proxy server, comprising: one or more processors;StorageDevice, for storing one or more programs, when one or more programs are executed by one or more processors so that one orMultiple processors are realized such as the method for any embodiment in the caching method of proxy server.
Caching method and device provided by the embodiments of the present application, by looking into the request of extracted the inquiry of historical dataThe inquiry time is parsed to determine multiple hot spot periods, and the historical data for then belonging to the hot spot period to query time is looked intoThe query statement ask in request is counted to determine hotspot query sentence, finally determines the corresponding inquiry knot of hotspot query sentenceFruit takes to store query result corresponding to corresponding hotspot query sentence to caching in the initial time of hot spot periodBusiness device, and corresponding query result is deleted in the finish time of hot spot period, to realize based on hot spot period dynamicSwitching caching, improves the flexibility of caching.
Specific embodiment
The application is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouchedThe specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order toConvenient for description, part relevant to related invention is illustrated only in attached drawing.
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phaseMutually combination.The application is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 is shown can be using the caching method of the application or the exemplary system architecture 100 of buffer storage.
As shown in Figure 1, system architecture 100 may include terminal device 101,102,103, network 104,106, agency serviceDevice 105 and cache server 107.Network 104 between terminal device 101,102,103 and proxy server 105 to provideThe medium of communication link, network 106 between proxy server 105 and cache server 107 to provide Jie of communication linkMatter.Network 104,106 may include various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 101,102,103 and be interacted by network 104 with proxy server 105, to receiveOr send message etc., such as send data inquiry request.Various communication clients can be installed on terminal device 101,102,103End application, such as shopping class application, web browser applications, searching class application, instant messaging tools, mailbox client, social activityPlatform software etc..
Terminal device 101,102,103 can be the various electronic equipments with display screen and supported web page browsing, packetInclude but be not limited to smart phone, tablet computer, pocket computer on knee and desktop computer etc..
Proxy server 105 can be to provide the server of various services, such as be sent out terminal device 101,102,103The data inquiry request sent such as is stored, is analyzed at the server of processing.Proxy server 105 can look into stored dataIt askes request to request as the inquiry of historical data, the information such as query statement, query time in the inquiry of historical data request is carried outThe processing such as analysis, statistics, and it is based on processing result, it is interacted by network 106 and cache server 107, to store or deleteExcept the information (such as the corresponding query result of query statement) etc. in cache server 107.
Cache server 107 can be used for storing the content frequently accessed, such as query result corresponding to query statement.Cache server 107 can be managed the query result stored.
It should be pointed out that can also include network 108 and search server 109 in above-mentioned example system architecture 100.Proxy server 105 can also be interacted by network 108 and search server 109, to receive or send message etc.,
It should be noted that caching method provided by the embodiment of the present application is generally executed by proxy server 105, accordinglyGround, buffer storage are generally positioned in proxy server 105.
It should be understood that the number of terminal device, network and server in Fig. 1 is only schematical.According to realization needIt wants, can have any number of terminal device, network, proxy server, cache server and search server.
With continued reference to Fig. 2, the process 200 of one embodiment of the caching method according to the application is shown.Described is slowDeposit method, comprising the following steps:
Step 201, the multiple the inquiry of historical data request for separately including query statement and query time is extracted.
In the present embodiment, the electronic equipment (such as proxy server 105 shown in FIG. 1) of caching method operation thereonIt can be using data inquiry request received in specified period (such as nearly one week, the previous day, nearly one month etc.) as historyData inquiry request simultaneously extracts the inquiry of historical data request.It wherein, can be in each the inquiry of historical data request more extractedInclude query statement and query time.Here, query statement can be comprising search term (such as character string " mobile phone ", " movementClothes " etc.) and querying condition (such as deliver city be Beijing, supplier is certain e-commerce sample platform etc.) etc. information sentence.It looks intoThe inquiry time can be the time for receiving the inquiry of historical data request.
In practice, the inquiry of historical data request be can store in above-mentioned electronic equipment local, at this point, above-mentioned electronic equipment canWith directly from be locally extracted the inquiry of historical data request.In addition, the inquiry of historical data request also can store with above-mentioned electronicsIn another storage equipment that equipment is connected, at this point, above-mentioned electronic equipment can pass through wired connection mode or wireless connectionMode extracts the inquiry of historical data request from above-mentioned storage equipment.It should be pointed out that above-mentioned radio connection can wrapInclude but be not limited to 3G/4G connection, WiFi connection, bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultraWideband) connection and other currently known or exploitation in the future radio connections.
Step 202, extracted query time is parsed, determines multiple hot spot periods.
In the present embodiment, above-mentioned electronic equipment can with extracted above-mentioned multiple the inquiry of historical data request is wrappedThe query time contained is parsed, and determines multiple hot spot periods.Wherein, the hot spot period can be that meet technical staff preparatoryThe period of some or certain conditions of setting.As an example, the duration that above-mentioned preset condition can be the period isPreset duration (such as 10 minutes) and the daily quantity of data inquiry request during this period of time be greater than default value (such as3000000).Above-mentioned electronic equipment can be for statistical analysis to extracted query time, determines to meet above-mentioned conditionPeriod (such as daily 9:30 to 9:40, daily 20:00-20:10 etc.), and when the period determined is determined as hot spotBetween section.
In some optional implementations of the present embodiment, is parsed to above-mentioned query time, determine multiple heatAfter the point period, above-mentioned electronic equipment can also extract each history number in above-mentioned multiple the inquiry of historical data requests firstAccording to the time-consuming of inquiry corresponding to inquiry request.Wherein, above-mentioned inquiry time-consuming can be above-mentioned electronic equipment and (such as scheme to clientTerminal device 101 shown in 1,102,103) return to the time of query result and above-mentioned electronic equipment receives the inquiry of historical dataThe interval duration of the time of request.Later, above-mentioned electronic equipment can determine extracted query statement in each hot spot timeThe cache hit rate of section and the time-consuming threshold value of inquiry.Wherein, caching of the extracted query statement in each hot spot period is orderedMiddle rate can be in extracted query statement, corresponding query result and be stored to caching clothes in the hot spot periodThe ratio of the total quantity of the quantity and extracted query statement of the query statement of business device.It should be noted that extracted look intoAsk sentence each hot spot period inquiry time-consuming threshold value can be in the hot spot period, preset ratio (such as99%) the time-consuming minimum value of the corresponding inquiry of the inquiry of historical data request.It is mentioned finally, above-mentioned electronic equipment can be shownThe query statement taken is in the cache hit rate of each hot spot period and the time-consuming threshold value of inquiry.
Step 203, for the hot spot period each of multiple hot spot periods, when belonging to the hot spot to query timeBetween section the inquiry of historical data request in query statement counted, the determining hotspot query to match with the hot spot periodSentence.
In the present embodiment, for hot spot period each of above-mentioned multiple hot spot periods, above-mentioned electronic equipmentThe query statement that can belong to query time in the inquiry of historical data request of the hot spot period counts, based on statisticsAs a result, the determining hotspot query sentence to match with the hot spot period.It should be noted that above-mentioned electronic equipment can useThe determining hotspot query sentence to match with the hot spot period of various modes.As an example, query time can be belonged to thisQuery statement in each the inquiry of historical data request of hot spot period is determined as the hot spot to match with the hot spot periodQuery statement;It is most that query time can also be belonged to frequency of occurrence in the inquiry of historical data request of the hot spot periodQuery statement is determined as the hotspot query sentence to match with the hot spot period;This can also be belonged to by query time firstQuery statement in the inquiry of historical data request of hot spot period is ranked up according to the descending sequence of frequency of occurrence, willThe query statement of the biggish preset quantity of frequency of occurrence (such as 50,100 etc.) after sequence is determined as and the hot spot timeThe hotspot query sentence that section matches.
In some optional implementations of the present embodiment, above-mentioned electronic equipment can also receive above-mentioned client and sendPreset time period and the default query statement that matches with above-mentioned preset time period, wherein above-mentioned preset time period and defaultQuery statement can be inquiry habit setting of the user according to oneself.Above-mentioned electronic equipment is receiving above-mentioned preset time periodIt, can be using above-mentioned preset time period as the hot spot period, to replace above-mentioned electronic equipment pair after above-mentioned default query statementQuery time in the inquiry of historical data request generates the hot spot period after being parsed.In addition, above-mentioned electronic equipment can be straightIt connects using received default query statement as the hotspot query sentence to match with the hot spot period.
Step 204, query result corresponding with identified hotspot query sentence is extracted, in each hot spot periodInitial time, query result corresponding to the hotspot query sentence to match with the period is stored to cache server,And the query result in cache server is deleted in the finish time of the hot spot period.
In the present embodiment, above-mentioned electronic equipment can extract inquiry knot corresponding with identified hotspot query sentenceFruit.As an example, if some hotspot query sentence is used to indicate the product information to delivery city for Pekinese's cell phone type productInquiry, then be the product letter that city is Pekinese's cell phone type product of delivering with query result corresponding to the hotspot query sentenceBreath.In the hotspot query that the initial time of each hot spot period, above-mentioned electronic equipment can will match with the periodQuery result corresponding to sentence is stored to cache server (such as the caching shown in FIG. 1 being connected with above-mentioned electronic equipmentServer 107), and the above-mentioned query result in cache server is deleted in the finish time of the hot spot period.
With continued reference to the schematic diagram that Fig. 3, Fig. 3 are according to the application scenarios of the caching method of the present embodiment.Fig. 3'sIn application scenarios, proxy server 301 extracts the multiple history numbers for separately including query statement 302 and query time 303 firstAccording to inquiry request;Then, proxy server 301 parses extracted query time 303, determines multiple hot spot periods304;Later, proxy server 301 is based on query statement 302 and hot spot period 304, what the determining and hot spot period matchedHotspot query sentence 305;Finally, proxy server 301 extracts inquiry knot corresponding with identified hotspot query sentence 305Fruit 306 will look into the initial time of each hot spot period corresponding to the hotspot query sentence to match with the periodIt askes result to store to above-mentioned cache server 307, and is deleted in above-mentioned cache server in the finish time of the hot spot periodCorresponding query result.
The method provided by the above embodiment of the application, by extracted the inquiry of historical data request in inquiry whenBetween parsed to determine multiple hot spot periods, the inquiry of historical data for then belonging to the hot spot period to query time is askedQuery statement in asking is counted to determine hotspot query sentence, finally determines the corresponding query result of hotspot query sentence,So that query result corresponding to corresponding hotspot query sentence is stored to buffer service in the initial time of hot spot periodDevice, and corresponding query result is deleted in the finish time of hot spot period, it is cut to realize based on hot spot period dynamicCaching is changed, the flexibility of caching is improved.
With further reference to Fig. 4, it illustrates the processes 400 of another embodiment of caching method.The stream of the caching methodJourney 400, comprising the following steps:
Step 401, the multiple the inquiry of historical data request for separately including query statement and query time is extracted.
In the present embodiment, the electronic equipment (such as proxy server 105 shown in FIG. 1) of caching method operation thereonReceived data inquiry request requests as the inquiry of historical data and extracts the inquiry of historical data during can specifyingRequest.Wherein, query statement and query time be may include in the inquiry of historical data request.
Step 402, extracted query time is parsed, determines multiple hot spot periods.
In the present embodiment, above-mentioned electronic equipment can with extracted above-mentioned multiple the inquiry of historical data request is wrappedThe query time contained is parsed, and determines multiple hot spot periods.Wherein, the hot spot period can be that meet technical staff preparatoryThe period of some or certain conditions of setting.
Step 403, for the hot spot period each of multiple hot spot periods, when belonging to the hot spot to query timeBetween section the inquiry of historical data request in query statement counted, the determining hotspot query to match with the hot spot periodSentence.
In the present embodiment, for hot spot period each of above-mentioned multiple hot spot periods, above-mentioned electronic equipmentThe query statement that can belong to query time in the inquiry of historical data request of the hot spot period counts, based on statisticsAs a result, can use the determining hotspot query sentence to match with the hot spot period of various modes.
Step 404, query result corresponding with identified hotspot query sentence is extracted, in each hot spot periodInitial time, query result corresponding to the hotspot query sentence to match with the period is stored to cache server,And the query result in cache server is deleted in the finish time of the hot spot period.
In the present embodiment, above-mentioned electronic equipment can extract inquiry knot corresponding with identified hotspot query sentenceFruit.In the hotspot query that the initial time of each hot spot period, above-mentioned electronic equipment can will match with the periodQuery result corresponding to sentence is stored to cache server (such as the caching shown in FIG. 1 being connected with above-mentioned electronic equipmentServer 107), and the above-mentioned query result in cache server is deleted in the finish time of the hot spot period.
It should be noted that the concrete operations of above-mentioned steps 401-404 and the concrete operations of above-mentioned steps 201-204 are basicIdentical, details are not described herein.
Step 405, identified hotspot query sentence is parsed, generates summary info.
In the present embodiment, above-mentioned electronic equipment can use various digest algorithms to each identified hotspot querySentence is parsed, and information generated after parsing is determined as to the summary info of the hotspot query sentence.Wherein, summary infoIt can be the character string for characterizing and uniquely determining hotspot query sentence, the summary info of different hotspot query sentences is notTogether.It should be noted that above-mentioned digest algorithm can be Hash (Hash) algorithm, MD2 (Message Digest Algorithm2, the Message Digest 5 second edition) etc..It should be pointed out that above-mentioned digest algorithm is the known skill studied and applied extensively at presentArt, details are not described herein.
Step 406, the initial time in each hot spot period and finish time update the summary info pre-establishedIndex.
In the present embodiment, above-mentioned electronic equipment can initial time in each hot spot period and finish time,Update the summary info index pre-established, wherein above-mentioned summary info index can serve to indicate that summary info and be stored inThe corresponding relationship of query result in above-mentioned cache server.Specifically, above-mentioned electronic equipment can be in each hot spot timeThe initial time of section, the corresponding relationship of the corresponding summary info of hotspot query sentence of the hot spot period and query result is addedIt is added to above-mentioned summary info index, and in the finish time of the hot spot period, deletes the hotspot query language of hot spot periodThe corresponding relationship of sentence corresponding summary info and query result.
Step 407, in response to receiving data inquiry request that client is sent, comprising target query sentence, to meshMark query statement is parsed, and target summary info is generated, and is determined and plucked in current summary info index with the presence or absence of targetWant information.
In the present embodiment, in response to receiving data inquiry request that client is sent, comprising target query sentence,Above-mentioned electronic equipment can parse above-mentioned target query sentence, generate target summary info, and determine current abstractIt whether there is above-mentioned target summary info in information index.It should be noted that above-mentioned electronic equipment can use and step 405Identical digest algorithm carries out the generation of target summary info, and details are not described herein.
It should be pointed out that in response to determination it is current summary info index in there are above-mentioned target summary info, it is above-mentionedElectronic equipment can execute step 409;In response to above-mentioned target summary info is not present in the current summary info index of determination,Above-mentioned electronic equipment can execute step 408 and/or step 410.
In some optional implementations of the present embodiment, after receiving above-mentioned data inquiry request, above-mentioned electricitySub- equipment can also determine whether above-mentioned data inquiry request includes to be used to indicate from above-mentioned cache server query caching firstThe inquiry of data identifies.Herein, inquiry mark can be the character string being made of various characters.In response to determining not comprising above-mentionedInquiry mark, above-mentioned electronic equipment can be (such as shown in FIG. 1 to the above-mentioned search server being connected with above-mentioned electronic equipmentSearch server 109) above-mentioned data inquiry request is sent, to receive the data that above-mentioned search server returns, and by above-mentioned numberAccording to being sent to above-mentioned client.It is identified it should be noted that not including above-mentioned inquiry in response to determination, above-mentioned electronic equipment is being incited somebody to actionAbove-mentioned data are sent to after above-mentioned client, can no longer be executed and be determined in current summary info index with the presence or absence of above-mentionedThe step of target summary info and step 408-412.In response to determining that not including above-mentioned inquiry identifies, then can continue to executeGenerating summary info and determining in current summary info index in the step whether there is above-mentioned target summary infoStep then executes subsequent step 408-412.
Step 408, in response to target summary info is not present in the current summary info index of determination, to search serverData inquiry request is sent, receives the data that search server returns, and send data to client.
In the present embodiment, determine that there is no above-mentioned targets to make a summary in current summary info index in response to step 407Information, above-mentioned electronic equipment can send above-mentioned data inquiry request to above-mentioned search server, to receive above-mentioned search serviceThe data that device returns, and above-mentioned data are sent to above-mentioned client.
Step 409, in response to there are target summary infos in the current summary info index of determination, from cache serverTarget query corresponding with target summary info is obtained as a result, and target query result is sent to client.
In the present embodiment, determine that there are above-mentioned target abstracts to believe in current summary info index in response to step 407Breath, above-mentioned electronic equipment can obtain target query knot corresponding with above-mentioned target summary info from above-mentioned cache serverFruit, and above-mentioned target query result is sent to above-mentioned client.
Step 410, in response to target summary info is not present in the current summary info index of determination, cache way is determinedWhether the indicated cache way of mark is target cache mode.
In the present embodiment, above-mentioned data inquiry request can also include that cache way identifies, wherein cache way markIt can serve to indicate that and determine cache way.For example, above-mentioned cache way can be target cache mode, the caching based on queueMode, cache way based on weight etc..Wherein, above-mentioned target cache mode can be according to hot spot period and hotspot queryThe cache way that sentence is cached is used to indicate the initial time in each hot spot period, will be with the period phaseQuery result corresponding to matched hotspot query sentence is stored to above-mentioned cache server, and in the end of the hot spot periodMoment deletes the cache way of the above-mentioned query result in above-mentioned cache server.The above-mentioned cache way based on queue can be usedIn the cache way that instruction caches the data of newest accessed preset quantity.The above-mentioned cache way based on weight canWeight calculation is carried out by data of the arbitrary existing weighing computation method to access to be used to indicate, weight is higher pre-If the cache way that the data of quantity are cached.
In the present embodiment, determine that there is no above-mentioned targets to make a summary in current summary info index in response to step 407Information, above-mentioned electronic equipment can determine whether the indicated cache way of above-mentioned cache way mark is above-mentioned target cache sideFormula.If so, step 411 can be executed, if it is not, step 412 can be executed.
Step 411, in response to determining that the indicated cache way of cache way mark is target cache mode, data are looked intoIt askes request and is determined as the inquiry of historical data request, periodically each historical query request is parsed, to redefine heatPoint period and hotspot query sentence, and buffer service is carried out based on the hot spot period redefined and hotspot query sentenceThe storage and delete operation of device.
In the present embodiment, determine that the indicated above-mentioned cache way of above-mentioned cache way mark is in response to step 410Above-mentioned data inquiry request can be determined as the inquiry of historical data request, week by above-mentioned target cache mode, above-mentioned electronic equipmentPhase property each historical query request is parsed, to redefine hot spot period and hotspot query sentence, and is based on instituteThe hot spot period redefined and hotspot query sentence carry out the storage and delete operation of cache server.It needs to illustrateIt is hot spot period and the operation of hotspot query sentence to be redefined in this step and the operation of above-mentioned steps 402-403 is basicIdentical, details are not described herein.
Step 412, in response to determining that the indicated cache way of cache way mark is not target cache mode, based on slowThe mode of depositing identifies indicated cache way and stores target query result corresponding with target summary info to buffer serviceDevice, and establish the summary info index for being used to indicate the corresponding relationship of target summary info and target query result.
In the present embodiment, the indicated above-mentioned cache way of above-mentioned cache way mark is determined not in response to step 410Above-mentioned target cache mode, above-mentioned electronic equipment can be identified based on above-mentioned cache way indicated cache way will with it is upperIt states the corresponding target query result of target summary info to store to above-mentioned cache server, and establishes and be used to indicate above-mentioned targetThe summary info of summary info and the corresponding relationship of above-mentioned target query result indexes.
Figure 4, it is seen that the process 400 of the caching method in the present embodiment is prominent compared with the corresponding embodiment of Fig. 2Go out to receiving judgement and processing step after data inquiry request.The scheme of the present embodiment description can not only adopt as a result,With the mode cached based on hot spot period switching at runtime, it is also based on other cache way and is cached, further mentionedThe high flexibility of caching
With further reference to Fig. 5, as the realization to method shown in above-mentioned each figure, this application provides a kind of buffer storagesOne embodiment, the Installation practice is corresponding with embodiment of the method shown in Fig. 2, which specifically can be applied to agency's clothesIt is engaged in device, above-mentioned proxy server and cache server communicate to connect.
As shown in figure 5, buffer storage 500 described in the present embodiment includes: the first extraction unit 501, it is configured to extractSeparately include multiple the inquiry of historical data request of query statement and query time;Resolution unit 502 is configured to being extractedQuery time parsed, determine multiple hot spot periods;Statistic unit 503, when being configured to for above-mentioned multiple hot spotsBetween each of the section hot spot period, the inquiry in the inquiry of historical data request of hot spot period is belonged to query timeSentence is counted, the determining hotspot query sentence to match with the hot spot period;First cache unit 504, is configured toCorresponding with identified hotspot query sentence query result is extracted, it, will be in the initial time of each hot spot periodQuery result corresponding to the hotspot query sentence that the period matches is stored to above-mentioned cache server, and in the hot spotBetween finish time of section delete the above-mentioned query result in above-mentioned cache server.
In the present embodiment, above-mentioned first extraction unit 501 data query received during can specifying is askedIt asks and the inquiry of historical data request is requested and extracted as the inquiry of historical data.Wherein, it may include in the inquiry of historical data requestQuery statement and query time.
In the present embodiment, resolution unit 502 can with extracted above-mentioned multiple the inquiry of historical data request is wrappedThe query time contained is parsed, and determines multiple hot spot periods.Wherein, the hot spot period can be that meet technical staff preparatoryThe period of some or certain conditions of setting.
In the present embodiment, for the hot spot period each of above-mentioned multiple hot spot periods, statistic unit 503 canIt is counted with the query statement in belonging to the inquiry of historical data request of hot spot period to query time, based on statistics knotFruit, the determining hotspot query sentence to match with the hot spot period.
In the present embodiment, the first cache unit 504 can extract look into corresponding with identified hotspot query sentenceAsk result.It, can be right by the hotspot query sentence institute to match with the period in the initial time of each hot spot periodThe query result answered is stored to above-mentioned cache server, and is deleted in cache server in the finish time of the hot spot periodAbove-mentioned query result.
In some optional implementations of the present embodiment, above-mentioned buffer storage 500 can also include generation unit andUpdating unit (not shown).Wherein, above-mentioned generation unit may be configured to carry out identified hotspot query sentenceParsing generates summary info.Above-mentioned updating unit may be configured to initial time and end in each hot spot periodMoment updates the summary info index pre-established, wherein above-mentioned summary info index is used to indicate summary info and is stored inThe corresponding relationship of query result in above-mentioned cache server.
In some optional implementations of the present embodiment, above-mentioned proxy server also with search server communication linkIt connects.Above-mentioned buffer storage 500 can also include the first determination unit and the first transmission unit (not shown).Wherein, above-mentionedFirst determination unit may be configured to ask in response to receiving client the is sent, data query comprising target query sentenceAsk, above-mentioned target query sentence parsed, generate target summary info, and determine in current summary info index whetherThere are above-mentioned target summary infos.Above-mentioned first transmission unit may be configured to the summary info index current in response to determinationIn above-mentioned target summary info is not present, send above-mentioned data inquiry request to above-mentioned search server, receive above-mentioned search clothesThe data that business device returns, and above-mentioned data are sent to above-mentioned client.
In some optional implementations of the present embodiment, above-mentioned buffer storage 500 can also include that the second transmission is singleFirst (not shown).Wherein, above-mentioned second transmission unit may be configured to the summary info index current in response to determinationIn there are above-mentioned target summary info, obtain target corresponding with above-mentioned target summary info from above-mentioned cache server and look intoIt askes as a result, and above-mentioned target query result is sent to above-mentioned client.
Above-mentioned buffer storage 500 can also include the second determination unit in some optional implementations of the present embodimentWith third transmission unit (not shown).Wherein, above-mentioned second determination unit may be configured to determine above-mentioned data queryWhether request identifies comprising being used to indicate from the inquiry of above-mentioned cache server query caching data.Above-mentioned third transmission unit canTo be configured in response to determining that not including above-mentioned inquiry identifies, and sends above-mentioned data inquiry request to above-mentioned search server,The data that above-mentioned search server returns are received, and above-mentioned data are sent to above-mentioned client.
In some optional implementations of the present embodiment, above-mentioned data inquiry request further includes cache way mark.Above-mentioned buffer storage 500 can also include third determination unit and the second cache unit (not shown).Wherein, above-mentioned thirdDetermination unit may be configured to determine in response to there is no above-mentioned target summary infos in the current summary info index of determinationWhether the indicated cache way of above-mentioned cache way mark is target cache mode.Above-mentioned second cache unit can configure useIn being above-mentioned target cache mode in response to the indicated above-mentioned cache way of the above-mentioned cache way mark of determination, by above-mentioned dataInquiry request is determined as the inquiry of historical data request, periodically parses to each historical query request, to redefineHot spot period and hotspot query sentence, and caching clothes are carried out based on the hot spot period and hotspot query sentence redefinedThe storage and delete operation of business device.
In some optional implementations of the present embodiment, above-mentioned buffer storage 500 can also include that third caching is singleFirst (not shown).Wherein, above-mentioned third cache unit may be configured in response to determination above-mentioned cache way mark instituteThe above-mentioned cache way indicated is not above-mentioned target cache mode, will based on the indicated cache way of above-mentioned cache way markTarget query result corresponding with above-mentioned target summary info is stored to above-mentioned cache server, and establish be used to indicate it is above-mentionedThe summary info of target summary info and the corresponding relationship of above-mentioned target query result indexes.
In some optional implementations of the present embodiment, above-mentioned buffer storage 500 can also include that the second extraction is singleMember, the 4th determination unit and display unit (not shown).Wherein, above-mentioned second extraction unit may be configured in extractionIt is time-consuming to state inquiry corresponding to each the inquiry of historical data request in multiple the inquiry of historical data requests.Above-mentioned 4th determines listMember may be configured to determine extracted query statement each hot spot period cache hit rate and inquire time-consuming threshold value,Wherein, inquiry time-consuming threshold value of the extracted query statement in each hot spot period is in the hot spot period, presetsThe time-consuming minimum value of the corresponding inquiry of the inquiry of historical data request of ratio.Above-mentioned display unit may be configured to show instituteThe query statement of extraction is in the cache hit rate of each hot spot period and the time-consuming threshold value of inquiry.
The device provided by the above embodiment of the application, it is extracted to the first extraction unit 501 by resolution unit 502Query time in the inquiry of historical data request is parsed to determine multiple hot spot periods, and then statistic unit 503 is rightThe query statement that query time belongs in the inquiry of historical data request of hot spot period is counted to determine hotspot query languageSentence, last first cache unit determines the corresponding query result of hotspot query sentence, so as in the initial time of hot spot periodQuery result corresponding to corresponding hotspot query sentence is stored to cache server, and in the finish time of hot spot periodCorresponding query result is deleted, is cached to realize based on hot spot period switching at runtime, improves the flexibility of caching.
Below with reference to Fig. 6, it illustrates the computer systems for the proxy server for being suitable for being used to realize the embodiment of the present application600 structural schematic diagram.Proxy server shown in Fig. 6 is only an example, should not function to the embodiment of the present application andUse scope brings any restrictions.
As shown in fig. 6, computer system 600 includes central processing unit (CPU) 601, it can be read-only according to being stored inProgram in memory (ROM) 602 or be loaded into the program in random access storage device (RAM) 603 from storage section 608 andExecute various movements appropriate and processing.In RAM 603, also it is stored with system 600 and operates required various programs and data.CPU 601, ROM 602 and RAM 603 are connected with each other by bus 604.Input/output (I/O) interface 605 is also connected to alwaysLine 604.
I/O interface 605 is connected to lower component: the importation 606 including keyboard, mouse etc.;It is penetrated including such as cathodeThe output par, c 607 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 608 including hard disk etc.;And the communications portion 609 of the network interface card including LAN card, modem etc..Communications portion 609 via such as becauseThe network of spy's net executes communication process.Driver 610 is also connected to I/O interface 605 as needed.Detachable media 611, such asDisk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 610, in order to read from thereonComputer program be mounted into storage section 608 as needed.
Particularly, in accordance with an embodiment of the present disclosure, it may be implemented as computer above with reference to the process of flow chart descriptionSoftware program.For example, embodiment of the disclosure includes a kind of computer program product comprising be carried on computer-readable mediumOn computer program, which includes the program code for method shown in execution flow chart.In such realityIt applies in example, which can be downloaded and installed from network by communications portion 609, and/or from detachable media611 are mounted.When the computer program is executed by central processing unit (CPU) 601, limited in execution the present processesAbove-mentioned function.It should be noted that computer-readable medium described herein can be computer-readable signal media orComputer readable storage medium either the two any combination.Computer readable storage medium for example can be --- butBe not limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination.The more specific example of computer readable storage medium can include but is not limited to: have one or more conducting wires electrical connection,Portable computer diskette, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type may be programmed read-only depositReservoir (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memoryPart or above-mentioned any appropriate combination.In this application, computer readable storage medium, which can be, any include or storesThe tangible medium of program, the program can be commanded execution system, device or device use or in connection.AndIn the application, computer-readable signal media may include in a base band or the data as the propagation of carrier wave a part are believedNumber, wherein carrying computer-readable program code.The data-signal of this propagation can take various forms, including but notIt is limited to electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be computerAny computer-readable medium other than readable storage medium storing program for executing, the computer-readable medium can send, propagate or transmit useIn by the use of instruction execution system, device or device or program in connection.Include on computer-readable mediumProgram code can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc., Huo ZheshangAny appropriate combination stated.
Flow chart and block diagram in attached drawing are illustrated according to the system of the various embodiments of the application, method and computer journeyThe architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generationA part of one module, program segment or code of table, a part of the module, program segment or code include one or more useThe executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in boxThe function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actuallyIt can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it to infuseMeaning, the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart can be with holdingThe dedicated hardware based system of functions or operations as defined in row is realized, or can use specialized hardware and computer instructionCombination realize.
Being described in unit involved in the embodiment of the present application can be realized by way of software, can also be by hardThe mode of part is realized.Described unit also can be set in the processor, for example, can be described as: a kind of processor packetInclude the first extraction unit, resolution unit, statistics and the first cache unit.Wherein, the title of these units is under certain conditions simultaneouslyThe restriction to the unit itself is not constituted, for example, the first extraction unit is also described as " extracting multiple the inquiry of historical dataThe unit of request ".
As on the other hand, present invention also provides a kind of computer-readable medium, which be can beIncluded in device described in above-described embodiment;It is also possible to individualism, and without in the supplying device.Above-mentioned calculatingMachine readable medium carries one or more program, when said one or multiple programs are executed by the device, so that shouldDevice: parsing extracted query time, determines multiple hot spot periods;For every in multiple hot spot periodOne hot spot period, the query statement belonged in the inquiry of historical data request of hot spot period to query time are unitedMeter, the determining hotspot query sentence to match with the hot spot period;It extracts corresponding with identified hotspot query sentenceQuery result will be corresponding to the hotspot query sentence that matched with the period in the initial time of each hot spot periodQuery result store to cache server, and the finish time of the hot spot period delete this in the cache server look intoAsk result.
Above description is only the preferred embodiment of the application and the explanation to institute's application technology principle.Those skilled in the artMember is it should be appreciated that invention scope involved in the application, however it is not limited to technology made of the specific combination of above-mentioned technical characteristicScheme, while should also cover in the case where not departing from foregoing invention design, it is carried out by above-mentioned technical characteristic or its equivalent featureAny combination and the other technical solutions formed.Such as features described above has similar function with (but being not limited to) disclosed hereinCan technical characteristic replaced mutually and the technical solution that is formed.