CN104615597A - Method, device and system for clearing cache file in browser - Google Patents

Method, device and system for clearing cache file in browser Download PDF

Info

Publication number
CN104615597A
CN104615597A CN201310538458.8A CN201310538458A CN104615597A CN 104615597 A CN104615597 A CN 104615597A CN 201310538458 A CN201310538458 A CN 201310538458A CN 104615597 A CN104615597 A CN 104615597A
Authority
CN
China
Prior art keywords
field
browser
buffer memory
access
buffer
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.)
Granted
Application number
CN201310538458.8A
Other languages
Chinese (zh)
Other versions
CN104615597B (en
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201310538458.8A priority Critical patent/CN104615597B/en
Publication of CN104615597A publication Critical patent/CN104615597A/en
Application granted granted Critical
Publication of CN104615597B publication Critical patent/CN104615597B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Transfer Between Computers (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method, a device and a system for clearing a cache file in a browser. The system comprises a client side and a server, wherein the client side is used for a browser to asynchronously send an access request; and the server establishes a communication relationship with the client side and is used for returning emptying response information to the client side under a condition that the packet header information of the access request contains a user-defined clearing field, wherein the client side replaces data resources stored in a cache with packet body information in the emptying response information. Through the system, the client side can be guaranteed to control the cache by self to obtain the data resources updated on the server in time, meanwhile, a data flow processed by the browser is greatly reduced, time waste is avoided, and access efficiency and the performance of the browser are improved.

Description

The methods, devices and systems of cache file are removed in browser
Technical field
The present invention relates to computer internet field, in a kind of browser, remove the methods, devices and systems of cache file.
Background technology
Generally, based on HTML (Hypertext Markup Language) (Hypertext Transfer Protocol, referred to as HTTP) request of access with can define some fields relevant to file cache in response message, comprise the field such as buffer control (cache-control) and cache-time (expires).When these fields are set to specifically be worth, file will be cached by viewed device.
Such as, when user uses browser access file f oo.css on the client, first, by browser transmission request information to server, this solicited message comprises URL address: http://qq.com/foo.css, server end returns for this URL address the browser of response message to client that an inclusion is access file foo.css, if the expires field in the head response of response message is set to 0: 0: 0 on the 1st September in 2013, then browser can this time (with local zone time calculate) before always cache access file f oo.css in this locality, if when user uses browser to access this URL again, within this time, browser will direct file reading content from local cache, no longer send HTTP request to server.
For another example, if the value of the field Cache-Control in head response is set to max-age=300, so access file foo.css can viewed device buffer memory 300 second, and user accessed identical ULR in 300 seconds, browser, by direct return cache content, does not send HTTP request to server.
The above-mentioned method at browser local cache access file, be intended to reduce the number of times of browser to server generation HTTP request, but in some cases, for wishing that browser can obtain the file (one of possible reason is that this file is just updated) on server immediately, now, if file is still in the state be buffered, browser would not send request of access to server, does not send request of access just cannot obtain renewal file from server.
Thus, prior art provides the function that can be removed buffer memory in browser, when making this access file of next browser access, is not read access file from buffer memory, but directly to server request file.In existing removing browser, the technical scheme of buffer memory is as follows: by creating XMLHTTP object, after running this script, browser initiates Asynchronous Request to server, thus reach the object of mandatory requirement access file, after request of access forces to obtain whole access file, new file can cover the ancient deed in buffer memory, now, still preserve file in buffer area, the file be only buffered is new file.
Such as, after this resource of client browser requests http://qq.com/foo.css, the access file foo.css that client-cache is returned by server, now, browser can carry out Asynchronous Request http://qq.com/foo.css v=2 by the script running XMLHTTP object, obtain new resources, concrete, server can return new access file foo.css according to Asynchronous Request.Particularly, aforesaid way obtains up-to-date resource by the mode of the end interpolation search in url address.
Analyze known, the scheme of the removing browser rs cache that prior art provides comprises following defect:
On the one hand, the file amount being not suitable for Asynchronous Request is excessive.If it is huge to need to remove the number of files of buffer memory, then the inclusion quantity of information of response message that returns of server is excessive, thus the problem that the flow of browser process data can be caused excessive, very waste the access time, and significantly can reduce browser performance.
On the other hand, of a great variety due to existing browser, the method for above-mentioned removing buffer memory cannot be applicable to all browsers.
For the method for removing buffer memory existing in above-mentioned correlation technique when processing large quantity file, access efficiency can be caused low and reduce the problem of browser performance, not yet proposing effective solution at present.
Summary of the invention
Embodiments provide the methods, devices and systems removing cache file in a kind of browser, at least to solve the method for existing removing buffer memory in correlation technique when processing large quantity file, access efficiency can be caused low and the technical matters of reduction browser performance.
According to the one side of the embodiment of the present invention, additionally provide the system removing cache file in a kind of browser, this system comprises: client, for browser asynchronous transmission request of access; Server, sets up communication relation with client, for comprising self-defining removing field in header packet information request of access being detected, returning and emptying response message to client; Wherein, client uses the inclusion information emptied in response message to replace the data resource preserved in the buffer memory of browser.
According to another aspect of the embodiment of the present invention, provide a kind of method removing cache file in browser, the method comprises: browser asynchronous transmission request of access is to server; Reception server response request of access and return empty response message, wherein, when server detect in the header packet information of request of access comprise self-defining removing field, return and empty response message; The inclusion information emptied in response message is used to replace the data resource preserved in the buffer area of browser.
According to the another aspect of the embodiment of the present invention, additionally provide the device removing cache file in a kind of browser, this device comprises: sending module, for browser asynchronous transmission request of access to server; Receiver module, for reception server response request of access and return empty response message, wherein, when server detect in the header packet information of request of access comprise self-defining removing field, return and empty response message; Remove module, for the inclusion information emptied in response message being replaced the data resource preserved in the buffer area of browser.
According to the another aspect of the embodiment of the present invention, additionally provide a kind of method removing cache file in browser, the method comprises: the request of access receiving the browser asynchronous transmission of client; Self-defining removing field whether is comprised in the header packet information of test access request; When removing field being detected, returning and emptying response message, wherein, emptying response message for replacing the data resource preserved in the buffer memory of browser.
According to the one side again of the embodiment of the present invention, additionally provide the device removing cache file in a kind of browser, this device comprises: receiver module, for receiving the request of access of the browser asynchronous transmission of client; Whether detection module, for comprising self-defining removing field in the header packet information of test access request; Return module, for when removing field being detected, returning and emptying response message, wherein, emptying response message for replacing the data resource preserved in the buffer memory of browser.
In embodiments of the present invention, client is adopted, for browser asynchronous transmission request of access; Server, sets up communication relation with client, for comprising self-defining removing field in header packet information request of access being detected, returning and emptying response message to client; Wherein, client uses the inclusion information emptied in response message to replace the data resource preserved in the buffer memory of browser.Such scheme is by a removing field self-defined in the packet header of the asynchronous access request of client transmission, after server receives asynchronous access request, if the removing field in the packet header of asynchronous access request detected, just determine the content needing to return to client browser, the data resource stored in original buffer memory can be replaced, easily notice, by the scheme that the embodiment of the present invention provides, relatively prior art does not need again to download whole access file, therefore, when the browser of client sends request of access next time, browser needs to reconnect server to obtain data resource, so not only achieve client browser can as required again access services device carry out Gains resources, guarantee can by obtaining from main control buffer memory the data resource that server upgrades in time, browser can be processed more flexibly data cached, thus the flow of browser process data is greatly reduced, avoid and lose time, improve the performance of access efficiency and browser, and then the method solving existing removing buffer memory in correlation technique is when processing large quantity file, access efficiency can be caused low and the technical matters of reduction browser performance.
Accompanying drawing explanation
Accompanying drawing described herein is used to provide a further understanding of the present invention, and form a application's part, schematic description and description of the present invention, for explaining the present invention, does not form inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 is the system architecture schematic diagram removing cache file in the browser according to the embodiment of the present invention one;
Fig. 2 is the method schematic diagram removing cache file in the browser according to the embodiment of the present invention two;
Fig. 3 is the method schematic diagram removing cache file in the browser according to the embodiment of the present invention three;
Fig. 4 is the apparatus structure schematic diagram removing cache file in the browser according to the embodiment of the present invention four; And
Fig. 5 is the apparatus structure schematic diagram removing cache file in the browser according to the embodiment of the present invention five.
Embodiment
It should be noted that, when not conflicting, the embodiment in the application and the feature in embodiment can combine mutually.Below with reference to the accompanying drawings and describe the present invention in detail in conjunction with the embodiments.
The present invention program is understood better in order to make those skilled in the art person, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the embodiment of a part of the present invention, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, should belong to the scope of protection of the invention.
It should be noted that, term " first ", " second " etc. in instructions of the present invention and claims and above-mentioned accompanying drawing are for distinguishing similar object, and need not be used for describing specific order or precedence.Should be appreciated that the data used like this can be exchanged in the appropriate case, so as embodiments of the invention described herein can with except here diagram or describe those except order implement.In addition, term " comprises " and " having " and their any distortion, intention is to cover not exclusive comprising, such as, contain those steps or unit that the process of series of steps or unit, method, system, product or equipment is not necessarily limited to clearly list, but can comprise clearly do not list or for intrinsic other step of these processes, method, product or equipment or unit.
Embodiment 1
Before the further details of each embodiment describing the application, the counting system structure that of the principle that can be used for realizing the application is suitable is described with reference to Fig. 1.In the following description, except as otherwise noted, the symbol otherwise with reference to the action performed by one or more computing machine and operation represents each embodiment describing the application.Thus, be appreciated that processing unit that this kind of action performed sometimes referred to as computing machine and operation comprise computing machine is to the manipulation of electric signal representing data with structured form.It is safeguarded in this manipulation transforms data or the position in the accumulator system of computing machine, and this reshuffles or changes the operation of computing machine in the mode that those skilled in the art understands.The data structure of service data is the physical location of the storer of the particular community that the form with data defines.But although describe the application in above-mentioned context, it does not also mean that restrictive, as understood by those skilled in the art, hereinafter described action and each side of operation also can realize with hardware.
In the configuration that it is the most basic, Fig. 1 is the system architecture schematic diagram removing cache file in the browser according to the embodiment of the present invention one.For purposes of illustration, the architecture of painting is only an example of proper environment, not proposes any limitation to the usable range of the application or function.This computing system should be interpreted as, to the arbitrary assembly shown in Fig. 1 or its combination, there is any dependence or demand yet.
As shown in Figure 1, this system can comprise: client 1 and a server 2.
Client 1, for browser asynchronous transmission request of access.
Server 2, sets up communication relation with client 1, for comprising self-defining removing field in header packet information request of access being detected, returning and emptying response message to client 1.
Wherein, client 1 uses the inclusion information emptied in response message to replace the data resource preserved in the buffer memory of browser.Preferably, while replacing the data resource preserved in the buffer memory of browser, browser not buffer memory empties the inclusion information in response message.
The above embodiments of the present application, by in packet header of asynchronous access request of sending in client 1 self-defined one remove field, after server 2 receives asynchronous access request, if the removing field in the packet header of asynchronous access request detected, just determine the content needing to return to client 1 browser, namely to asynchronous access request should returning one and empty response message, this inclusion information emptying response message can replace the data resource stored in original buffer memory.By the scheme that the embodiment of the present invention provides, relatively prior art does not need again to download whole access file, therefore, when the browser of client sends request of access next time, browser needs to reconnect server to obtain data resource, so not only achieve client browser can as required again access services device carry out Gains resources, guarantee can by obtaining from main control buffer memory the data resource that server upgrades in time, browser can be processed more flexibly data cached, thus the flow of browser process data is greatly reduced, avoid and lose time, improve the performance of access efficiency and browser, and then the method solving existing removing buffer memory in correlation technique is when processing large quantity file, access efficiency can be caused low and the technical matters of reduction browser performance.
Easily notice, while replacing the data resource preserved in the buffer memory of browser, if browser not buffer memory empties the inclusion information in response message, can know, due to browser not buffer memory empty the inclusion information in response message, therefore, by the scheme that the embodiment of the present invention provides, content in buffer memory can become null value, relatively prior art does not need again to download whole access file, employ empty file to replace, therefore, when the browser of client 1 sends request of access next time, because the content in buffer area is empty, thus make browser need to reconnect server 2 to obtain data resource, so not only achieve client 1 browser can as required again access services device 2 carry out Gains resources, guarantee can by obtaining the data resource that server 2 upgrades in time from main control buffer memory, browser can be processed more flexibly data cached, and due to the inclusion of the response message for emptying buffer area be null value, thus the flow of browser process data is greatly reduced, avoid and lose time, improve the performance of access efficiency and browser.
Preferably, in above-described embodiment one that the application provides, can by adding custom field in asynchronous request of access, thus to make server 2 return an inclusion information be the response message of null value, achieve the removing of the data resource to client 1 local cache, such scheme does not need again to download file corresponding to whole data resource, and employ in empty file replacement client 1 and the data of buffer memory, make to read resource from local cache during browser access file, thus need direct access services device 2, thus server 2 end makes after have updated data resource, client 1 can as required fast and directly read the data of renewal.
As from the foregoing, the header packet information emptying response message that in the above embodiments of the present application, server 2 returns can be not only null value, also can not be null value (such as return json data { em:0}), but due to browser not buffer memory empty the inclusion information in response message, therefore, no matter inclusion packets of information is containing arbitrary content, and the buffer memory of browser all can be cleared, and the json data returned { em:0} can be used for notice browser and empty buffer memory.Empty the inclusion information of response message for bandwidth can be saved to greatest extent time empty.
Concrete, server 2 is when receiving the request of access of this asynchronous transmission, can check that whether packet header is containing removing field NohostCleanCache, preferably, be provided with this field being checked through, and the value of this field is when being Yes, it is empty response that server 2 can return an inclusion, empties the content of buffer zone in client 1 browser.If when now the browser of client 1 sends request of access again, such as, access http://qq.com/foo.css, foo.css file can not be read from buffer area, can direct access services device 2.
Preferably, when to empty the inclusion information in response message be null value, a kind of client 1 of the above embodiments of the present application can comprise as lower part: receiving trap 102 and processor 103.
Wherein, receiving trap 102, what return for reception server 2 responds request of access empties response message; Processor 103, for extracting the null value emptying inclusion information in response message, and covers the data resource preserved in the buffer area of browser by null value, the buffer area of browser is cleared.
Above-mentioned receiving trap 102 and processor 103, except being realized by hardware unit, also can pass through software simulating.
What needs further illustrated is, also need in the request of access of asynchronous transmission in the above embodiments of the present application one to arrange a URL visit information, after being cleared for the buffer zone of data cached resource in client 1 browser, client 1 performs browser by dispensing device 101 and sends new request of access, wherein, new request of access also comprises above-mentioned URL visit information, obtain in the process of new data resource in client 1 by this URL visit information, first processor 103 in client 1 starts to detect the content in local cache district, detect that the content in buffer area is sky thus, then extract the domain name in this URL visit information, and new server 2 is accessed in server 2 address corresponding according to the domain name in URL visit information, get corresponding data resource, this data resource can be the file after new server 2 upgrades.
Concrete, the scheme that the above embodiments of the present application one provide achieves the data cached demand removing client 1 browser, makes browser cannot obtain data from buffer area, and needs again linked server 2 to obtain new data file.
Above-described embodiment can be applied in following application scenarios: client browser access services device A, obtains resource foo.css, and by this caching resource in local buffer.Now, the foo.css that the server B having a same domain name with server A saves the resource foo.css(server B after renewal is that developer newly issues renewal), now, at this moment browser needs the resource fetch renewal at once from server B after, thus make user can have access to new resource, can get the more new resources in server B in real time in order to ensure browser and not use old buffer memory, the technical scheme that the embodiment of the present application one can be utilized to provide realizes.Concrete, client first sends an asynchronous request of access to server A, server A detects in this asynchronous access request that comprising one empties field, thus to return to client inclusion be the response message of null value, this null value substituted for the data in client buffer district, thus, if client again request resource foo.css time, because buffer contents is empty, so, client needs linked server again, thus get data resource from new server, due to data resource be now upgrade after data, thus make client can obtain new data resource by real time access.Server A in above-mentioned scene and server B can be same servers, also can be two independently server terminals.
In addition, stand in the angle of development person, the above embodiments of the present application one are applied in during mobile terminal web develops also can produce larger beneficial effect.Complicated and time consumption is wanted than on PC pc owing to removing buffer memory on mobile terminals, even some system needs the root authority of system or installs other aids just can complete and empty buffer memory, and use the embodiment of the present application can realize once the scheme provided, the web page of mobile terminal directly realizes the removing of buffer memory, improves work efficiency.
What need detailed description is, the browser of the application's client is before asynchronous transmission request of access, need create and run the Run Script for sending asynchronous access request, such as, an xmlhttp object can be created in a browser with JavaScript script, client browser uses xmlhttp object to send request of access, can very easily and server exchange data.
The application's such scheme can realize based on xmlhttp object, namely calls in a browser and after running xmlhttp object, client terminal start-up announcement server needs to carry out caching clearly.
The xmlhttp object created in the embodiment of the present application can have different establishment modes for different browsers, such as, in IE browser, ActiveXObject (" Msxml2.XMLHTTP ") or ActiveXObject (" Microsoft.XMLHTTP ") can be used to create, and in other modern browsers, newXMLHttpRequest () can be used to create.
For IE browser, the script creating xmlhttp object is as follows:
Preferably, in the above embodiments of the present application, need to arrange some fields to the xmlhttp object created, then the xmlhttp object setting field is sent to server, the data file that request is corresponding as the content of asynchronous access request.The header packet information of the request of access of this asynchronous transmission at least can comprise following field: self-defining removing field (NohostCleanCache), buffer update time field (If-Modified-Since), buffer control field (Cache-Control) and buffer memory compiling field (Pragma), these fields are kept in the storer of client, can be in the buffer area of storer, and the header packet information of the corresponding different request of access set by browser is different, but the inclusion of this asynchronous access request is null value, concrete, the field arranged for different browsers is as shown in table 1 below:
Table 1:
From upper table 1 content:
When browser is IE browser, need to arrange 4 fields: arranging and removing field NohostCleanCache is YES, buffer update time field If-Modified-Since is 0, buffer control field Cache-Control is that buffer memory (is not no-cache, no-store), buffer memory compiling field Pragma is not buffer memory (being no-cache).
When browser is Firefox browser, need to arrange 2 fields: arranging and removing field NohostCleanCache is YES, buffer update time field If-Modified-Since is 0, does not need to arrange buffer control field Cache-Control and buffer memory compiling field Pragma.
When browser is Opera browser, need to arrange 4 fields: arranging and removing field NohostCleanCache is YES, buffer update time field If-Modified-Since is 0, buffer control field Cache-Control is that buffer memory (is not no-cache, no-store), buffer memory compiling field Pragma is not buffer memory (being no-cache);
When browser is Chrome browser, need to arrange 3 fields: arranging and removing field NohostCleanCache is YES, buffer control field Cache-Control is not buffer memory (being no-cache), buffer memory compiling field Pragma is not buffer memory (being no-cache), does not need to arrange buffer update time field If-Modified-Since.
NohostCleanCache field is in custom field, and in table, horizontal line represents this field and do not arrange corresponding data.And except Firefox be use POST mode and send request except, other browsers all use GET mode to send request.
It can thus be appreciated that the application can be applied to various browser, comprise the Internet Explorer series of Microsoft, the Firefox of Mozzila, Chrome and the Opera browser of Google.Need to arrange different values to above-mentioned parameter for each browser above-mentioned, object is in order to after server receives asynchronous request of access, can be identified by the value reading parameters current clear operation for browser.Preferably, in order to make the saving resource of request of access minimum degree, improving access efficiency, the inclusion of the request of access of transmission can be set to null value null.
Below just to need in the IE browser of client, removing the cache file foo.css of URL address corresponding to http://qq.com/foo.css is example, is described in detail.
Client is in the process creating xmlhttp object, this XMLHTTP object arranges structure and the content of asynchronous access request, the request behavior http://qq.com/foo.css of this asynchronous access request is set, and some message header field are at least set, client sends to server by after each head field assignment, to ask http://qq.com/foo.css file.The scheme that the above embodiments of the present application provide can add different fields for browsers different on active client, such as, for IE browser, need at least to arrange following 4 fields, and to each field assignment, wherein, NohostCleanCache is yes; If-Modified-Since is 0; Cache-Control is no-cache, no-store; Pragma is no-cache, and wherein, NohostCleanCache field is not the field defined in HTTP, belongs to custom field.
As from the foregoing, because above-mentioned field is all the relevant field carrying out buffer memory about asynchronous access request, and (such as If-Modified-Since is 0 from the assignment of each field; Cache-Control is no-cache, no-store; Pragma is no-cache) known, the above-mentioned object to the header fields that xmlhttp object is arranged is to make the resource of this asynchronous access request not by IE browser buffer memory, apparent, due to the difference between each browser of client, the parameter item arranged for different browsers is also incomplete same, refers to table 1.
But, this does not also mean that the application has made restriction to the field arranged in above-mentioned asynchronous access request and the form of expression and obtain manner, in above-mentioned asynchronous access request except needs carry above-mentioned message header field, this asynchronous access request can also carry other fields, such as, Accept field, Accept-Charset field, Accept-Encoding field, Accept-Language field, Host field, Referer field, User-Agent field, Cookie field, Connection field, Date field etc.
Wherein, Accept: for high-speed servers, represents the data type that client is supported; Accept-Charset: for Tell server, the coded format that client adopts; Accept-Encoding: for Tell server, the data compression format that client is supported; Accept-Language: the language environment of client; Host: client, by this high-speed servers, wants the host name of accessing; Referer: client is by this head Tell server, and it visits server (door chain) from which resource; User-Agent: client passes through this head Tell server, the software environment of client computer; Cookie: client computer can to server band data by this head; Connection: whether disconnect after processing current request or continue to keep connecting; Date: current time value.
Generally speaking, in the embodiment of the present application, above-mentioned uniform resource position mark URL (Uniform ResourceLocator) can position the web page files of target web, the web page files of this target web is stored in corresponding server, and the IP address of this server is inquired about by the domain name in the URL address of input.What should know is the identification clicked that usually can come from the link to the sensing target web in browser or user interface to the web access requests of target web herein, such as, in some embodiments of the application, namely web access requests can be formed to the seizure of the mouse click action existed in above-mentioned browser or user interface on the passage of URL hyperlink with identification.Certainly, the URL link of above-mentioned sensing target web also can not appear on word, but on element in other browsers such as icon, picture, video pictures or user interface, the application is not construed as limiting this.
Preferably, in a kind of feasible program that the above embodiments of the present application one provide, the header packet information emptied in response message can be set and at least comprise following any one or more field information: buffer control field, cache-time field and buffer memory compiling field, wherein, buffer control field is set to not buffer memory, cache-time field is set to-1 or 0, and buffer memory compiling field is set to not buffer memory.
Concrete, after server receives asynchronous request of access, if checked in the message header of asynchronous access request containing NohostCleanCache field, then can return an inclusion be null value empty response message to empty the data in client buffer district, now, this empties response message can also carry the field relevant to buffer memory, such as, buffer control field Cache-control, cache-time field Expires and buffer memory compiling field Pragma, owing to buffer control field to be set to not buffer memory (being no-cache), cache-time field is set to-1 or 0, buffer memory compiling field be set to not buffer memory (being no-cache) when, represent client also can not buffer memory current return empty response message itself, thus alleviate the burden of resource access.Now, this empties response message can carry above-mentioned any one or more field, reaches the object of the client not current response message of buffer memory.
In addition, in the another kind of feasible program that above-described embodiment one provides, what server returned the header packet information emptied in response message also can not arrange following any one or more field information: buffer control field, cache-time field and buffer memory compiling field.This method not arranging the field relevant to buffer memory in the message, also can obtain the not current effect emptying response message of buffer memory.
It should be noted that herein, above-described embodiment does not also mean that the application has made restriction to the above-mentioned content emptying response message that returns and obtain manner, above-mentionedly to empty in response message except needing to carry except the above-mentioned message header field relevant to buffer memory, this asynchronous access request can also carry other fields, such as, location field, Server field, Content-Encoding field, Content-Length field, Content-Type field, Last-Modified field, Refresh field, Content-Disposition field, Transfer-Encoding field etc.
Wherein, Location: this head coordinates 302 status codes to use, for telling that client needs whom accesses; Server: server tells the type of browser server by this head; Content-Encoding: server tells the compressed format of browser data by this head; Content-Length: server tells the length of browser echo back data by this head; Content-Type: server tells the type of browser echo back data by this head; Last-Modified: the last cache-time of telling browser Current resource; Refresh: tell that browser is every how long refreshing once; Content-Disposition: tell that browser opens data with downloading mode; Transfer-Encoding: the transformat of telling browser data; ETag: the head that buffer memory is relevant.
Preferably, in each embodiment above-mentioned, after server receives asynchronous access request, except be checked through this asynchronous access request message header in containing NohostCleanCache field, just can return and empty response message, further, can also check whether the value of this field is set to YES, if be empty response message for YES just can return inclusion.
Embodiment 2
According to the embodiment of the present invention, additionally provide a kind of embodiment of the method for implementing said system embodiment, it should be noted that, can perform in the computer system of such as one group of computer executable instructions in the step shown in the process flow diagram of accompanying drawing, and, although show logical order in flow charts, in some cases, can be different from the step shown or described by order execution herein.
Fig. 2 is the method schematic diagram removing cache file in the browser according to the embodiment of the present invention two.
As shown in Figure 2, the method can be applied in client, is described in detail, can comprises the steps: from the implementation process of angle to the application of client
Step S10, can carry out browser asynchronous transmission request of access to server by the client shown in Fig. 1.
Step S30, reception server response request of access and return empty response message can be carried out by the client shown in Fig. 1, wherein, when server detect in the header packet information of request of access comprise self-defining removing field, return and empty response message.
Step S50, can use the inclusion information emptied in response message to replace the data resource preserved in the buffer area of browser by the client shown in Fig. 1.Preferably, while replacing the data resource preserved in the buffer memory of browser, browser not buffer memory empties the inclusion information in response message.
In the above embodiments of the present application two, by in packet header of asynchronous access request of sending at browser self-defined one remove field, make after server receives asynchronous access request, if the removing field in the packet header of asynchronous access request detected, just determine the content needing to return to client browser, namely to asynchronous access request should returning one and empty response message, this inclusion information emptying response message can replace the data resource stored in original buffer memory.By the scheme that the embodiment of the present invention provides, relatively prior art does not need again to download whole access file, therefore, when the browser of client sends request of access next time, browser needs to reconnect server to obtain data resource, so not only achieve client browser can as required again access services device carry out Gains resources, guarantee can by obtaining from main control buffer memory the data resource that server upgrades in time, browser can be processed more flexibly data cached, thus the flow of browser process data is greatly reduced, avoid and lose time, improve the performance of access efficiency and browser, and then the method solving existing removing buffer memory in correlation technique is when processing large quantity file, access efficiency can be caused low and the technical matters of reduction browser performance.
Easily notice, while replacing the data resource preserved in the buffer memory of browser, if browser not buffer memory empties the inclusion information in response message, can know, due to browser not buffer memory empty the inclusion information in response message, therefore, by the scheme that the embodiment of the present invention provides, content in buffer memory can become null value, relatively prior art does not need again to download whole access file, employ empty file to replace, therefore, when the browser of client sends request of access next time, because the content in buffer area is empty, thus make browser need to reconnect server to obtain data resource, so not only achieve client browser can as required again access services device carry out Gains resources, ensure by the data resource that server upgrades can be obtained in time from main control buffer memory, browser can be processed more flexibly data cached, and due to the inclusion of the response message for emptying buffer area be null value, thus the flow of browser process data is greatly reduced, avoid and lose time, improve the performance of access efficiency and browser.
The step S10 that the above embodiments of the present application provide to step S50 can run on the client, preferably, can by adding custom field in asynchronous request of access, thus to make server return an inclusion information be the response message of null value, achieve the removing of the data resource to client local cache, such scheme does not need again to download file corresponding to whole data resource, and employ in empty file replacement client and the data of buffer memory, make to read resource from local cache during browser access file, thus need direct access services device, thus server end makes after have updated data resource, client can as required fast and directly read the data of renewal.
As from the foregoing, the header packet information emptying response message that in the above embodiments of the present application, server 2 returns can be not only null value, also can not be null value (such as return json data { em:0}), but due to browser not buffer memory empty the inclusion information in response message, therefore, no matter inclusion packets of information is containing arbitrary content, and the buffer memory of browser all can be cleared, and the json data returned { em:0} can be used for notice browser and empty buffer memory.Empty the inclusion information of response message for bandwidth can be saved to greatest extent time empty.
Concrete, server is when receiving the request of access of this asynchronous transmission, can check that whether packet header is containing removing field NohostCleanCache, preferably, be provided with this field being checked through, and the value of this field is when being Yes, it is empty response that server can return an inclusion, empties the content of buffer zone in client browser.If when now the browser of client sends request of access again, such as, access http://qq.com/foo.css, foo.css file can not be read from buffer area, foo.css file can be read by direct access services device.
Preferably, in the above embodiments of the present application two, when to empty the inclusion information in response message be null value, step S50, the step of the inclusion information emptied in response message being replaced the data resource preserved in the buffer area of browser can comprise the steps:
Step S501, extracts the null value of the inclusion information in response message that empties.
Step S502, covers the data resource preserved in the buffer area of browser by null value, the buffer area of browser is cleared.
Above-mentioned steps S501 and step S502 may operate in client.
In a kind of embodiment in the above embodiments of the present application two, the header packet information emptied in response message can be set and at least comprise following any one or more field information: buffer control field, cache-time field and buffer memory compiling field, wherein, buffer control field is set to not buffer memory, cache-time field is set to-1 or 0, and buffer memory compiling field is set to not buffer memory.
Concrete, step S30 reception server response request of access and return empty response message before, server receives the asynchronous access request that browser sends, now, if checked in the message header of asynchronous access request containing NohostCleanCache field, then can return an inclusion be null value empty response message to empty the data of having preserved in the buffer zone of client browser, now, this empties response message can also carry the field relevant to buffer memory, such as, buffer control field Cache-control, cache-time field Expires and buffer memory compiling field Pragma, owing to buffer control field to be set to not buffer memory (being no-cache), cache-time field is set to-1 or 0, buffer memory compiling field be set to not buffer memory (being no-cache) when, represent client also can not buffer memory current return empty response message itself, thus alleviate the burden of resource access.Now, this empties response message can carry above-mentioned any one or more field, reaches the object of the client not current response message of buffer memory.
In another embodiment in the above embodiments of the present application two, will following any one or more field information can be set in the header packet information emptied in response message: buffer control field, cache-time field and buffer memory compiling field.This method not arranging the field relevant to buffer memory in the message, also can obtain the not current effect emptying response message of buffer memory.
It should be noted that herein, above-described embodiment does not also mean that the application has made restriction to the above-mentioned content emptying response message that returns and obtain manner, above-mentionedly to empty in response message except needing to carry except the above-mentioned message header field relevant to buffer memory, this asynchronous access request can also carry other fields, such as, location field, Server field, Content-Encoding field, Content-Length field, Content-Type field, Last-Modified field, Refresh field, Content-Disposition field, Transfer-Encoding field etc.
Wherein, Location: this head coordinates 302 status codes to use, for telling that client needs whom accesses; Server: server tells the type of browser server by this head; Content-Encoding: server tells the compressed format of browser data by this head; Content-Length: server tells the length of browser echo back data by this head; Content-Type: server tells the type of browser echo back data by this head; Last-Modified: the last cache-time of telling browser Current resource; Refresh: tell that browser is every how long refreshing once; Content-Disposition: tell that browser opens data with downloading mode; Transfer-Encoding: the transformat of telling browser data; ETag: the head that buffer memory is relevant.
Preferably, in each embodiment above-mentioned, after server receives asynchronous access request, except be checked through this asynchronous access request message header in containing NohostCleanCache field, just can return and empty response message, further, can also check whether the value of this field is set to YES, if be empty response message for YES just can return inclusion.
What needs further illustrated is, also need in the request of access of asynchronous transmission in the above embodiments of the present application two to arrange a URL visit information, preferably, after step S50 to replace in the buffer zone of browser after the data resource preserved or the buffer area of step S502 browser is cleared, can also comprise the steps:
Step S503, browser sends new request of access, and wherein, new request of access comprises URL visit information.
Concrete, after being cleared for the buffer zone of data cached resource in client browser, client can perform browser by a dispensing device and send new request of access, and wherein, new request of access also comprises above-mentioned URL visit information.
Step S504, detects that content in buffer area is for time empty, then inquire about and obtain the domain name in URL visit information.
Concrete, obtain in the process of new data resource in client by this URL visit information, first the processor in client starts to detect the content in local cache district, detects that the content in buffer area is sky thus, then extract the domain name in this URL visit information
Step S505, the server address corresponding according to the domain Name acquisition in URL visit information.
Concrete, this step can use traditional mode from name server, to obtain IP address corresponding to this domain name according to domain name, and certainly, the embodiment of the present application is not limited to aforesaid way.
Step S506, browser accesses new server by server address, gets corresponding data resource.
Concrete, after client browser knows the server ip address that current new request of access will be accessed, server address that can be corresponding according to the domain name in this URL visit information accesses new server, get corresponding data resource, this data resource can be the file after new server upgrades.
As from the foregoing, the scheme that the application's each embodiment above-mentioned provides achieves the data cached demand removing client browser, makes browser cannot obtain data from buffer area, and needs again linked server to obtain new data file.
Above-described embodiment can be applied in following application scenarios: run above-mentioned steps S10-S50 on the client, client browser access services device A, obtains resource foo.css, and by this caching resource in local buffer.Now, the foo.css that the server B having a same domain name with server A saves the resource foo.css(server B after renewal is that developer newly issues renewal), now, at this moment browser needs the resource fetch renewal at once from server B after, thus make user can have access to new resource, can get the more new resources in server B in real time in order to ensure browser and not use old buffer memory, the technical scheme that the embodiment of the present application two can be utilized to provide realizes.Concrete, client browser first sends an asynchronous request of access to server A, server A detects in this asynchronous access request that comprising one empties field, thus to return to client inclusion be the response message of null value, this null value substituted for the data in client buffer district, thus, if client again request resource foo.css time, because buffer contents is empty, so, client needs linked server again, thus get data resource from new server, due to data resource be now upgrade after data, thus make client can obtain new data resource by real time access.Server A in above-mentioned scene and server B can be same servers, also can be two independently server terminals.
In addition, stand in the angle of development person, the above embodiments of the present application one are applied in during mobile terminal web develops also can produce larger beneficial effect.Complicated and time consumption is wanted than on PC pc owing to removing buffer memory on mobile terminals, even some system needs the root authority of system or installs other aids just can complete and empty buffer memory, and use the embodiment of the present application can realize once the scheme provided, the web page of mobile terminal directly realizes the removing of buffer memory, improves work efficiency.
What need detailed description is, the browser of the application's client is in step S10, before asynchronous transmission request of access, need create and run the Run Script for sending asynchronous access request, such as, can create an xmlhttp object with JavaScript script in a browser, client browser uses xmlhttp object to send request of access, can very easily and server exchange data.
The application's such scheme can realize based on xmlhttp object, namely calls in a browser and after running xmlhttp object, client terminal start-up announcement server needs to carry out caching clearly.
The xmlhttp object created in the embodiment of the present application can have different establishment modes for different browsers, such as, in IE browser, ActiveXObject (" Msxml2.XMLHTTP ") or ActiveXObject (" Microsoft.XMLHTTP ") can be used to create, and in other modern browsers, newXMLHttpRequest () can be used to create.
Preferably, in the above embodiments of the present application, need to arrange some fields to the xmlhttp object created, then the xmlhttp object setting field is sent to server, the data file that request is corresponding as the content of asynchronous access request.The header packet information of the request of access of this asynchronous transmission at least can comprise following field: self-defining removing field (NohostCleanCache), buffer update time field (If-Modified-Since), buffer control field (Cache-Control) and buffer memory compiling field (Pragma), these fields are kept in the storer of client, can be in the buffer area of storer, and the header packet information of the corresponding different request of access set by browser is different, but the inclusion of this asynchronous access request is null value, concrete, the field arranged for different browsers is as shown in table 1 below:
Table 1:
From upper table 1 content:
When browser is IE browser, need to arrange 4 fields: arranging and removing field NohostCleanCache is YES, buffer update time field If-Modified-Since is 0, buffer control field Cache-Control is that buffer memory (is not no-cache, no-store), buffer memory compiling field Pragma is not buffer memory (being no-cache).
When browser is Firefox browser, need to arrange 2 fields: arranging and removing field NohostCleanCache is YES, buffer update time field If-Modified-Since is 0, does not need to arrange buffer control field Cache-Control and buffer memory compiling field Pragma.
When browser is Opera browser, need to arrange 4 fields: arranging and removing field NohostCleanCache is YES, buffer update time field If-Modified-Since is 0, buffer control field Cache-Control is that buffer memory (is not no-cache, no-store), buffer memory compiling field Pragma is not buffer memory (being no-cache);
When browser is Chrome browser, need to arrange 3 fields: arranging and removing field NohostCleanCache is YES, buffer control field Cache-Control is not buffer memory (being no-cache), buffer memory compiling field Pragma is not buffer memory (being no-cache), does not need to arrange buffer update time field If-Modified-Since.
NohostCleanCache field is in custom field, and in table, horizontal line represents this field and do not arrange corresponding data.And except Firefox be use POST mode and send request except, other browsers all use GET mode to send request.
It can thus be appreciated that the application can be applied to various browser, comprise the Internet Explorer series of Microsoft, the Firefox of Mozzila, Chrome and the Opera browser of Google.Need to arrange different values to above-mentioned parameter for each browser above-mentioned, object is in order to after server receives asynchronous request of access, can be identified by the value reading parameters current clear operation for browser.Preferably, in order to make the saving resource of request of access minimum degree, improving access efficiency, the inclusion of the request of access of transmission can be set to null value null.
But, this does not also mean that the application has made restriction to the field arranged in above-mentioned asynchronous access request and the form of expression and obtain manner, in above-mentioned asynchronous access request except needs carry above-mentioned message header field, this asynchronous access request can also carry other fields, such as, Accept field, Accept-Charset field, Accept-Encoding field, Accept-Language field, Host field, Referer field, User-Agent field, Cookie field, Connection field, Date field etc.
Wherein, Accept: for high-speed servers, the data type that client computer is supported; Accept-Charset: for Tell server, the coded format that client computer adopts; Accept-Encoding: for Tell server, the data compression format that client computer is supported; Accept-Language: the language environment of client computer; Host: client computer, by this high-speed servers, wants the host name of accessing; Referer: client computer is by this head Tell server, and it visits server (door chain) from which resource; User-Agent: client computer passes through this head Tell server, the software environment of client computer; Cookie: client computer can to server band data by this head; Connection: whether disconnect after processing current request or continue to keep connecting; Date: current time value.
Below just to need in the IE browser of client, removing the cache file foo.css of URL address corresponding to http://qq.com/foo.css is example, is described in detail.
Client is in the process creating xmlhttp object, this XMLHTTP object arranges structure and the content of asynchronous access request, the request behavior http://qq.com/foo.css of this asynchronous access request is set, and some message header field are at least set, client sends to server by after each head field assignment, to ask http://qq.com/foo.css file.The scheme that the above embodiments of the present application provide can add different fields for browsers different on active client, such as, for IE browser, need at least to arrange following 4 fields, and to each field assignment, wherein, NohostCleanCache is yes; If-Modified-Since is 0; Cache-Control is no-cache, no-store; Pragma is no-cache, and wherein, NohostCleanCache field is not the field defined in HTTP, belongs to custom field.
As from the foregoing, because above-mentioned field is all the relevant field carrying out buffer memory about asynchronous access request, and (such as If-Modified-Since is 0 from the assignment of each field; Cache-Control is no-cache, no-store; Pragma is no-cache) known, the above-mentioned object to the header fields that xmlhttp object is arranged is to make the resource of this asynchronous access request not by IE browser buffer memory, apparent, due to the difference between each browser of client, the parameter item arranged for different browsers is also incomplete same, refers to table 1.
Generally speaking, in the embodiment of the present application, above-mentioned uniform resource position mark URL (Uniform ResourceLocator) can position the web page files of target web, the web page files of this target web is stored in corresponding server, and the IP address of this server is inquired about by the domain name in the URL address of input.What should know is the identification clicked that usually can come from the link to the sensing target web in browser or user interface to the web access requests of target web herein, such as, in some embodiments of the application, namely web access requests can be formed to the seizure of the mouse click action existed in above-mentioned browser or user interface on the passage of URL hyperlink with identification.Certainly, the URL link of above-mentioned sensing target web also can not appear on word, but on element in other browsers such as icon, picture, video pictures or user interface, the application is not construed as limiting this.
It should be noted that, for aforesaid each embodiment of the method, in order to simple description, therefore it is all expressed as a series of combination of actions, but those skilled in the art should know, the present invention is not by the restriction of described sequence of movement, because according to the present invention, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in instructions all belongs to preferred embodiment, and involved action and module might not be that the present invention is necessary.
Through the above description of the embodiments, those skilled in the art can be well understood to the mode that can add required general hardware platform by software according to the method for above-described embodiment and realize, hardware can certainly be passed through, but in a lot of situation, the former is better embodiment.Based on such understanding, technical scheme of the present invention can embody with the form of software product the part that prior art contributes in essence in other words, this computer software product is stored in a storage medium (as ROM/RAM, magnetic disc, CD), comprising some instructions in order to make a station terminal equipment (can be mobile phone, computing machine, server, or the network equipment etc.) perform method described in each embodiment of the present invention.
Embodiment 3
According to the embodiment of the present invention, additionally provide a kind of embodiment of the method for implementing said system embodiment, it should be noted that, can perform in the computer system of such as one group of computer executable instructions in the step shown in the process flow diagram of accompanying drawing, and, although show logical order in flow charts, in some cases, can be different from the step shown or described by order execution herein.
Fig. 3 is the method schematic diagram removing cache file in the browser according to the embodiment of the present invention three.
As shown in Figure 3, the method can be applied in server end, is described in detail, can comprises the steps: from the implementation process of angle to the application of server end
Step S20, can receive the request of access of the browser asynchronous transmission of client by the server end shown in Fig. 1.
Step S40, can come whether to comprise self-defining removing field in the header packet information of test access request by the server shown in Fig. 1.
Step S60, by the server shown in Fig. 1 when removing field being detected, can returning and emptying response message, wherein, emptying response message for replacing the data resource preserved in the buffer memory of browser.Preferably, in the buffer memory replacing browser while the data resource preserved, browser can not empty inclusion information in response message by buffer memory.
In the above embodiments of the present application three, by detecting the packet header of the asynchronous access request received, to determine whether to need to return packet header be empty empty response message to server end, if the removing field in the packet header of asynchronous access request detected, just determine the content needing to return to client browser, namely to asynchronous access request should returning one and empty response message, this inclusion information emptying response message can replace the data resource stored in original buffer memory.By the scheme that the embodiment of the present invention provides, relatively prior art does not need again to download whole access file, therefore, when the browser of client sends request of access next time, browser needs to reconnect server to obtain data resource, so not only achieve client browser can as required again access services device carry out Gains resources, guarantee can by obtaining from main control buffer memory the data resource that server upgrades in time, browser can be processed more flexibly data cached, thus the flow of browser process data is greatly reduced, avoid and lose time, improve the performance of access efficiency and browser, and then the method solving existing removing buffer memory in correlation technique is when processing large quantity file, access efficiency can be caused low and the technical matters of reduction browser performance.
Above-mentioned removing field is the self-defining field of client, easily notice, while replacing the data resource preserved in the buffer memory of browser, if browser not buffer memory empties the inclusion information in response message, can know, due to browser not buffer memory empty the inclusion information in response message, therefore, by the scheme that the embodiment of the present invention provides, server is according to removing field and emptying response message and the content in buffer memory being become null value of returning, relatively prior art does not need again to download whole access file, employ empty file to replace, therefore, because server makes the content in buffer area for empty, thus make browser need to reconnect server to obtain data resource, so not only achieve browser can as required again access services device carry out Gains resources, guarantee can by obtaining from main control buffer memory the data resource that server upgrades in time, browser can be processed more flexibly data cached, and due to the inclusion of the response message for emptying buffer area be null value, thus the flow of browser process data is greatly reduced, avoid and lose time, improve the performance of access efficiency and browser.
The step S20 that the above embodiments of the present application provide to step S60 can run on the server, preferably, server can return an inclusion information by the asynchronous access request that with the addition of custom field be the response message of null value, achieve the removing of the data resource to browser local cache, such scheme does not need again to download file corresponding to whole data resource, and employ in empty file replacement client and the data of buffer memory, make to read resource from local cache during browser access file, thus need direct access services device, thus server end makes after have updated data resource, client can as required fast and directly read the data of renewal.
As from the foregoing, the header packet information emptying response message that in the above embodiments of the present application, server 2 returns can be not only null value, also can not be null value (such as return json data { em:0}), but due to browser not buffer memory empty the inclusion information in response message, therefore, no matter inclusion packets of information is containing arbitrary content, and the buffer memory of browser all can be cleared, and the json data returned { em:0} can be used for notice browser and empty buffer memory.Empty the inclusion information of response message for bandwidth can be saved to greatest extent time empty.
Concrete, server is when receiving the request of access of this asynchronous transmission, can check that whether packet header is containing removing field NohostCleanCache, preferably, be provided with this field being checked through, and the value of this field is when being Yes, it is empty response that server can return an inclusion, empties the content of buffer zone in client browser.If when now the browser of client sends request of access again, such as, access http://qq.com/foo.css, foo.css file can not be read from buffer area, foo.css file can be read by direct access services device.
Preferably, when to empty the inclusion information in response message be null value, step S60 in the above embodiments of the present application two, after the inclusion information emptied in response message being replaced the data resource preserved in the buffer area of browser, can comprise the steps:
Step S601, reception server response request of access and return empty response message.
Step S602, extracts the null value of the inclusion information in response message that empties.
Step S603, covers the data resource preserved in the buffer area of browser by null value, the buffer area of browser is cleared.
Above-described embodiment step S601 to step S603 can be implemented in client, and what return for reception server empties response message.
In the above embodiments of the present application, in a kind of optional scheme, the header packet information emptied in response message can be set at least comprise following any one or more field information: buffer control field, cache-time field and buffer memory compiling field, wherein, buffer control field is set to not buffer memory, cache-time field is set to-1 or 0, and buffer memory compiling field is set to not buffer memory.
In another optional scheme, empty in the header packet information in response message and following any one or more field information is not set: buffer control field, cache-time field and buffer memory compiling field.
As from the foregoing, the content emptying response message, the obtain manner that relate in the present embodiment three, and this empties the application example of response message and various preferred exemplary, identical with the example that above-described embodiment two provides, but it should be explicitly made clear at this point, the present embodiment three is not limited to the scheme that above-described embodiment two provides.
Same, do not mean that the application has made restriction to the above-mentioned content emptying response message that returns and obtain manner in above-described embodiment three, above-mentionedly to empty in response message except needing to carry except the above-mentioned message header field relevant to buffer memory, this asynchronous access request can also carry other fields, such as, location field, Server field, Content-Encoding field, Content-Length field, Content-Type field, Last-Modified field, Refresh field, Content-Disposition field, Transfer-Encoding field etc.
What needs further illustrated is, the request of access of asynchronous transmission in the above embodiments of the present application three can comprise a URL visit information, wherein, after the inclusion information emptied in response message being replaced the data resource preserved in the buffer area of browser or after in step S603, the buffer area of browser is cleared, can also comprise the steps:
Step S604, browser sends new request of access, and wherein, new request of access comprises URL visit information.
Step S605, detects that content in buffer area is for time empty, then inquire about and obtain the domain name in URL visit information.
Step S606, the server address corresponding according to the domain Name acquisition in URL visit information.
Step S607, browser accesses new server by server address, gets corresponding data resource.
The scheme that step S604 included by the above embodiments of the present application three to step S607 realizes, identical with the scheme that step S503 to step S506 in embodiment two provides, the scene of application also can be identical.It is noted, of course, that the such scheme of the present embodiment three can be not limited to content and the scene of above-described embodiment two.
What need detailed description is, the browser of the application's client is in step S601, reception server response request of access and return empty response message before, client first can arrange the header packet information of request of access, this header packet information at least comprises: self-defining removing field, buffer update time field, buffer control field and buffer memory compiling field, before the request of access receiving browser asynchronous transmission, method also comprises: corresponding different browsers is to arrange the header packet information of request of access, and the inclusion of request of access is set for sky, wherein
When browser is IE browser, arranging and removing field is YES, and arranging buffer update time field is 0, arranges buffer control field for not buffer memory, and arranges buffer memory compiling field for not buffer memory;
When browser is Firefox browser, arranging and removing field is YES, and arranging buffer update time field is 0, does not arrange buffer control field and buffer memory compiling field;
When browser is Opera browser, arranging and removing field is YES, and arranging buffer update time field is 0, arranges buffer control field for not buffer memory, and arranges buffer memory compiling field for not buffer memory;
When browser is Chrome browser, arranging and removing field is YES, arranges buffer control field for not buffer memory, and arranges buffer memory compiling field for not buffer memory, does not arrange buffer update time field.
What need detailed description is, the header packet information of above-mentioned asynchronous access information realizes by creating an xmlhttp object, concrete, need create and run the Run Script for sending asynchronous access request, such as, can create an xmlhttp object with JavaScript script in a browser, client browser uses xmlhttp object to send request of access, can very easily and server exchange data.
The application's such scheme can realize based on xmlhttp object, namely calls in a browser and after running xmlhttp object, client terminal start-up announcement server needs to carry out caching clearly.
The xmlhttp object created in the embodiment of the present application can have different establishment modes for different browsers, such as, in IE browser, ActiveXObject (" Msxml2.XMLHTTP ") or ActiveXObject (" Microsoft.XMLHTTP ") can be used to create, and in other modern browsers, newXMLHttpRequest () can be used to create.
It should be noted that, the contents such as the content of the xmlhttp object and the xmlhttp object created in described embodiment two that create in above-described embodiment three, obtain manner, example and application scenarios are identical, but are not limited to the content disclosed in embodiment two.
Same, the field arranged in the asynchronous access request provided in embodiment three and the form of expression and obtain manner have made restriction, in above-mentioned asynchronous access request except needs carry above-mentioned message header field, this asynchronous access request can also carry other fields, such as, Accept field, Accept-Charset field, Accept-Encoding field, Accept-Language field, Host field, Referer field, User-Agent field, Cookie field, Connection field, Date field etc.
Wherein, Accept: for high-speed servers, the data type that client computer is supported; Accept-Charset: for Tell server, the coded format that client computer adopts; Accept-Encoding: for Tell server, the data compression format that client computer is supported; Accept-Language: the language environment of client computer; Host: client computer, by this high-speed servers, wants the host name of accessing; Referer: client computer is by this head Tell server, and it visits server (door chain) from which resource; User-Agent: client computer passes through this head Tell server, the software environment of client computer; Cookie: client computer can to server band data by this head; Connection: whether disconnect after processing current request or continue to keep connecting; Date: current time value.
It should be noted that, for aforesaid each embodiment of the method, in order to simple description, therefore it is all expressed as a series of combination of actions, but those skilled in the art should know, the present invention is not by the restriction of described sequence of movement, because according to the present invention, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in instructions all belongs to preferred embodiment, and involved action and module might not be that the present invention is necessary.
Through the above description of the embodiments, those skilled in the art can be well understood to the mode that can add required general hardware platform by software according to the method for above-described embodiment and realize, hardware can certainly be passed through, but in a lot of situation, the former is better embodiment.Based on such understanding, technical scheme of the present invention can embody with the form of software product the part that prior art contributes in essence in other words, this computer software product is stored in a storage medium (as ROM/RAM, magnetic disc, CD), comprising some instructions in order to make a station terminal equipment (can be mobile phone, computing machine, server, or the network equipment etc.) perform the method for each embodiment of the present invention.
Embodiment 4
Fig. 4 is the apparatus structure schematic diagram removing cache file in the browser according to the embodiment of the present invention four.
According to the embodiment of the present invention, additionally provide a kind of for corresponding to the device implementing said method embodiment two, as shown in Figure 4, this device can be applied on the client, is described in detail below from the implementation process of angle to the application of client operation said apparatus.
This device can comprise: sending module 10, receiver module 30 and removing module 50.
Wherein, sending module 10, for browser asynchronous transmission request of access to server.
Receiver module 30, for reception server response request of access and return empty response message, wherein, when server detect in the header packet information of request of access comprise self-defining removing field, return and empty response message.
Remove module 50, for the inclusion information emptied in response message being replaced the data resource preserved in the buffer area of browser.Preferably, while replacing the data resource preserved in the buffer memory of browser, browser not buffer memory empties the inclusion information in response message.
In the above embodiments of the present application four, field is removed for self-defined one in the packet header of the asynchronous access request sent at browser by sending module 10, make after server receives asynchronous access request by receiver module 30, if the removing field in the packet header of asynchronous access request detected, just determine the content needing to return to client browser, namely to asynchronous access request should returning one and empty response message, remove inclusion information that this empties response message by module 50 and replace the scheme that the data resource that stores in original buffer memory provided by the embodiment of the present invention, relatively prior art does not need again to download whole access file, therefore, when the browser of client sends request of access next time, browser needs to reconnect server to obtain data resource, so not only achieve client browser can as required again access services device carry out Gains resources, guarantee can by obtaining from main control buffer memory the data resource that server upgrades in time, browser can be processed more flexibly data cached, thus the flow of browser process data is greatly reduced, avoid and lose time, improve the performance of access efficiency and browser, and then the method solving existing removing buffer memory in correlation technique is when processing large quantity file, access efficiency can be caused low and the technical matters of reduction browser performance.
Easily notice, while replacing the data resource preserved in the buffer memory of browser, if browser not buffer memory empties the inclusion information in response message, can know, due to browser not buffer memory empty the inclusion information in response message, therefore, by the scheme that the embodiment of the present invention provides, content in buffer memory can become null value, relatively prior art does not need again to download whole access file, employ empty file to replace, therefore, when the browser of client sends request of access next time, because the content in buffer area is empty, thus make browser need to reconnect server to obtain data resource, so not only achieve client browser can as required again access services device carry out Gains resources, guarantee can by obtaining from main control buffer memory the data resource that server upgrades in time, and due to the inclusion of the response message for emptying buffer area be null value, browser can be processed more flexibly data cached, thus the flow of browser process data is greatly reduced, avoid and lose time, improve the performance of access efficiency and browser.
The device that the above embodiments of the present application provide can run on the client, preferably, can by adding custom field in asynchronous request of access, thus to make server return an inclusion information be the response message of null value, achieve the removing of the data resource to client local cache, such scheme does not need again to download file corresponding to whole data resource, and employ in empty file replacement client and the data of buffer memory, make to read resource from local cache during browser access file, thus need direct access services device, thus server end makes after have updated data resource, client can as required fast and directly read the data of renewal.
As from the foregoing, the header packet information emptying response message that in the above embodiments of the present application, server 2 returns can be not only null value, also can not be null value (such as return json data { em:0}), but due to browser not buffer memory empty the inclusion information in response message, therefore, no matter inclusion packets of information is containing arbitrary content, and the buffer memory of browser all can be cleared, and the json data returned { em:0} can be used for notice browser and empty buffer memory.Empty the inclusion information of response message for bandwidth can be saved to greatest extent time empty.
Concrete, server is when receiving the request of access of this device asynchronous transmission, can check that whether packet header is containing removing field NohostCleanCache, preferably, be provided with this field being checked through, and the value of this field is when being Yes, it is empty response that server can return an inclusion, empties the content of buffer zone in client browser.If when now the browser of client sends request of access again, such as, access http://qq.com/foo.css, foo.css file can not be read from buffer area, foo.css file can be read by direct access services device.
Preferably, when to empty the inclusion information in response message be null value, the removing module 50 in above-described embodiment four can comprise: extraction module 501, for extracting the null value emptying inclusion information in response message; Overlay module 502, for null value being covered the data resource preserved in the buffer area of browser, makes the buffer area of browser be cleared.
Concrete, said extracted module 501 and overlay module 502 are corresponding to the step S501 in embodiment two and step S502, and above-mentioned module may operate in client as a part for device.Can software simulating be passed through, also can pass through hardware implementing.
Preferably, in a kind of embodiment in above-described embodiment four, the header packet information emptied in response message at least comprises following any one or more field information: buffer control field, cache-time field and buffer memory compiling field, wherein, buffer control field is set to not buffer memory, cache-time field is set to-1 or 0, and buffer memory compiling field is set to not buffer memory.
Preferably, another alternate exemplary in above-described embodiment four, empties in the header packet information in response message and does not arrange following any one or more field information: buffer control field, cache-time field and buffer memory compiling field.
Relate in the present embodiment four empty response message content, obtain manner are set, and this empties the application example of response message and various preferred exemplary, identical with the example that above-described embodiment two provides, but it should be explicitly made clear at this point, the present embodiment four is not limited to the scheme that above-described embodiment two provides.
Preferably, in each embodiment above-mentioned, after server receives asynchronous access request, except be checked through this asynchronous access request message header in containing NohostCleanCache field, just can return and empty response message, further, can also check whether the value of this field is set to YES, if be empty response message for YES just can return inclusion.
Need to further illustrate, the device in above-described embodiment four can also comprise: above-mentioned sending module, also sends new request of access for browser, and wherein, new request of access comprises URL visit information; Detection module, for detecting that the content in buffer area is sky, then inquires about and obtains the domain name in URL visit information; Acquisition module, for the server address corresponding according to the domain Name acquisition in URL visit information; Access modules, accesses new server for browser by server address, gets corresponding data resource.
The method that above-mentioned request sending module, detection module, acquisition module and the access modules step S503 respectively in corresponding above-described embodiment two realizes to step 506, the example that above-mentioned four modules and corresponding step realize is identical with application scenarios, but is not limited to the content disclosed in above-described embodiment two.Above-mentioned sending module, detection module, acquisition module and access modules operate in terminal, can pass through software or hardware implementing.
What need detailed description is, the browser of the application's client is before request sending module performs asynchronous transmission request of access, need create and run the Run Script for sending asynchronous access request, such as, an xmlhttp object can be created in a browser with JavaScript script, client browser uses xmlhttp object to send request of access, can very easily and server exchange data.
The application's such scheme can realize based on xmlhttp object, namely calls in a browser and after running xmlhttp object, client terminal start-up announcement server needs to carry out caching clearly.
The xmlhttp object created in the embodiment of the present application can have different establishment modes for different browsers, such as, in IE browser, ActiveXObject (" Msxml2.XMLHTTP ") or ActiveXObject (" Microsoft.XMLHTTP ") can be used to create, and in other modern browsers, newXMLHttpRequest () can be used to create.
Preferably, in the above embodiments of the present application, need to arrange some fields to the xmlhttp object created, then the xmlhttp object setting field is sent to server, the data file that request is corresponding as the content of asynchronous access request.Before the request of access receiving browser asynchronous transmission, said apparatus can also comprise: memory module, for preserving the header packet information of the request of access set by corresponding different browsers, and arranges the inclusion of request of access for sky.Concrete, the header packet information of the request of access of this asynchronous transmission at least can comprise following field: self-defining removing field (NohostCleanCache), buffer update time field (If-Modified-Since), buffer control field (Cache-Control) and buffer memory compiling field (Pragma), these fields are kept in the storer of client, can be in the buffer area of storer, and the header packet information of the corresponding different request of access set by browser is different, but the inclusion of this asynchronous access request is null value, it is concrete that to arrange content as follows:
When browser is IE browser, need to arrange 4 fields: arranging and removing field NohostCleanCache is YES, buffer update time field If-Modified-Since is 0, buffer control field Cache-Control is that buffer memory (is not no-cache, no-store), buffer memory compiling field Pragma is not buffer memory (being no-cache).
When browser is Firefox browser, need to arrange 2 fields: arranging and removing field NohostCleanCache is YES, buffer update time field If-Modified-Since is 0, does not need to arrange buffer control field Cache-Control and buffer memory compiling field Pragma.
When browser is Opera browser, need to arrange 4 fields: arranging and removing field NohostCleanCache is YES, buffer update time field If-Modified-Since is 0, buffer control field Cache-Control is that buffer memory (is not no-cache, no-store), buffer memory compiling field Pragma is not buffer memory (being no-cache);
When browser is Chrome browser, need to arrange 3 fields: arranging and removing field NohostCleanCache is YES, buffer control field Cache-Control is not buffer memory (being no-cache), buffer memory compiling field Pragma is not buffer memory (being no-cache), does not need to arrange buffer update time field If-Modified-Since.
NohostCleanCache field is in custom field, and in table, horizontal line represents this field and do not arrange corresponding data.And except Firefox be use POST mode and send request except, other browsers all use GET mode to send request.
It should be noted that, the contents such as the content of the xmlhttp object and the xmlhttp object created in described embodiment two that create in above-described embodiment four, obtain manner, example and application scenarios are identical, but are not limited to the content disclosed in embodiment two.
Embodiment 5
Fig. 5 is the apparatus structure schematic diagram removing cache file in the browser according to the embodiment of the present invention five.
According to the embodiment of the present invention, additionally provide a kind of for corresponding to the device implementing said method embodiment three, as shown in Figure 5, this device can be applied on server end, is described in detail below from the implementation process of angle to the application of client operation said apparatus.
This device can comprise: receiver module 20, detection module 40 and return module 60.
Wherein, receiver module 20, for receiving the request of access of the browser asynchronous transmission of client; Whether detection module 40, for comprising self-defining removing field in the header packet information of test access request; Return module 60, for when removing field being detected, returning and emptying response message, wherein, emptying response message for replacing the data resource preserved in the buffer memory of browser.Preferably, while replacing the data resource preserved in the buffer memory of browser, browser not buffer memory empties the inclusion information in response message.
In the above embodiments of the present application five, after receiver module 20 receives asynchronous access request, can be detected by the packet header of detection module 40 to the asynchronous access request received, determining whether to need to return packet header is empty empty response message, if the removing field in the packet header of asynchronous access request detected, just determine the content needing to return to client browser, namely to asynchronous access request should returning to client one and empty response message by returning module 60, this inclusion information emptying response message can replace the data resource stored in original buffer memory.By the scheme that the embodiment of the present invention provides, relatively prior art does not need again to download whole access file, therefore, when the browser of client sends request of access next time, browser needs to reconnect server to obtain data resource, so not only achieve client browser can as required again access services device carry out Gains resources, guarantee can by obtaining from main control buffer memory the data resource that server upgrades in time, browser can be processed more flexibly data cached, thus the flow of browser process data is greatly reduced, avoid and lose time, improve the performance of access efficiency and browser, and then the method solving existing removing buffer memory in correlation technique is when processing large quantity file, access efficiency can be caused low and the technical matters of reduction browser performance.
Above-mentioned removing field is the self-defining field of client, easily notice, while replacing the data resource preserved in the buffer memory of browser, if browser not buffer memory empties the inclusion information in response message, can know, due to browser not buffer memory empty the inclusion information in response message, therefore, by the scheme that the embodiment of the present invention provides, run above-mentioned modules on the server, can according to removing field and emptying response message and the content in buffer memory being become null value of returning, relatively prior art does not need again to download whole access file, employ empty file to replace, therefore, because server makes the content in buffer area for empty, thus make browser need to reconnect server to obtain data resource, so not only achieve browser can as required again access services device carry out Gains resources, guarantee can by obtaining from main control buffer memory the data resource that server upgrades in time, and due to the inclusion of the response message for emptying buffer area be null value, browser can be processed more flexibly data cached, thus the flow of browser process data is greatly reduced, avoid and lose time, improve the performance of access efficiency and browser.
The step S20 that the above embodiments of the present application five provide to step S60 can run on the server, preferably, can server to return an inclusion information by the asynchronous access request that with the addition of custom field be the response message of null value, achieve the removing of the data resource to browser local cache, such scheme does not need again to download file corresponding to whole data resource, and employ in empty file replacement client and the data of buffer memory, make to read resource from local cache during browser access file, thus need direct access services device, thus server end makes after have updated data resource, client can as required fast and directly read the data of renewal.
As from the foregoing, the header packet information emptying response message that in the above embodiments of the present application, server 2 returns can be not only null value, also can not be null value (such as return json data { em:0}), but due to browser not buffer memory empty the inclusion information in response message, therefore, no matter inclusion packets of information is containing arbitrary content, and the buffer memory of browser all can be cleared, and the json data returned { em:0} can be used for notice browser and empty buffer memory.Empty the inclusion information of response message for bandwidth can be saved to greatest extent time empty.
Concrete, server is when receiving the request of access of this asynchronous transmission, can check that whether packet header is containing removing field NohostCleanCache, preferably, be provided with this field being checked through, and the value of this field is when being Yes, it is empty response that server can return an inclusion, empties the content of buffer zone in client browser.If when now the browser of client sends request of access again, such as, access http://qq.com/foo.css, foo.css file can not be read from buffer area, foo.css file can be read by direct access services device.
Preferably, in the above embodiments of the present application four, when to empty the inclusion information in response message be null value, the module 60 that returns on the server realizes returning emptying response message to after client, said apparatus can also comprise as lower module: receive response message module, return empty response message for reception server response request of access; Extract response message module, for extracting the null value emptying inclusion information in response message; Covering cache module, for null value being covered the data resource preserved in the buffer area of browser, the buffer area of browser being cleared.
Concrete, above-mentioned reception response message module, extraction response message module and covering cache module are corresponding to the step S601 in embodiment three and step S603, and above-mentioned module may operate in the client corresponding to this server as a part for device.Can software simulating be passed through, also can pass through hardware implementing.
In the above embodiments of the present application five, in a kind of optional scheme, the header packet information emptied in response message can be set at least comprise following any one or more field information: buffer control field, cache-time field and buffer memory compiling field, wherein, buffer control field is set to not buffer memory, cache-time field is set to-1 or 0, and buffer memory compiling field is set to not buffer memory.
In another optional scheme, empty in the header packet information in response message and following any one or more field information is not set: buffer control field, cache-time field and buffer memory compiling field.
As from the foregoing, relate in the present embodiment five empty response message content, obtain manner are set, and this empties the application example of response message and various preferred exemplary, identical with the example that above-described embodiment three provides, but it should be explicitly made clear at this point, the present embodiment five is not limited to the scheme that above-described embodiment three provides.
Same, do not mean that the application has made restriction to the above-mentioned content emptying response message that returns and obtain manner in above-described embodiment five, above-mentionedly to empty in response message except needing to carry except the above-mentioned message header field relevant to buffer memory, this asynchronous access request can also carry other fields, such as, location field, Server field, Content-Encoding field, Content-Length field, Content-Type field, Last-Modified field, Refresh field, Content-Disposition field, Transfer-Encoding field etc.
Preferably, in each embodiment above-mentioned, after server receives asynchronous access request, except be checked through this asynchronous access request message header in containing NohostCleanCache field, just can return and empty response message, further, can also check whether the value of this field is set to YES, if be empty response message for YES just can return inclusion.
Need to further illustrate, the request of access of the asynchronous transmission in the above embodiments of the present application five can comprise a URL visit information, and wherein, after the buffer area performing browser is cleared, the device in above-described embodiment five can also comprise:
Request sending module, sends new request of access for browser, and wherein, new request of access comprises URL visit information; Detection module, detects that the content in buffer area is sky, then inquires about and obtain the domain name in URL visit information; Acquisition module, the server address corresponding according to the domain Name acquisition in URL visit information; Access modules, browser accesses new server by server address, gets corresponding data resource.
The method that above-mentioned request sending module, detection module, acquisition module and the access modules step S604 respectively in corresponding above-described embodiment three realizes to step 607, the example that above-mentioned four modules and corresponding step realize is identical with application scenarios, but is not limited to the content disclosed in above-described embodiment three.Above-mentioned request sending module, detection module, acquisition module and access modules operate in terminal, can pass through software or hardware implementing.
In addition, the modules that the above embodiments of the present application five provide is also identical with the scheme that embodiment four provides, and the scene of application also can be identical.It is noted, of course, that the such scheme of the present embodiment five can be not limited to content and the scene of above-described embodiment four.
Need to describe in detail, need to arrange some fields to the xmlhttp object created, then the xmlhttp object setting field is sent to server, the data file that request is corresponding as the content of asynchronous access request.Before the request of access receiving browser asynchronous transmission, said apparatus can also comprise: memory module, for preserving the header packet information of the request of access set by corresponding different browsers, and arranges the inclusion of request of access for sky.Concrete, the header packet information of the request of access of this asynchronous transmission at least can comprise following field: self-defining removing field (NohostCleanCache), buffer update time field (If-Modified-Since), buffer control field (Cache-Control) and buffer memory compiling field (Pragma), these fields are kept in the storer of client, can be in the buffer area of storer, and the header packet information of the corresponding different request of access set by browser is different, but the inclusion of this asynchronous access request is null value, it is concrete that to arrange content as follows:
When browser is IE browser, arranging and removing field is YES, and arranging buffer update time field is 0, arranges buffer control field for not buffer memory, and arranges buffer memory compiling field for not buffer memory;
When browser is Firefox browser, arranging and removing field is YES, and arranging buffer update time field is 0, does not arrange buffer control field and buffer memory compiling field;
When browser is Opera browser, arranging and removing field is YES, and arranging buffer update time field is 0, arranges buffer control field for not buffer memory, and arranges buffer memory compiling field for not buffer memory;
When browser is Chrome browser, arranging and removing field is YES, arranges buffer control field for not buffer memory, and arranges buffer memory compiling field for not buffer memory, does not arrange buffer update time field.
What further describe is, because the header packet information of above-mentioned asynchronous access information realizes by creating an xmlhttp object, then need to create and run the Run Script for sending asynchronous access request, such as, an xmlhttp object can be created in a browser with JavaScript script, client browser uses xmlhttp object to send request of access, can very easily and server exchange data.
The application's such scheme can realize based on xmlhttp object, namely calls in a browser and after running xmlhttp object, client terminal start-up announcement server needs to carry out caching clearly.
The xmlhttp object created in the embodiment of the present application can have different establishment modes for different browsers, such as, in IE browser, ActiveXObject (" Msxml2.XMLHTTP ") or ActiveXObject (" Microsoft.XMLHTTP ") can be used to create, and in other modern browsers, newXMLHttpRequest () can be used to create.
It should be noted that, the contents such as the content of the xmlhttp object and the xmlhttp object created in described embodiment three that create in above-described embodiment five, obtain manner, example and application scenarios are identical, but are not limited to the content disclosed in embodiment three.
From above description, can find out, present invention achieves following technique effect: the scheme provided by the embodiment of the present invention, content in buffer memory can become null value, relatively prior art does not need again to download whole access file, employ empty file to replace, therefore, when the browser of client sends request of access next time, because the content in buffer area is empty, thus make browser need to reconnect server to obtain data resource, so not only achieve client browser can as required again access services device carry out Gains resources, guarantee can obtain the data resource that server upgrades in time, and due to the inclusion of the response message for emptying buffer area be null value, thus the flow of browser process data is greatly reduced, avoid and lose time, improve the performance of access efficiency and browser.
The invention described above embodiment sequence number, just to describing, does not represent the quality of embodiment.
In the above embodiment of the present invention, the description of each embodiment is all emphasized particularly on different fields, in certain embodiment, there is no the part described in detail, can see the associated description of other embodiments.
In several embodiments that the application provides, should be understood that, disclosed client, the mode by other realizes.Wherein, device embodiment described above is only schematic, the such as division of described unit, be only a kind of logic function to divide, actual can have other dividing mode when realizing, such as multiple unit or assembly can in conjunction with or another system can be integrated into, or some features can be ignored, or do not perform.Another point, shown or discussed coupling each other or direct-coupling or communication connection can be by some interfaces, and the indirect coupling of unit or module or communication connection can be electrical or other form.
The described unit illustrated as separating component or can may not be and physically separates, and the parts as unit display can be or may not be physical location, namely can be positioned at a place, or also can be distributed in multiple network element.Some or all of unit wherein can be selected according to the actual needs to realize the object of the present embodiment scheme.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, also can be that the independent physics of unit exists, also can two or more unit in a unit integrated.Above-mentioned integrated unit both can adopt the form of hardware to realize, and the form of SFU software functional unit also can be adopted to realize.
If described integrated unit using the form of SFU software functional unit realize and as independently production marketing or use time, can be stored in a computer read/write memory medium.Based on such understanding, the part that technical scheme of the present invention contributes to prior art in essence in other words or all or part of of this technical scheme can embody with the form of software product, this computer software product is stored in a storage medium, comprises all or part of step of some instructions in order to make a computer equipment (can be personal computer, server or the network equipment etc.) perform method described in each embodiment of the present invention.And aforesaid storage medium comprises: USB flash disk, ROM (read-only memory) (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), portable hard drive, magnetic disc or CD etc. various can be program code stored medium.
The above is only the preferred embodiment of the present invention; it should be pointed out that for those skilled in the art, under the premise without departing from the principles of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.

Claims (20)

1. remove a method for cache file in browser, it is characterized in that, comprising:
Browser asynchronous transmission request of access is to server;
Receive described server and respond described request of access and return empty response message, wherein, when described server detect in the header packet information of described request of access comprise self-defining removing field time, return and empty response message;
The inclusion information emptied described in using in response message replaces the data resource preserved in the buffer area of described browser.
2. method according to claim 1, it is characterized in that, when the described inclusion information emptied in response message is null value, the step that the inclusion information emptied described in using in response message replaces the data resource preserved in the buffer area of described browser comprises:
The null value of inclusion information in response message is emptied described in extraction;
Described null value is covered the data resource preserved in the buffer area of described browser, the buffer area of described browser is cleared.
3. method according to claim 1 and 2, it is characterized in that, the described header packet information emptied in response message at least comprises following any one or more field information: buffer control field, cache-time field and buffer memory compiling field, wherein, described buffer control field is set to not buffer memory, described cache-time field is set to-1 or 0, and described buffer memory compiling field is set to not buffer memory.
4. method according to claim 1 and 2, is characterized in that, described in empty in response message header packet information in following any one or more field information is not set: buffer control field, cache-time field and buffer memory compiling field.
5. method according to claim 1 and 2, it is characterized in that, described request of access comprises a URL visit information, wherein, after described in use, the inclusion information emptied in response message replaces the data resource preserved in the buffer area of described browser, described method also comprises:
Described browser sends new request of access, and wherein, described new request of access comprises described URL visit information;
When detecting that the content in described buffer area is for time empty, inquires about and obtains the domain name in described URL visit information;
The server address corresponding according to the domain Name acquisition in described URL visit information;
Described browser accesses new server by described server address, gets corresponding data resource.
6. method according to claim 1, it is characterized in that, the header packet information of described request of access at least comprises: self-defining described removing field, buffer update time field, buffer control field and buffer memory compiling field, before the request of access receiving browser asynchronous transmission, described method also comprises: corresponding different browsers is to arrange the header packet information of described request of access, and the inclusion of described request of access is set for sky, wherein
When described browser is IE browser, arranging described removing field is YES, and arranging described buffer update time field is 0, arranges described buffer control field for not buffer memory, and arranges described buffer memory compiling field for not buffer memory;
When described browser is Firefox browser, arranging described removing field is YES, and arranging described buffer update time field is 0, does not arrange described buffer control field and described buffer memory compiling field;
When described browser is Opera browser, arranging described removing field is YES, and arranging described buffer update time field is 0, arranges described buffer control field for not buffer memory, and arranges described buffer memory compiling field for not buffer memory;
When described browser is Chrome browser, arranging described removing field is YES, arranges described buffer control field for not buffer memory, and arranges described buffer memory compiling field for not buffer memory, does not arrange described buffer update time field.
7. remove a system for cache file in browser, it is characterized in that, comprising:
Client, for browser asynchronous transmission request of access;
Server, sets up communication relation with described client, for when comprising self-defining removing field in the header packet information described request of access being detected, returning and emptying response message to described client;
Wherein, described in client use, the inclusion information emptied in response message replaces the data resource preserved in the buffer memory of described browser.
8. system according to claim 7, is characterized in that, when the described inclusion information emptied in response message is null value, described client comprises:
Receiving trap, responds described request of access and return empty response message for receiving described server;
Processor, for emptying the null value of inclusion information in response message described in extracting, and covers the data resource preserved in the buffer area of described browser, the buffer area of described browser is cleared by described null value.
9. the system according to claim 7 or 8, it is characterized in that, the described header packet information emptied in response message at least comprises following any one or more field information: buffer control field, cache-time field and buffer memory compiling field, wherein, described buffer control field is set to not buffer memory, described cache-time field is set to-1 or 0, and described buffer memory compiling field is set to not buffer memory.
10. the system according to claim 7 or 8, is characterized in that, described in empty in response message header packet information in following any one or more field information is not set: buffer control field, cache-time field and buffer memory compiling field.
11. systems according to claim 7 or 8, it is characterized in that, described request of access comprises a URL visit information, and wherein, described client also comprises:
Dispensing device, sends new request of access for described browser, and wherein, described new request of access comprises described URL visit information;
Described processor, also for when the content in described buffer area being detected for sky, inquire about and obtain the domain name in described URL visit information, and the server address corresponding according to the domain name in described URL visit information accesses new server, get corresponding data resource.
12. systems according to claim 7, it is characterized in that, the header packet information of described request of access at least comprises: self-defining described removing field, buffer update time field, buffer control field and buffer memory compiling field, wherein, described client also comprises: storer, and for preserving the header packet information of the request of access set by corresponding different browsers, and the inclusion of described request of access is empty, wherein
When described browser is IE browser, described removing field is YES, and described buffer update time field is 0, and described buffer control field is not buffer memory, and described buffer memory compiling field is not buffer memory;
When described browser is Firefox browser, described removing field is YES, and described buffer update time field is 0, does not preserve described buffer control field and described buffer memory compiling field;
When described browser is Opera browser, described removing field is YES, and described buffer update time field is 0, and described buffer control field is not buffer memory, and described buffer memory compiling field is not buffer memory;
When described browser is Chrome browser, described removing field is YES, and described buffer control field is not buffer memory, and described buffer memory compiling field is not buffer memory, does not preserve described buffer update time field.
Remove the device of cache file in 13. 1 kinds of browsers, it is characterized in that, comprising:
Sending module, for browser asynchronous transmission request of access to server;
Receiver module, responds described request of access and return empty response message for receiving described server, wherein, time described server detect in the header packet information of described request of access when comprising self-defining removing field, return and empty response message;
Remove module, for the inclusion information emptied in response message is replaced the data resource preserved in the buffer area of described browser.
14. devices according to claim 13, is characterized in that, when the described inclusion information emptied in response message is null value, described removing module comprises:
Extraction module, for emptying the null value of inclusion information in response message described in extracting;
Overlay module, for described null value being covered the data resource preserved in the buffer area of described browser, makes the buffer area of described browser be cleared.
15. devices according to claim 13 or 14, it is characterized in that, the described header packet information emptied in response message at least comprises following any one or more field information: buffer control field, cache-time field and buffer memory compiling field, wherein, described buffer control field is set to not buffer memory, described cache-time field is set to-1 or 0, and described buffer memory compiling field is set to not buffer memory.
16. devices according to claim 13 or 14, is characterized in that, described in empty in response message header packet information in following any one or more field information is not set: buffer control field, cache-time field and buffer memory compiling field.
17. devices according to claim 13 or 14, it is characterized in that, described request of access comprises a URL visit information, and wherein, described device also comprises:
Described sending module, also sends new request of access for described browser, and wherein, described new request of access comprises described URL visit information;
Detection module, for when the content in described buffer area being detected for sky, inquiring about and obtaining the domain name in described URL visit information;
Acquisition module, for the server address corresponding according to the domain Name acquisition in described URL visit information;
Access modules, accesses new server for described browser by described server address, gets corresponding data resource.
18. devices according to claim 13, it is characterized in that, the header packet information of described request of access at least comprises: self-defining described removing field, buffer update time field, buffer control field and buffer memory compiling field, wherein, described device also comprises: memory module, for preserving the header packet information of the request of access set by corresponding different browsers, and arranges the inclusion of described request of access for sky, wherein
When described browser is IE browser, described removing field is YES, and described buffer update time field is 0, and described buffer control field is not buffer memory, and described buffer memory compiling field is not buffer memory;
When described browser is Firefox browser, described removing field is YES, and described buffer update time field is 0, does not preserve described buffer control field and described buffer memory compiling field;
When described browser is Opera browser, described removing field is YES, and described buffer update time field is 0, and described buffer control field is not buffer memory, and described buffer memory compiling field is not buffer memory;
When described browser is Chrome browser, described removing field is YES, and described buffer control field is not buffer memory, and described buffer memory compiling field is not buffer memory, does not preserve described buffer update time field.
Remove the method for cache file in 19. 1 kinds of browsers, it is characterized in that, comprising:
Receive the request of access of the browser asynchronous transmission of client;
Detect in the header packet information of described request of access and whether comprise self-defining removing field;
When described removing field being detected, returning and emptying response message, wherein, described in empty response message for replacing the data resource preserved in the buffer memory of described browser.
Remove the device of cache file in 20. 1 kinds of browsers, it is characterized in that, comprising:
Receiver module, for receiving the request of access of the browser asynchronous transmission of client;
Detection module, for detect described request of access header packet information in whether comprise self-defining removing field;
Return module, for when described removing field being detected, returning and emptying response message, wherein, described in empty response message for replacing the data resource preserved in the buffer memory of described browser.
CN201310538458.8A 2013-11-04 2013-11-04 The methods, devices and systems of cache file are removed in browser Active CN104615597B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310538458.8A CN104615597B (en) 2013-11-04 2013-11-04 The methods, devices and systems of cache file are removed in browser

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310538458.8A CN104615597B (en) 2013-11-04 2013-11-04 The methods, devices and systems of cache file are removed in browser

Publications (2)

Publication Number Publication Date
CN104615597A true CN104615597A (en) 2015-05-13
CN104615597B CN104615597B (en) 2019-04-12

Family

ID=53150048

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310538458.8A Active CN104615597B (en) 2013-11-04 2013-11-04 The methods, devices and systems of cache file are removed in browser

Country Status (1)

Country Link
CN (1) CN104615597B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105933420A (en) * 2016-04-27 2016-09-07 江苏物联网研究发展中心 Method and system for realizing file uploading from client to server through http
CN106777033A (en) * 2016-12-09 2017-05-31 北京齐尔布莱特科技有限公司 The method that Squid removes cache file according to catalogue format
CN108259198A (en) * 2016-12-28 2018-07-06 中国移动通信集团辽宁有限公司 A kind of pre-judging method, device and the equipment of domain name cache hit rate
CN108388657A (en) * 2018-03-06 2018-08-10 五八有限公司 Cookie storage methods, device, equipment and readable storage medium storing program for executing
CN114301607A (en) * 2021-12-30 2022-04-08 山石网科通信技术股份有限公司 Method and device for clearing browser certificate, storage medium and processor

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6094662A (en) * 1998-04-30 2000-07-25 Xerox Corporation Apparatus and method for loading and reloading HTML pages having cacheable and non-cacheable portions
CN101807193A (en) * 2009-12-31 2010-08-18 优视科技有限公司 Browsing method used for mobile communication equipment terminal
CN101957842A (en) * 2010-09-13 2011-01-26 青岛海信移动通信技术股份有限公司 Webpage cache control method, device and system based on WebKit browser
CN102109989A (en) * 2009-12-29 2011-06-29 阿里巴巴集团控股有限公司 Method, device and system for controlling browser cache

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6094662A (en) * 1998-04-30 2000-07-25 Xerox Corporation Apparatus and method for loading and reloading HTML pages having cacheable and non-cacheable portions
CN102109989A (en) * 2009-12-29 2011-06-29 阿里巴巴集团控股有限公司 Method, device and system for controlling browser cache
CN101807193A (en) * 2009-12-31 2010-08-18 优视科技有限公司 Browsing method used for mobile communication equipment terminal
CN101957842A (en) * 2010-09-13 2011-01-26 青岛海信移动通信技术股份有限公司 Webpage cache control method, device and system based on WebKit browser

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105933420A (en) * 2016-04-27 2016-09-07 江苏物联网研究发展中心 Method and system for realizing file uploading from client to server through http
CN106777033A (en) * 2016-12-09 2017-05-31 北京齐尔布莱特科技有限公司 The method that Squid removes cache file according to catalogue format
CN106777033B (en) * 2016-12-09 2019-06-25 北京齐尔布莱特科技有限公司 The method that Squid removes cache file according to catalogue format
CN108259198A (en) * 2016-12-28 2018-07-06 中国移动通信集团辽宁有限公司 A kind of pre-judging method, device and the equipment of domain name cache hit rate
CN108259198B (en) * 2016-12-28 2021-08-06 中国移动通信集团辽宁有限公司 Method, device and equipment for prejudging domain name cache hit rate
CN108388657A (en) * 2018-03-06 2018-08-10 五八有限公司 Cookie storage methods, device, equipment and readable storage medium storing program for executing
CN108388657B (en) * 2018-03-06 2022-04-05 五八有限公司 Cookie storage method, device, equipment and readable storage medium
CN114301607A (en) * 2021-12-30 2022-04-08 山石网科通信技术股份有限公司 Method and device for clearing browser certificate, storage medium and processor
CN114301607B (en) * 2021-12-30 2024-02-06 山石网科通信技术股份有限公司 Certificate clearing method and device for browser, storage medium and processor

Also Published As

Publication number Publication date
CN104615597B (en) 2019-04-12

Similar Documents

Publication Publication Date Title
CN102438045B (en) Method and system for pre-fetching web page, and method for accessing web page
US11477298B2 (en) Offline client replay and sync
US8533310B2 (en) Method and apparatus for acceleration by prefetching associated objects
CN103124263B (en) A kind of advertisement push system and advertisement pushing equipment, Advertisement Server
CN105930528B (en) Webpage caching method and server
CN101287013B (en) Method for updating Webpage and Web proxy device
CN107391664A (en) Page data processing method and system based on WEB
US20150026239A1 (en) Dynamically selecting between acceleration techniques based on content request attributes
CN104798071A (en) Improving web sites performance using edge servers in fog computing architecture
CN105095280A (en) Caching method and apparatus for browser
CN101159762B (en) Method and device of accelerating download of web page contents
CN103455478A (en) Webpage access accelerating method and device
CN103942225A (en) Method and system for invoking resources of Hybrid App client and client
KR20160135250A (en) Prefetching application data for periods of disconnectivity
CN104468852A (en) Method, device and system for client to select IP link address
CN104615597A (en) Method, device and system for clearing cache file in browser
CN107463657B (en) File operation method and terminal
CN103516785A (en) Web page proxy system and communication method thereof
CN104378399A (en) Data push method, platform server, client terminal and system
CN104572777A (en) Webpage loading method and device based on UIWebView component
EP2176796A2 (en) Method for media discovery
CN109634753B (en) Data processing method, device, terminal and storage medium for switching browser kernels
CN105550179A (en) Webpage collection method and browser plug-in
CN108874472B (en) Method and system for optimally displaying user head portraits
CN101699823A (en) Method for realizing caching resource in curl library

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant