CN104615597B - The methods, devices and systems of cache file are removed in browser - Google Patents

The methods, devices and systems of cache file are removed in browser Download PDF

Info

Publication number
CN104615597B
CN104615597B CN201310538458.8A CN201310538458A CN104615597B CN 104615597 B CN104615597 B CN 104615597B CN 201310538458 A CN201310538458 A CN 201310538458A CN 104615597 B CN104615597 B CN 104615597B
Authority
CN
China
Prior art keywords
field
browser
cache
caching
access request
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.)
Active
Application number
CN201310538458.8A
Other languages
Chinese (zh)
Other versions
CN104615597A (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

Abstract

The invention discloses the methods, devices and systems that cache file is removed in a kind of browser.Wherein, which includes: client, is used for browser asynchronous transmission access request;Server establishes communication relations with client, and in the case where for including customized removing field in the header packet information for detecting access request, return empties response message to client;Wherein, the data resource that client will be saved in the caching of the backpack body information emptied in response message replacement browser.By means of the invention it is possible to guarantee that client can obtain the data resource updated on server in time by autonomous control caching, while the flow of browser processing data is greatly reduced, avoids and waste time, improve the performance of access efficiency and browser.

Description

The methods, devices and systems of cache file are removed in browser
Technical field
The present invention relates to computer internet fields, in particular to the side for removing cache file in a kind of browser Method, device and system.
Background technique
Under normal circumstances, based on hypertext transfer protocol (Hypertext Transfer Protocol, referred to as HTTP some fields relevant to file cache, including buffer control can be defined in access request) and response message (cache-control) and the fields such as cache-time (expires).When these fields are arranged to specifically be worth, file is just It can be got up by browser rs cache.
For example, when user uses browser to access file f oo.css on the client, firstly, being sent by browser Solicited message includes the address URL: http://qq.com/foo.css in the solicited message to server, and server end was for should It is browser of the response message to client for accessing file f oo.css that the address URL, which returns to a backpack body, if response message Expires field in head response is arranged to No. 10 point of in September, 2,013 0 minute and 0 second, then browser can be in this time (with this The ground time calculates) cache access file f oo.css is in local always before, if user accesses this using browser again When URL, browser will directly read file content from local cache within this time, no longer send HTTP to server Request.
For another example, it if the value of the field Cache-Control in head response is arranged to max-age=300, visits Ask that file f oo.css can be 300 seconds by browser rs cache, user accesses identical ULR in 300 seconds, and browser will be returned directly Cache contents are returned, do not send HTTP request to server.
The above-mentioned method in browser local cache access file, it is intended to reduce browser to server and HTTP request occurs Number, but in some cases, for wishing that (one of possible reason is for file that browser can be instantly available on server This file is just updated), at this point, browser would not be sent to server if file is still in buffered state Access request, the file that can not be updated from server without sending access request.
The prior art, which provides one, as a result, can remove the function of caching in browser, so that next browser access When the access file, the read access file not instead of from caching, directly to server demand file.Existing removing browsing The technical solution cached in device is as follows: by creating XMLHTTP object, after running the script, browser is initiated to server Asynchronous Request, thus achieve the purpose that mandatory requirement accesses file, after access request forces to obtain entire access file, new text Part can cover the ancient deed in caching, at this point, still preserving file in buffer area, only buffered file is new text Part.
For example, after this resource of client browser requests http://qq.com/foo.css, client-cache by The access file f oo.css that server returns, at this point, browser can be asked by running the script of XMLHTTP object come asynchronous V=2 http://qq.com/foo.css are asked, to obtain new resources, specifically, server can return newly according to Asynchronous Request Access file f oo.css.Particularly, aforesaid way is obtaining in such a way that search is added at the end of the address url Newest resource.
Analysis is it is found that the scheme for the removing browser rs cache that the prior art provides includes following defect:
On the one hand, the file amount for being not suitable for Asynchronous Request is excessive.Number of files if necessary to remove caching is huge, then takes The backpack body information content for the response message that business device returns is excessive, thus the problem that the flow that will lead to browser processing data is excessive, Access time is wasted very much, and browser performance can be greatly reduced.
On the other hand, many kinds of due to existing browser, the method for above-mentioned removing caching can not be suitable for all Browser.
For the above-mentioned method for removing caching existing in the related technology when handling big quantity file, access effect will lead to Rate it is low and reduce browser performance the problem of, currently no effective solution has been proposed.
Summary of the invention
The embodiment of the invention provides the methods, devices and systems that cache file is removed in a kind of browser, at least to solve Certainly in the related technology it is existing remove caching method when handle big quantity file, will lead to access efficiency it is low and reduce browse The technical issues of device performance.
One side according to an embodiment of the present invention additionally provides the system that cache file is removed in a kind of browser, this is System includes: client, is used for browser asynchronous transmission access request;Server establishes communication relations with client, for examining It measures in the header packet information of access request comprising in the case where customized removing field, return empties response message to client End;Wherein, the data being saved in caching of the client using the backpack body information replacement browser emptied in response message provide Source.
Other side according to an embodiment of the present invention provides a kind of method that cache file is removed in browser, should Method includes: browser asynchronous transmission access request to server;What reception server was returned in response to access request empties sound Answer information, wherein in the case where including customized removing field in the header packet information that server detects access request, return It returns and empties response message;The data being saved in buffer area using the backpack body information replacement browser emptied in response message Resource.
Another aspect according to an embodiment of the present invention additionally provides the device that cache file is removed in a kind of browser, should Device includes: sending module, for browser asynchronous transmission access request to server;Receiving module, for receiving server What is returned in response to access request empties response message, wherein includes in the header packet information that server detects access request In the case where customized removing field, return empties response message;Module is removed, for the backpack body in response message will to be emptied The data resource being saved in the buffer area of information replacement browser.
Another aspect according to an embodiment of the present invention additionally provides a kind of method that cache file is removed in browser, should Method includes: to receive the access request of the browser asynchronous transmission of client;Whether wrapped in the header packet information of test access request Containing customized removing field;In the case where detecting removing field, return empties response message, wherein empties response letter Cease the data resource being saved in the caching for replacing browser.
It is according to an embodiment of the present invention in another aspect, additionally provide the device for removing cache file in a kind of browser, should Device includes: receiving module, the access request of the browser asynchronous transmission for receiving client;Detection module, for detecting It whether include customized removing field in the header packet information of access request;Return module, for detecting removing field In the case of, return empties response message, wherein empties the data being saved in caching of the response message for replacing browser Resource.
In embodiments of the present invention, using client, it is used for browser asynchronous transmission access request;Server, with client Communication relations are established at end, in the case where for including customized removing field in the header packet information for detecting access request, Return empties response message to client;Wherein, client uses the backpack body information replacement browser emptied in response message The data resource being saved in caching.Above scheme passes through customized in the packet header for the asynchronous access request that client is sent One removing field, after server receives asynchronous access request, if clear in detecting packet header of asynchronous access request Except field, the content for needing to return to client browser has been determined that, can replace the data resource stored in original caching, It is easily noted that, through the embodiment of the present invention provided scheme, compares the prior art and do not need to re-download entire access text Part, therefore, when issuing access request the browser next time of client, browser needs to reconnect server to obtain data Resource, not only realizing client browser in this way can according to need again access server to obtain resource, and guarantee can be with The data resource updated on server is obtained in time by autonomous control caching, allows browser is more flexible to handle It is data cached so that browser processing data flow greatly reduce, avoid and waste time, improve access efficiency and The performance of browser, and then the method for solving existing removing caching in the related technology can be led when handling big quantity file The technical issues of causing access efficiency low and reducing browser performance.
Detailed description of the invention
The drawings described herein are used to provide a further understanding of the present invention, constitutes part of this application, this hair Bright illustrative embodiments and their description are used to explain the present invention, and are not constituted improper limitations of the present invention.In the accompanying drawings:
Fig. 1 be according to embodiments of the present invention one browser in remove cache file system structure diagram;
Fig. 2 be according to embodiments of the present invention two browser in remove cache file method schematic diagram;
Fig. 3 be according to embodiments of the present invention three browser in remove cache file method schematic diagram;
Fig. 4 be according to embodiments of the present invention four browser in remove cache file apparatus structure schematic diagram;And
Fig. 5 be according to embodiments of the present invention five browser in remove cache file apparatus structure schematic diagram.
Specific embodiment
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phase Mutually combination.The present invention will be described in detail below with reference to the accompanying drawings and embodiments.
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention Attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only The embodiment of a part of the invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill people The model that the present invention protects all should belong in member's every other embodiment obtained without making creative work It encloses.
It should be noted that description and claims of this specification and term " first " in above-mentioned attached drawing, " Two " etc. be to be used to distinguish similar objects, without being used to describe a particular order or precedence order.It should be understood that using in this way Data be interchangeable under appropriate circumstances, so as to the embodiment of the present invention described herein can in addition to illustrating herein or Sequence other than those of description is implemented.In addition, term " includes " and " having " and their any deformation, it is intended that cover Cover it is non-exclusive include, for example, the process, method, system, product or equipment for containing a series of steps or units are not necessarily limited to Step or unit those of is clearly listed, but may include be not clearly listed or for these process, methods, product Or other step or units that equipment is intrinsic.
Embodiment 1
Before the further details of description present embodiments, it will be described with reference to Figure 1 and can be used for realizing this Shen The suitable counting system structure of one of principle please.In the following description, unless otherwise specified, will with reference to by one or The symbol of movement and operation that multiple computers execute indicates to describe present embodiments.As such, it will be understood that sometimes Referred to as computer execute this kind of movement and operation include computer processing unit indicate data to structured form The manipulation of electric signal.This manipulation transforms data on the position in the storage system of computer safeguard it, this is with this The mode that the technical staff in field understands reconfigures or changes the operation of computer.The data structure for safeguarding data is that have The physical location of the memory of particular community defined in the format of data.However, although in above-mentioned this Shen of described in the text up and down Please, but it does not mean restrictive, as understood by those skilled in the art, movement described below and operation Various aspects can also be realized with hardware.
In its most basic configuration, Fig. 1 be according to embodiments of the present invention one browser in remove cache file and be System structural schematic diagram.For purposes of illustration, the architecture drawn is only an example of proper environment, not to the application Use scope or function propose any limitation.Also the computing system should not be construed to any component shown in FIG. 1 or its Combination has any dependence or demand.
As shown in Figure 1, the system may include: a client 1 and a server 2.
Client 1 is used for browser asynchronous transmission access request.
Server 2 establishes communication relations with client 1, for including certainly in the header packet information for detecting access request In the case where the removing field of definition, return empties response message to client 1.
Wherein, it has been saved in caching of the client 1 using the backpack body information replacement browser emptied in response message Data resource.Preferably, while the data resource being saved in the caching for replacing browser, browser is not cached and is emptied Backpack body information in response message.
The above embodiments of the present application, by the packet header for the asynchronous access request that client 1 is sent customized one it is clear Except field, after server 2 receives asynchronous access request, if the removing word in detecting packet header of asynchronous access request Section, has determined that the content for needing to return to 1 browser of client, that is, corresponds to the asynchronous access request and can return to one and empty sound Information is answered, which can replace the data resource stored in original caching.It is real through the invention Scheme provided by example is applied, compares the prior art and does not need to re-download entire access file, therefore, in the browser of client When next time issues access request, browser needs to reconnect server to obtain data resource, not only realizes client in this way End browser can according to need again access server to obtain resource, and guarantee can be obtained in time by autonomous control caching The data resource updated on server is taken, allows the more flexible processing of browser data cached, so that browser The flow of processing data greatly reduces, and avoids and wastes time, improve the performance of access efficiency and browser, and then solves In the related technology it is existing remove caching method when handle big quantity file, will lead to access efficiency it is low and reduction browser The technical issues of performance.
Be easily noted that, replace browser caching in be saved data resource while, if browser is not Caching empties the backpack body information in response message, can know, since browser does not cache the backpack body letter emptied in response message Breath, therefore, through the embodiment of the present invention provided by scheme, the content in caching will become null value, compares the prior art and be not required to Entire access file is re-downloaded, empty file has been used to replace, therefore, has issued access in the browser next time of client 1 When request, since the content in buffer area is sky, so that browser needs to reconnect server 2 to obtain data money Source, not only realizing 1 browser of client in this way can according to need again access server 2 to obtain resource, and guarantee can be with The data resource updated on server 2 is obtained in time by autonomous control caching, allows the more flexible place of browser Manage it is data cached, and due to the backpack body of the response message for the area that empties the cache be null value so that browser handle number According to flow greatly reduce, avoid and waste time, improve the performance of access efficiency and browser.
Preferably, it in above-described embodiment one provided by the present application, can be made by oneself by being added in asynchronous access request Adopted field realizes local to client 1 slow so that server 2 returns to the response message that a backpack body information is null value The removing for the data resource deposited, above scheme does not need to re-download the corresponding file of entire data resource, and has used ineffective law, rule, etc. Part replaces in client 1 and the data of caching, so that browser can not read resource from local cache when accessing file, from And need directly to access server 2, so that client 1 can be according to need after 2 end of server has updated data resource Quickly and directly to read the data of update.
From the foregoing, it will be observed that the header packet information for emptying response message that server 2 returns in the above embodiments of the present application not only may be used Think null value, can not also be null value (for example returning to a json data { em:0 }), but empty sound since browser does not cache The backpack body information in information is answered, therefore, no matter backpack body information includes arbitrary content, and the caching of browser can all be emptied, and return The json data { em:0 } returned can be used to that browser is notified to empty the cache.Emptying can when the backpack body information of response message is empty To save bandwidth to greatest extent.
Specifically, server 2 in the access request for receiving the asynchronous transmission, can check whether packet header contains removing word Section NohostCleanCache, it is preferable that be provided with the field checking, and the value of the field be Yes when, server 2 can It is empty response to return to a backpack body, to empty the content of buffer area in 1 browser of client.At this time if client 1 When browser issues access request again, such as access http://qq.com/foo.css, it will not be read from buffer area Foo.css file can directly access server 2.
Preferably, when emptying the backpack body information in response message is null value, the client of the above embodiments of the present application one kind End 1 may include following part: reception device 102 and processor 103.
Wherein, reception device 102 empty response message for receive that server 2 returns in response to access request;Processing Device 103 for extracting the null value for emptying backpack body information in response message, and will have been protected in the buffer area of null value covering browser The data resource deposited, so that the buffer area of browser is emptied.
Above-mentioned reception device 102 and processor 103 can also pass through software reality in addition to that can realize by hardware device It is existing.
It should be further noted that also needing to set in the access request of asynchronous transmission in the above embodiments of the present application one A URL access information is set, after the buffer area in 1 browser of client for data cached resource is emptied, client 1 Browser, which is executed, by sending device 101 sends new access request, wherein new access request also includes above-mentioned URL access information, During client 1 obtains new data resource by the URL access information, the processor 103 in client 1 is opened first Begin to detect the content in local cache area, thus detects that the content in buffer area for sky, is then extracted in the URL access information Domain name, and new demand servicing device 2 is accessed according to corresponding 2 address of server of domain name in URL access information, get corresponding data Resource, the data resource can be on new demand servicing device 2 updated file.
Specifically, the scheme that the above embodiments of the present application one provide, which realizes, removes the data cached of 1 browser of client Demand so that browser is unable to get data from buffer area, and need again linked server 2 to obtain new data text Part.
Above-described embodiment can be applied in following application scenarios: client browser accesses server A, is provided Source foo.css, and by the caching resource in local buffer.At this point, having the server B of same domain name with server A The foo.css for saving updated resource foo.css(server B is that developer newly issues update), at this point, at this moment clear Device of looking at needs fetch updated resource from server B at once, so that user is accessible to arrive new resource, in order to true The more new resources in server B can be got without the use of old caching in real time by protecting browser, can use the embodiment of the present application One technical solution provided is realized.Specifically, client first sends an asynchronous access request to server A, server A It detects in the asynchronous access request and empties field comprising one, believe to return to the response that one backpack body of client is null value Breath, which is substituted the data in client buffer area, as a result, if when client requests resource foo.css again, due to Buffer contents are sky, so, client needs linked server again, to get data money from new server Source, since data resource at this time is updated data, so that client can obtain new number with real time access According to resource.Server A and server B in above-mentioned scene can be the same server, be also possible to two independent services Device terminal.
In addition, the above embodiments of the present application one are applied in mobile terminal web exploitation from the angle of development person Biggish beneficial effect can be generated.Due to removing caching complicated and time consumption than on PC pc on mobile terminals, even Certain systems need the root authority of system or install other auxiliary tools to complete to empty the cache, and use the application real The scheme of the offer of example one is applied it is achieved that being directly realized by the removing of caching on the web page of mobile terminal, improves work Efficiency.
It needs to be described in detail, the browser of the application client needs to create before asynchronous transmission access request And Run Script for sending asynchronous access request is run, for example, can be created in a browser with JavaScript script Build an xmlhttp object, client browser issues access request using xmlhttp object, can very easily and Server exchange data.
The application above scheme can be realized based on xmlhttp object, i.e., call in a browser and run xmlhttp After object, client terminal start-up notice server needs to carry out clear caching.
The xmlhttp object created in the embodiment of the present application can have different creation sides for different browsers Formula, for example, in IE browser, can be used ActiveXObject (" Msxml2.XMLHTTP ") or ActiveXObject (" Microsoft.XMLHTTP ") it creates, and in other modern browsers, new XMLHttpRequest () can be used It is created.
By taking IE browser as an example, the script for creating xmlhttp object is as follows:
Preferably, it in the above embodiments of the present application, needs the xmlhttp object to creation that several fields are set, then will The xmlhttp object for setting field is sent to server as the content of asynchronous access request, requests corresponding data file. The header packet information of the access request of the asynchronous transmission at least may include following field: customized removing field (NohostCleanCache), buffer update time field (If-Modified-Since), buffer control field (Cache- Control it) is stored in the memory of client with caching compiling field (Pragma), these fields, can be memory In buffer area, and the header packet information of access request set by corresponding different browser is different, but the asynchronous access request Backpack body be null value, specifically, the field being arranged for different browser is as shown in table 1 below:
Table 1:
From upper 1 content of table:
When browser is IE browser, need to be arranged 4 fields: setting removes field NohostCleanCache and is YES, buffer update time field If-Modified-Since are 0, and buffer control field Cache-Control is not cache (i.e. For no-cache, no-store), caching compiling field Pragma is not cache (as no-cache).
When browser is Firefox browser, need to be arranged 2 fields: field is removed in setting NohostCleanCache is YES, and buffer update time field If-Modified-Since is 0, does not need setting buffer control Field Cache-Control and caching compiling field Pragma.
When browser is Opera browser, need to be arranged 4 fields: field NohostCleanCache is removed in setting It is 0 for YES, buffer update time field If-Modified-Since, buffer control field Cache-Control is not cache (as no-cache, no-store), caching compiling field Pragma is not cache (as no-cache);
When browser is Chrome browser, need to be arranged 3 fields: field NohostCleanCache is removed in setting It is not cache (as no-cache) for YES, buffer control field Cache-Control, caching compiling field Pragma is not It caches (as no-cache), does not need setting buffer update time field If-Modified-Since.
NohostCleanCache field horizontal line in custom field, table represents the field and is not provided with corresponding number According to.And other than Firefox is to send request using POST mode, other browsers all use GET mode to send request.
It follows that this application can be applied to various browsers, Internet Explorer series including Microsoft, The Firefox of Mozzila, Google Chrome and Opera browser.It needs for above-mentioned each browser to above-mentioned parameter Different values is set, in order to, can be by reading parameters after server receives asynchronous access request Value identifies the targeted browser of current clear operation.Preferably, in order to enable the saving of access request minimum provides Source improves access efficiency, can set null value null for the backpack body of the access request of transmission.
Below just to need in the IE browser of client, removing the address URL is http://qq.com/foo.css institute For corresponding cache file foo.css, it is described in detail.
Client during creating xmlhttp object, the XMLHTTP object be arranged asynchronous access request structure and Content, is arranged the request behavior http://qq.com/foo.css of the asynchronous access request, and several message header words are at least arranged Section, client will be sent to server after each head file assignment, to request http://qq.com/foo.css file.This Scheme provided by application above-described embodiment can add different fields, example for browser different on active client Such as, for IE browser, need at least to be arranged 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, wherein NohostCleanCache field is not field defined in HTTP, belongs to customized word Section.
From the foregoing, it will be observed that since above-mentioned field is all the relevant field cached about asynchronous access request, and from each Field assignment (such as If-Modified-Since be 0;Cache-Control is no-cache, no-store;Pragma is No-cache) it is found that the purpose of the above-mentioned header fields to the setting of xmlhttp object is in order to enable the asynchronous access request Resource is not cached by IE browser, it is clear that, due to the difference between each browser of client, for different browsings The parameter item of device setting is not fully identical, and see Table 1 for details.
However, this is not meant to the application to the field and the form of expression being arranged in above-mentioned asynchronous access request and obtains Mode is taken to make restriction, in above-mentioned asynchronous access request other than needing to carry above-mentioned message header field, the asynchronous access Request can also carry other fields, for example, Accept field, Accept-Charset field, Accept-Encoding word Section, Accept-Language field, Host field, Referer field, User-Agent field, Cookie field, Connection field, Date field etc..
Wherein, Accept: being used for high-speed servers, indicates the data type that client is supported;Accept-Charset: it uses In the coded format that Tell server, client use;Accept-Encoding: being used for Tell server, what client was supported Data compression format;Accept-Language: the language environment of client;Host: client passes through this high-speed service Device thinks the host name of access;Referer: for client by this head Tell server, it is which resource to access service from (door chain) of device;User-Agent: client passes through this head Tell server, the software environment of client computer;Cookie: visitor Family machine can be to server band data by this head;Connection: whether disconnected still after having handled current request Continue to keep connection;Date: current time value.
In general, in the embodiment of the present application, above-mentioned uniform resource position mark URL (Uniform Resource Locator) web page files of target webpage can be positioned, the web page files of the target webpage are stored in corresponding service In device, the domain name in the address URL that the IP address of the server passes through input is inquired.What should be known herein is to target The web access requests of webpage usually may come from the point of the link to the direction target webpage in browser or user interface The identification of choosing, for example, in some embodiments of the present application, to there are URL hyperlink in above-mentioned browser or user interface The capture and identification of mouse click action on passage can form web access requests.Certainly, above-mentioned direction target The URL link of webpage can also be not present on text, but in other browsers such as icon, picture, video pictures or user On element in 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, it can be set and empty in response message Header packet information include at least following any one or more field informations: buffer control field, cache-time field and caching Compile field, wherein buffer control field is set as not caching, and cache-time field is set as -1 or 0, and caching compiling field is set It is set to and does not cache.
Specifically, after receiving asynchronous access request in server, if checking the message header of asynchronous access request In contain NohostCleanCache field, then can return a backpack body be null value to empty response message slow to empty client The data in area are rushed, at this point, this, which empties response message, can also carry field relevant to caching, for example, buffer control field Cache-control, cache-time field Expires and caching compiling field Pragma, due to being set by buffer control field It is set to and does not cache (as no-cache), cache-time field is set as -1 or 0, and caching compiling field is set as not caching (i.e. In the case where no-cache), indicate client will not cache currently return empty response message itself, to alleviate The burden of resource access.At this point, this, which empties response message, can carry above-mentioned any one or more fields, to reach client The purpose of current response message is not cached.
In addition, what server returned empties in response message in another kind feasible program provided by above-described embodiment one Header packet information can also be not provided with following any one or more field informations: buffer control field, cache-time field and Caching compiling field.This method for being not provided with field relevant to caching in the message, it is also available not cache currently clearly The effect of null response information.
Herein it should be noted that above-described embodiment is not meant to the application to the response message that empties of above-mentioned return Content and acquisition modes have made restriction, above-mentioned to empty in response message in addition to needing to carry above-mentioned message relevant to caching Other than head file, which can also carry other fields, for example, 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 cooperates 302 status codes to use, for telling client to need that whom is accessed;Server: Server tells the type of browser server by this head;Content-Encoding: server is told by this head The compressed format of browser data;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: browsing is told The last cache-time of device Current resource;Refresh: tell browser every how long refresh it is primary;Content- Disposition: browser is told to open data with downloading mode;Transfer-Encoding: the biography of browser data is told Send format;ETag: relevant head is cached.
Preferably, different in addition to checking this after server receives asynchronous access request in above-mentioned each embodiment It walks and contains NohostCleanCache field in the message header of access request, can just return and empty response message, further, It can also check whether the value of the field is set as YES, can just return to backpack body if it is YES is empty response message.
Embodiment 2
According to embodiments of the present invention, it additionally provides a kind of for implementing the embodiment of the method for the above system embodiment, needs Illustrate, step shown in the flowchart of the accompanying drawings can be in a computer system such as a set of computer executable instructions It executes, although also, logical order is shown in flow charts, and it in some cases, can be to be different from herein suitable Sequence executes shown or described step.
Fig. 2 be according to embodiments of the present invention two browser in remove cache file method schematic diagram.
As shown in Fig. 2, this method can be applied in client, the implementation process of the application is carried out from the angle of client Detailed description, may include steps of:
Step S10, can by client shown in FIG. 1 come browser asynchronous transmission access request to server.
Step S30, can be received by client shown in FIG. 1 server response access request return empty sound Answer information, wherein in the case where including customized removing field in the header packet information that server detects access request, return It returns and empties response message.
Step S50 can use the backpack body information replacement browsing emptied in response message by client shown in FIG. 1 The data resource being saved in the buffer area of device.Preferably, the data resource being saved in the caching of replacement browser While, browser does not cache the backpack body information emptied in response message.
In the above embodiments of the present application two, by customized one in the packet header for the asynchronous access request that browser is sent Field is removed, after coming so that server receives asynchronous access request, if in detecting packet header of asynchronous access request Field is removed, has determined that the content for needing to return to client browser, that is, can be returned to by corresponding to the asynchronous access request by one Response message is emptied, which can replace the data resource stored in original caching.Pass through this Scheme provided by inventive embodiments compares the prior art and does not need to re-download entire access file, therefore, in client When browser next time issues access request, browser needs to reconnect server to obtain data resource, not only realizes in this way Client browser can according to need again access server to obtain resource, guarantee can by autonomous control caching come The data resource updated on server is obtained in time, allows the more flexible processing of browser data cached, so that The flow of browser processing data greatly reduces, and avoids and wastes time, improves the performance of access efficiency and browser, in turn Solve in the related technology it is existing remove caching method when handle big quantity file, will lead to access efficiency it is low and reduction The technical issues of browser performance.
Be easily noted that, replace browser caching in be saved data resource while, if browser is not Caching empties the backpack body information in response message, can know, since browser does not cache the backpack body letter emptied in response message Breath, therefore, through the embodiment of the present invention provided by scheme, the content in caching will become null value, compares the prior art and be not required to Entire access file is re-downloaded, empty file has been used to replace, therefore, has issued access in the browser next time of client and ask When asking, since the content in buffer area is sky, so that browser needs to reconnect server to obtain data resource, this Sample, which not only realizes client browser, can according to need again access server to obtain resource, and guarantee passes through autonomous control Caching can obtain the data resource updated on server in time, and the more flexible processing of browser is allowed to cache number According to, and since the backpack body of the response message for the area that empties the cache is null value, so that the flow of browser processing data Greatly reduce, avoid and waste time, improves the performance of access efficiency and browser.
Step S10 provided by the above embodiments of the present application to step S50 can be run on the client, it is preferable that can With by adding custom field in asynchronous access request, so that it is null value that server, which returns to a backpack body information, Response message, realizes the removing of the data resource to client local cache, and above scheme does not need to re-download entire number According to the corresponding file of resource, and empty file is used to replace the data in client and cached, so that browser accesses file Shi Wufa reads resource from local cache, to need directly to access server, so that having updated number in server end After resource, client can according to need data that are quick and directly reading update.
From the foregoing, it will be observed that the header packet information for emptying response message that server 2 returns in the above embodiments of the present application not only may be used Think null value, can not also be null value (for example returning to a json data { em:0 }), but empty sound since browser does not cache The backpack body information in information is answered, therefore, no matter backpack body information includes arbitrary content, and the caching of browser can all be emptied, and return The json data { em:0 } returned can be used to that browser is notified to empty the cache.Emptying can when the backpack body information of response message is empty To save bandwidth to greatest extent.
Specifically, server in the access request for receiving the asynchronous transmission, can check whether packet header contains removing word Section NohostCleanCache, it is preferable that be provided with the field checking, and when the value of the field is Yes, server can be with Returning to a backpack body is empty response, to empty the content of buffer area in client browser.At this time if the browsing of client When device issues access request again, such as access http://qq.com/foo.css, foo.css text will not be read from buffer area Part can directly access server to read foo.css file.
Preferably, in the above embodiments of the present application two, when emptying the backpack body information in response message is null value, step The step of S50, the data resource that will be saved in the buffer area of the backpack body information emptied in response message replacement browser, can To include the following steps:
Step S501 extracts the null value for emptying backpack body information in response message.
Step S502, the data resource that will be saved in the buffer area of null value covering browser, so that browser is slow Area is deposited to be emptied.
Above-mentioned steps S501 and step S502 may operate in client.
In one of the above embodiments of the present application two alternative embodiment, the packet header letter emptied in response message can be set Breath includes at least following any one or more field informations: buffer control field, cache-time field and caching compiling field, Wherein, buffer control field is set as not caching, and cache-time field is set as -1 or 0, and caching compiling field is set as not delaying It deposits.
Specifically, step S30 receive server returned in response to access request empty response message before, server The asynchronous access request of browser transmission is received, at this point, if containing in the message header of inspection asynchronous access request NohostCleanCache field can then return to a backpack body as null value and empty response message to empty client browser The data being saved in buffer area, at this point, this, which empties response message, can also carry field relevant to caching, for example, slow Control field Cache-control, cache-time field Expires and caching compiling field Pragma are deposited, due to that will cache Control field is set as not caching (as no-cache), and cache-time field is set as -1 or 0, and caching compiling field is set as In the case where not caching (as no-cache), indicate client will not cache currently return empty response message itself, To alleviate the burden of resource access.At this point, this, which empties response message, can carry above-mentioned any one or more fields, come Achieve the purpose that client does not cache current response message.
In another alternative embodiment in the above embodiments of the present application two, the packet header that can will empty in response message Following any one or more field informations: buffer control field, cache-time field and caching compiling word are not provided in information Section.This method for being not provided with field relevant to caching in the message, also available do not cache currently empties response message Effect.
Herein it should be noted that above-described embodiment is not meant to the application to the response message that empties of above-mentioned return Content and acquisition modes have made restriction, above-mentioned to empty in response message in addition to needing to carry above-mentioned message relevant to caching Other than head file, which can also carry other fields, for example, 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 cooperates 302 status codes to use, for telling client to need that whom is accessed;Server: Server tells the type of browser server by this head;Content-Encoding: server is told by this head The compressed format of browser data;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: browsing is told The last cache-time of device Current resource;Refresh: tell browser every how long refresh it is primary;Content- Disposition: browser is told to open data with downloading mode;Transfer-Encoding: the biography of browser data is told Send format;ETag: relevant head is cached.
Preferably, different in addition to checking this after server receives asynchronous access request in above-mentioned each embodiment It walks and contains NohostCleanCache field in the message header of access request, can just return and empty response message, further, It can also check whether the value of the field is set as YES, can just return to backpack body if it is YES is empty response message.
It should be further noted that also needing to set in the access request of asynchronous transmission in the above embodiments of the present application two Set a URL access information, it is preferable that after the data resource being saved in the buffer area of step S50 replacement browser Or after the buffer area of step S502 browser is emptied, it can also include the following steps:
Step S503, browser send new access request, wherein new access request includes URL access information.
Specifically, after the buffer area in client browser for data cached resource is emptied, client can be with Browser is executed by a sending device and sends new access request, wherein new access request also includes above-mentioned URL access letter Breath.
Step S504 is then inquired when detecting that the content in buffer area is empty and is obtained the domain name in URL access information.
Specifically, place during client obtains new data resource by the URL access information, in client Reason device is first begin to the content in detection local cache area, thus detects that the content in buffer area for sky, then extracts URL visit Ask the domain name in information,
Step S505, according to the corresponding server address of domain Name acquisition in URL access information.
Specifically, traditional mode can be used in the step, to obtain the domain name from name server according to domain name corresponding IP address, certainly, the embodiment of the present application are not limited to aforesaid way.
Step S506, browser access new demand servicing device by server address, get corresponding data resource.
Specifically, after client browser knows the current new access request server ip address to be accessed, it can To access new demand servicing device according to the corresponding server address of domain name in the URL access information, corresponding data resource is got, The data resource can be on new demand servicing device updated file.
From the foregoing, it will be observed that the scheme that the above-mentioned each embodiment of the application provides realizes the caching number for removing client browser According to demand so that browser is unable to get data from buffer area, and need again linked server to obtain new data text Part.
Above-described embodiment can be applied in following application scenarios: run above-mentioned steps S10-S50, visitor on the client Family end browser accesses server A, has obtained resource foo.css, and by the caching resource in local buffer.At this point, The foo.css for saving updated resource foo.css(server B with the server B of same domain name with server A is out Hair personnel newly issue update), at this point, at this moment browser needs fetch updated resource from server B at once, to make It is accessible to new resource to obtain user, in order to ensure browser can get the more new resources in server B without making in real time With old caching, the technical solution of the offer of the embodiment of the present application two can use to realize.Specifically, client browser is first sent out Send an asynchronous access request to server A, server A, which detects in the asynchronous access request, empties field comprising one, To return to the response message that one backpack body of client is null value, which is substituted the data in client buffer area, by This, if client requests resource foo.css again, since buffer contents are sky, so, client needs to link again Server, to get data resource from new server, since data resource at this time is updated data, So that client can obtain new data resource with real time access.Server A and server B in above-mentioned scene can be The same server is also possible to two independent server terminals.
In addition, the above embodiments of the present application one are applied in mobile terminal web exploitation from the angle of development person Biggish beneficial effect can be generated.Due to removing caching complicated and time consumption than on PC pc on mobile terminals, even Certain systems need the root authority of system or install other auxiliary tools to complete to empty the cache, and use the application real The scheme of the offer of example one is applied it is achieved that being directly realized by the removing of caching on the web page of mobile terminal, improves work Efficiency.
Need to be described in detail, the browser of the application client before step S10, asynchronous transmission access request, Need to create and run the Run Script for sending asynchronous access request, for example, JavaScript can be used in a browser Script creates an xmlhttp object, and client browser issues access request using xmlhttp object, can be very Convenient and server exchange data.
The application above scheme can be realized based on xmlhttp object, i.e., call in a browser and run xmlhttp After object, client terminal start-up notice server needs to carry out clear caching.
The xmlhttp object created in the embodiment of the present application can have different creation sides for different browsers Formula, for example, in IE browser, can be used ActiveXObject (" Msxml2.XMLHTTP ") or ActiveXObject (" Microsoft.XMLHTTP ") it creates, and in other modern browsers, new XMLHttpRequest () can be used It is created.
Preferably, it in the above embodiments of the present application, needs the xmlhttp object to creation that several fields are set, then will The xmlhttp object for setting field is sent to server as the content of asynchronous access request, requests corresponding data file. The header packet information of the access request of the asynchronous transmission at least may include following field: customized removing field (NohostCleanCache), buffer update time field (If-Modified-Since), buffer control field (Cache- Control it) is stored in the memory of client with caching compiling field (Pragma), these fields, can be memory In buffer area, and the header packet information of access request set by corresponding different browser is different, but the asynchronous access request Backpack body be null value, specifically, the field being arranged for different browser is as shown in table 1 below:
Table 1:
From upper 1 content of table:
When browser is IE browser, need to be arranged 4 fields: setting removes field NohostCleanCache and is YES, buffer update time field If-Modified-Since are 0, and buffer control field Cache-Control is not cache (i.e. For no-cache, no-store), caching compiling field Pragma is not cache (as no-cache).
When browser is Firefox browser, need to be arranged 2 fields: field is removed in setting NohostCleanCache is YES, and buffer update time field If-Modified-Since is 0, does not need setting buffer control Field Cache-Control and caching compiling field Pragma.
When browser is Opera browser, need to be arranged 4 fields: field NohostCleanCache is removed in setting It is 0 for YES, buffer update time field If-Modified-Since, buffer control field Cache-Control is not cache (as no-cache, no-store), caching compiling field Pragma is not cache (as no-cache);
When browser is Chrome browser, need to be arranged 3 fields: field NohostCleanCache is removed in setting It is not cache (as no-cache) for YES, buffer control field Cache-Control, caching compiling field Pragma is not It caches (as no-cache), does not need setting buffer update time field If-Modified-Since.
NohostCleanCache field horizontal line in custom field, table represents the field and is not provided with corresponding number According to.And other than Firefox is to send request using POST mode, other browsers all use GET mode to send request.
It follows that this application can be applied to various browsers, Internet Explorer series including Microsoft, The Firefox of Mozzila, Google Chrome and Opera browser.It needs for above-mentioned each browser to above-mentioned parameter Different values is set, in order to, can be by reading parameters after server receives asynchronous access request Value identifies the targeted browser of current clear operation.Preferably, in order to enable the saving of access request minimum provides Source improves access efficiency, can set null value null for the backpack body of the access request of transmission.
However, this is not meant to the application to the field and the form of expression being arranged in above-mentioned asynchronous access request and obtains Mode is taken to make restriction, in above-mentioned asynchronous access request other than needing to carry above-mentioned message header field, the asynchronous access Request can also carry other fields, for example, Accept field, Accept-Charset field, Accept-Encoding word Section, Accept-Language field, Host field, Referer field, User-Agent field, Cookie field, Connection field, Date field etc..
Wherein, high-speed servers, the data type that client computer is supported Accept: are used for;Accept-Charset: for accusing Tell server, the coded format that client computer uses;Accept-Encoding: Tell server, the data that client computer is supported are used for Compressed format;Accept-Language: the language environment of client computer;Host: client computer is thought by this high-speed servers The host name of access;Referer: for client computer by this head Tell server, it is which resource to access server from (door chain);User-Agent: client computer passes through this head Tell server, the software environment of client computer;Cookie: client computer It can be to server band data by this head;Connection: it has handled whether to disconnect after current request and has also been to continue with Keep connection;Date: current time value.
Below just to need in the IE browser of client, removing the address URL is http://qq.com/foo.css institute For corresponding cache file foo.css, it is described in detail.
Client during creating xmlhttp object, the XMLHTTP object be arranged asynchronous access request structure and Content, is arranged the request behavior http://qq.com/foo.css of the asynchronous access request, and several message header words are at least arranged Section, client will be sent to server after each head file assignment, to request http://qq.com/foo.css file.This Scheme provided by application above-described embodiment can add different fields, example for browser different on active client Such as, for IE browser, need at least to be arranged 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, wherein NohostCleanCache field is not field defined in HTTP, belongs to customized word Section.
From the foregoing, it will be observed that since above-mentioned field is all the relevant field cached about asynchronous access request, and from each Field assignment (such as If-Modified-Since be 0;Cache-Control is no-cache, no-store;Pragma is No-cache) it is found that the purpose of the above-mentioned header fields to the setting of xmlhttp object is in order to enable the asynchronous access request Resource is not cached by IE browser, it is clear that, due to the difference between each browser of client, for different browsings The parameter item of device setting is not fully identical, and see Table 1 for details.
In general, in the embodiment of the present application, above-mentioned uniform resource position mark URL (Uniform Resource Locator) web page files of target webpage can be positioned, the web page files of the target webpage are stored in corresponding service In device, the domain name in the address URL that the IP address of the server passes through input is inquired.What should be known herein is to target The web access requests of webpage usually may come from the point of the link to the direction target webpage in browser or user interface The identification of choosing, for example, in some embodiments of the present application, to there are URL hyperlink in above-mentioned browser or user interface The capture and identification of mouse click action on passage can form web access requests.Certainly, above-mentioned direction target The URL link of webpage can also be not present on text, but in other browsers such as icon, picture, video pictures or user On element in interface, the application is not construed as limiting this.
It should be noted that for the various method embodiments described above, for simple description, therefore, it is stated as a series of Combination of actions, but those skilled in the art should understand that, the present invention is not limited by the sequence of acts described because According to the present invention, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art should also know It knows, the embodiments described in the specification are all preferred embodiments, and related actions and modules is not necessarily of the invention It is necessary.
Through the above description of the embodiments, those skilled in the art can be understood that according to above-mentioned implementation The method of example can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but it is very much In the case of the former be more preferably embodiment.Based on this understanding, technical solution of the present invention is substantially in other words to existing The part that technology contributes can be embodied in the form of software products, which is stored in a storage In medium (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that a terminal device (can be mobile phone, calculate Machine, server or network equipment etc.) execute method described in each embodiment of the present invention.
Embodiment 3
According to embodiments of the present invention, it additionally provides a kind of for implementing the embodiment of the method for the above system embodiment, needs Illustrate, step shown in the flowchart of the accompanying drawings can be in a computer system such as a set of computer executable instructions It executes, although also, logical order is shown in flow charts, and it in some cases, can be to be different from herein suitable Sequence executes shown or described step.
Fig. 3 be according to embodiments of the present invention three browser in remove cache file method schematic diagram.
As shown in figure 3, this method can be applied in server end, from the angle of server end to the implementation process of the application It is described in detail, may include steps of:
Step S20, the access that the browser asynchronous transmission of client can be received by server end shown in FIG. 1 are asked It asks.
Step S40, whether comprising making by oneself in the header packet information that can be requested by server shown in FIG. 1 come test access The removing field of justice.
Step S60, can be by server shown in FIG. 1 come in the case where detecting removing field, return empties sound Answer information, wherein empty the data resource being saved in caching of the response message for replacing browser.Preferably, it is replacing While changing the data resource being saved in the caching of browser, browser can not cache the backpack body emptied in response message Information.
In the above embodiments of the present application three, server end is detected by the packet header to the asynchronous access request received Come determine the need for returning packet header be it is empty empty response message, if the removing in detecting packet header of asynchronous access request Field has determined that the content for needing to return to client browser, that is, corresponds to the asynchronous access request and can return to one and empty Response message, the backpack body information for emptying response message can replace the data resource stored in original caching.Through the invention Scheme provided by embodiment compares the prior art and does not need to re-download entire access file, therefore, in the browsing of client When device next time issues access request, browser needs to reconnect server to obtain data resource, not only realizes visitor in this way Family end browser can according to need again access server to obtain resource, and guarantee can be by autonomous control caching come in time The data resource updated on server is obtained, allows the more flexible processing of browser data cached, so that browsing The flow of device processing data greatly reduces, and avoids and wastes time, and improves the performance of access efficiency and browser, and then solve The existing method for removing caching is when handle big quantity file in the related technology, and it is low and reduce and browse to will lead to access efficiency The technical issues of device performance.
Above-mentioned removing field is the customized field of client, is easily noted that, in the caching of replacement browser While the data resource of preservation, if browser does not cache the backpack body information emptied in response message, it can know, due to clear Device of looking at does not cache the backpack body information emptied in response message, therefore, through the embodiment of the present invention provided by scheme, server root According to field is removed and emptying response message the content in caching being become to null value for returning, compares the prior art and do not need again The entire access file of downloading, has used empty file to replace, therefore, because server makes the content in buffer area for sky, from And make browser need to reconnect server to obtain data resource, not only realizing browser in this way can according to need Again server is accessed to obtain resource, guarantees that the data updated on server can be obtained in time by autonomous control caching Resource allows the more flexible processing of browser data cached, and due to the response message for the area that empties the cache Backpack body is null value, so that the flow of browser processing data greatly reduces, avoids and wastes time, improve access efficiency With the performance of browser.
Step S20 provided by the above embodiments of the present application to step S60 can be run on the server, it is preferable that clothes Business device can return to the response message that a backpack body information is null value by being added to the asynchronous access request of custom field, The removing of the data resource to browser local cache is realized, above scheme does not need to re-download entire data resource correspondence File, and used empty file replace client in and caching data so that browser access file when can not from this Ground caching reads resource, thus need directly to access server, so that after server end has updated data resource, Client can according to need data that are quick and directly reading update.
From the foregoing, it will be observed that the header packet information for emptying response message that server 2 returns in the above embodiments of the present application not only may be used Think null value, can not also be null value (for example returning to a json data { em:0 }), but empty sound since browser does not cache The backpack body information in information is answered, therefore, no matter backpack body information includes arbitrary content, and the caching of browser can all be emptied, and return The json data { em:0 } returned can be used to that browser is notified to empty the cache.Emptying can when the backpack body information of response message is empty To save bandwidth to greatest extent.
Specifically, server in the access request for receiving the asynchronous transmission, can check whether packet header contains removing word Section NohostCleanCache, it is preferable that be provided with the field checking, and when the value of the field is Yes, server can be with Returning to a backpack body is empty response, to empty the content of buffer area in client browser.At this time if the browsing of client When device issues access request again, such as access http://qq.com/foo.css, foo.css text will not be read from buffer area Part can directly access server to read foo.css file.
Preferably, the step when emptying the backpack body information in response message is null value, in the above embodiments of the present application two S60 can after the data resource that will be saved in the buffer area of the backpack body information emptied in response message replacement browser To include the following steps:
Step S601, what reception server was returned in response to access request empties response message.
Step S602 extracts the null value for emptying backpack body information in response message.
Step S603, the data resource that will be saved in the buffer area of null value covering browser, so that browser is slow Area is deposited to be emptied.
Above-described embodiment step S601 to step S603 may be implemented in the client, for receiving the clear of server return Null response information.
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 It is set to and includes at least following any one or more field informations: buffer control field, cache-time field and caching compiling word Section, wherein buffer control field is set as not caching, and cache-time field is set as -1 or 0, and caching compiling field is set as not Caching.
In another optional scheme, empty be not provided in the header packet information in response message it is following any one or Multiple field informations: buffer control field, cache-time field and caching compiling field.
From the foregoing, it will be observed that the content for emptying response message being related in the present embodiment three, acquisition modes and this empty sound The application example and various preferable examples of information are answered, it is identical as example provided by above-described embodiment two, but it should be clear that, The present embodiment three be not limited to the above embodiment two provided by scheme.
Likewise, be not meant in above-described embodiment three the application to the content for emptying response message of above-mentioned return with And acquisition modes have made restriction, it is above-mentioned to empty in response message in addition to needing to carry above-mentioned message header field relevant to caching In addition, which can also carry other fields, for example, location field, Server field, Content- Encoding field, Content-Length field, Content-Type field, Last-Modified field, Refresh word Section, Content-Disposition field, Transfer-Encoding field etc..
It should be further noted that the access request of asynchronous transmission may include one in the above embodiments of the present application three A URL access information, wherein be saved in the buffer area that the backpack body information emptied in response message is replaced browser After the buffer area of browser is emptied after data resource or in step S603, it can also include the following steps:
Step S604, browser send new access request, wherein new access request includes URL access information.
Step S605 is then inquired when detecting that the content in buffer area is empty and is obtained the domain name in URL access information.
Step S606, according to the corresponding server address of domain Name acquisition in URL access information.
Step S607, browser access new demand servicing device by server address, get corresponding data resource.
In the scheme that step S604 is realized to step S607 included by the above embodiments of the present application three, with embodiment two Scheme provided by step S503 to step S506 is identical, and the scene of application can also be identical.It is noted, of course, that this The above scheme of embodiment three can be not limited to the above embodiments two content and scene.
It needs to be described in detail, the browser of the application client receives server response access and ask in step S601 It asks before what is returned empty response message, the header packet information of access request can be first arranged in client, and the header packet information is at least Include: customized removing field, buffer update time field, buffer control field and caching compiling field, is browsed receiving Before the access request of device asynchronous transmission, method further include: corresponding different browser is arranged the header packet information of access request, And the backpack body that access request is arranged is sky, wherein
When browser is IE browser, it is YES that field is removed in setting, and setting buffer update time field is 0, and setting is slow Depositing control field is not cache, and it is not cache that caching compiling field, which is arranged,;
When browser is Firefox browser, it is YES that field is removed in setting, and setting buffer update time field is 0, It is not provided with buffer control field and caching compiling field;
When browser is Opera browser, it is YES that field is removed in setting, and setting buffer update time field is 0, if Setting buffer control field is not cache, and it is not cache that caching compiling field, which is arranged,;
When browser is Chrome browser, it is YES that field is removed in setting, and setting buffer control field is not cache, And it is not cache that caching compiling field, which is arranged, is not provided with buffer update time field.
Need to be described in detail, the header packet information of above-mentioned asynchronous access information by one xmlhttp object of creation come It realizes, specifically, needing to create and run the Run Script for sending asynchronous access request, for example, can be in a browser An xmlhttp object is created with JavaScript script, client browser is asked using xmlhttp object to issue access It asks, it can very easily and server exchange data.
The application above scheme can be realized based on xmlhttp object, i.e., call in a browser and run xmlhttp After object, client terminal start-up notice server needs to carry out clear caching.
The xmlhttp object created in the embodiment of the present application can have different creation sides for different browsers Formula, for example, in IE browser, can be used ActiveXObject (" Msxml2.XMLHTTP ") or ActiveXObject (" Microsoft.XMLHTTP ") it creates, and in other modern browsers, new XMLHttpRequest () can be used It is created.
It should be noted that the xmlhttp object created in above-described embodiment three and being created in the embodiment two The contents such as content, acquisition modes, example and the application scenarios of xmlhttp object it is identical, but not limited to the examples two institutes are public The content opened.
Likewise, the field and the form of expression that are arranged in asynchronous access request provided in embodiment three and acquisition side Formula has made restriction, in above-mentioned asynchronous access request other than needing to carry above-mentioned message header field, the asynchronous access request Other fields can also be carried, for example, 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, high-speed servers, the data type that client computer is supported Accept: are used for;Accept-Charset: for accusing Tell server, the coded format that client computer uses;Accept-Encoding: Tell server, the data that client computer is supported are used for Compressed format;Accept-Language: the language environment of client computer;Host: client computer is thought by this high-speed servers The host name of access;Referer: for client computer by this head Tell server, it is which resource to access server from (door chain);User-Agent: client computer passes through this head Tell server, the software environment of client computer;Cookie: client computer It can be to server band data by this head;Connection: it has handled whether to disconnect after current request and has also been to continue with Keep connection;Date: current time value.
It should be noted that for the various method embodiments described above, for simple description, therefore, it is stated as a series of Combination of actions, but those skilled in the art should understand that, the present invention is not limited by the sequence of acts described because According to the present invention, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art should also know It knows, the embodiments described in the specification are all preferred embodiments, and related actions and modules is not necessarily of the invention It is necessary.
Through the above description of the embodiments, those skilled in the art can be understood that according to above-mentioned implementation The method of example can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but it is very much In the case of the former be more preferably embodiment.Based on this understanding, technical solution of the present invention is substantially in other words to existing The part that technology contributes can be embodied in the form of software products, which is stored in a storage In medium (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that a terminal device (can be mobile phone, calculate Machine, server or network equipment etc.) method that executes each embodiment of the present invention.
Embodiment 4
Fig. 4 be according to embodiments of the present invention four browser in remove cache file apparatus structure schematic diagram.
According to embodiments of the present invention, a kind of device for corresponding to implementation above method embodiment two is additionally provided, such as Shown in Fig. 4, which can run implementation of the angle of above-mentioned apparatus to the application from client below using on the client Process is described in detail.
The apparatus may include: sending module 10, receiving module 30 and removing module 50.
Wherein, sending module 10, for browser asynchronous transmission access request to server.
Receiving module 30 empties response message for receive that server returns in response to access request, wherein servicing Device detects in the header packet information of access request comprising in the case where customized removing field, return empties response message.
Module 50 is removed, for will be saved in the buffer area of the backpack body information emptied in response message replacement browser Data resource.Preferably, while the data resource being saved in the caching for replacing browser, browser is not cached clearly Backpack body information in null response information.
In the above embodiments of the present application four, through sending module 10 in the packet header for the asynchronous access request that browser is sent Customized removing field, after coming so that server receives asynchronous access request by receiving module 30, if detection Removing field in the packet header of asynchronous access request has determined that the content for needing to return to client browser, i.e., corresponding The asynchronous access request can return to one and empty response message, remove module 50 and replace the backpack body information for emptying response message Fall the data resource stored in original caching provided scheme through the embodiment of the present invention, compares the prior art and do not need again The entire access file of downloading, therefore, when issuing access request the browser next time of client, browser needs to reconnect clothes Device be engaged in obtain data resource, not only realizing client browser in this way can according to need again access server to obtain Resource, guarantee can obtain the data resource updated on server in time by autonomous control caching, so that browser can be with More flexible processing is data cached, so that the flow of browser processing data greatly reduces, avoids and wastes time, mention The high performance of access efficiency and browser, so solve in the related technology the existing method for removing caching in the big number of processing Measure file when, will lead to access efficiency it is low and reduce browser performance the technical issues of.
Be easily noted that, replace browser caching in be saved data resource while, if browser is not Caching empties the backpack body information in response message, can know, since browser does not cache the backpack body letter emptied in response message Breath, therefore, through the embodiment of the present invention provided by scheme, the content in caching will become null value, compares the prior art and be not required to Entire access file is re-downloaded, empty file has been used to replace, therefore, has issued access in the browser next time of client and ask When asking, since the content in buffer area is sky, so that browser needs to reconnect server to obtain data resource, this Sample, which not only realizes client browser, can according to need again access server to obtain resource, and guarantee can be by autonomous Control caching obtains the data resource updated on server in time, and due to the packet of the response message for the area that empties the cache Body is null value, allows the more flexible processing of browser data cached, so that the flow of browser processing data is big It is big to reduce, it avoids and wastes time, improve the performance of access efficiency and browser.
Device provided by the above embodiments of the present application can be run on the client, it is preferable that can be by asynchronous Access request in add custom field it is real so that server returns to the response message that backpack body information is null value The removing of the data resource to client local cache is showed, above scheme does not need to re-download entire data resource corresponding File, and empty file has been used to replace the data in client and cached, so that browser can not be from local when accessing file Caching reads resource, thus need directly to access server, so that after server end has updated data resource, visitor Family end can according to need data that are quick and directly reading update.
From the foregoing, it will be observed that the header packet information for emptying response message that server 2 returns in the above embodiments of the present application not only may be used Think null value, can not also be null value (for example returning to a json data { em:0 }), but empty sound since browser does not cache The backpack body information in information is answered, therefore, no matter backpack body information includes arbitrary content, and the caching of browser can all be emptied, and return The json data { em:0 } returned can be used to that browser is notified to empty the cache.Emptying can when the backpack body information of response message is empty To save bandwidth to greatest extent.
Specifically, server when receiving the access request of the device asynchronous transmission, can check whether packet header is contained clearly Except field NohostCleanCache, it is preferable that be provided with the field checking, and the value of the field be Yes when, server It is empty response that a backpack body, which can be returned, to empty the content of buffer area in client browser.At this time if client When browser issues access request again, such as access http://qq.com/foo.css, it will not be read from buffer area Foo.css file can directly access server to read foo.css file.
Preferably, the removing module 50 when emptying the backpack body information in response message is null value, in above-described embodiment four It may include: extraction module 501, for extracting the null value for emptying backpack body information in response message;Overlay module 502, being used for will The data resource being saved in the buffer area of null value covering browser, so that the buffer area of browser is emptied.
Specifically, said extracted module 501 and overlay module 502 correspond to step S501 and step in embodiment two S502, above-mentioned module may operate in client as a part of device.Can be by software realization, it can also be by hard Part is realized.
Preferably, in one of above-described embodiment four alternative embodiment, header packet information in response message is emptied at least Including following any one or more field informations: buffer control field, cache-time field and caching compiling field, wherein Buffer control field is set as not caching, and cache-time field is set as -1 or 0, and caching compiling field is set as not caching.
Preferably, another optional example in above-described embodiment four, empties in the header packet information in response message not Following any one or more field informations: buffer control field, cache-time field and caching compiling field are set.
The set content for emptying response message that is related in the present embodiment four, acquisition modes and this empty response letter The application example and various preferable examples of breath, it is identical as example provided by above-described embodiment two, but it should be clear that, this reality Apply example four be not limited to the above embodiment two provided by scheme.
Preferably, different in addition to checking this after server receives asynchronous access request in above-mentioned each embodiment It walks and contains NohostCleanCache field in the message header of access request, can just return and empty response message, further, It can also check whether the value of the field is set as YES, can just return to backpack body if it is YES is empty response message.
It should be further noted that the device in above-described embodiment four can also include: above-mentioned sending module, it is also used to Browser sends new access request, wherein new access request includes URL access information;Detection module, for detecting buffer area In content be sky, then inquire and obtain the domain name in URL access information;Module is obtained, for according in URL access information The corresponding server address of domain Name acquisition;Access modules access new demand servicing device by server address for browser, get Corresponding data resource.
Above-mentioned request sending module, detection module, acquisition module and access modules respectively correspond in above-described embodiment two The method that step S503 is realized to step 506, the example and application scenarios that aforementioned four module and corresponding step are realized It is identical, but it is not limited to the above embodiments two disclosure of that.Above-mentioned sending module, detection module obtain module and access mould Block operates in terminal, can pass through software or hardware realization.
It needs to be described in detail, the browser of the application client, which executes asynchronous transmission access in request sending module, asks Before asking, need to create and run the Run Script for sending asynchronous access request, for example, can use in a browser JavaScript script creates an xmlhttp object, and client browser asked using xmlhttp object to issue access It asks, it can very easily and server exchange data.
The application above scheme can be realized based on xmlhttp object, i.e., call in a browser and run xmlhttp After object, client terminal start-up notice server needs to carry out clear caching.
The xmlhttp object created in the embodiment of the present application can have different creation sides for different browsers Formula, for example, in IE browser, can be used ActiveXObject (" Msxml2.XMLHTTP ") or ActiveXObject (" Microsoft.XMLHTTP ") it creates, and in other modern browsers, new XMLHttpRequest () can be used It is created.
Preferably, it in the above embodiments of the present application, needs the xmlhttp object to creation that several fields are set, then will The xmlhttp object for setting field is sent to server as the content of asynchronous access request, requests corresponding data file. Before the access request for receiving browser asynchronous transmission, above-mentioned apparatus can also include: memory module, correspond to not for saving The header packet information of access request set by same browser, and the backpack body that access request is arranged is sky.Specifically, the asynchronous hair The header packet information for the access request sent at least may include following field: customized removing field (NohostCleanCache), buffer update time field (If-Modified-Since), buffer control field (Cache- Control it) is stored in the memory of client with caching compiling field (Pragma), these fields, can be memory In buffer area, and the header packet information of access request set by corresponding different browser is different, but the asynchronous access request Backpack body be null value, specific set content is as follows:
When browser is IE browser, need to be arranged 4 fields: setting removes field NohostCleanCache and is YES, buffer update time field If-Modified-Since are 0, and buffer control field Cache-Control is not cache (i.e. For no-cache, no-store), caching compiling field Pragma is not cache (as no-cache).
When browser is Firefox browser, need to be arranged 2 fields: field is removed in setting NohostCleanCache is YES, and buffer update time field If-Modified-Since is 0, does not need setting buffer control Field Cache-Control and caching compiling field Pragma.
When browser is Opera browser, need to be arranged 4 fields: field NohostCleanCache is removed in setting It is 0 for YES, buffer update time field If-Modified-Since, buffer control field Cache-Control is not cache (as no-cache, no-store), caching compiling field Pragma is not cache (as no-cache);
When browser is Chrome browser, need to be arranged 3 fields: field NohostCleanCache is removed in setting It is not cache (as no-cache) for YES, buffer control field Cache-Control, caching compiling field Pragma is not It caches (as no-cache), does not need setting buffer update time field If-Modified-Since.
NohostCleanCache field horizontal line in custom field, table represents the field and is not provided with corresponding number According to.And other than Firefox is to send request using POST mode, other browsers all use GET mode to send request.
It should be noted that the xmlhttp object created in above-described embodiment four and being created in the embodiment two The contents such as content, acquisition modes, example and the application scenarios of xmlhttp object it is identical, but not limited to the examples two institutes are public The content opened.
Embodiment 5
Fig. 5 be according to embodiments of the present invention five browser in remove cache file apparatus structure schematic diagram.
According to embodiments of the present invention, a kind of device for corresponding to implementation above method embodiment three is additionally provided, such as Shown in Fig. 5, which can be applied on server end, below from the angle of client operation above-mentioned apparatus to the reality of the application The process of applying is described in detail.
The apparatus may include: receiving module 20, detection module 40 and return module 60.
Wherein, receiving module 20, the access request of the browser asynchronous transmission for receiving client;Detection module 40, For whether including customized removing field in the header packet information of test access request;Return module 60, for detecting In the case where removing field, return empties response message, wherein empties in caching of the response message for replacing browser The data resource of preservation.Preferably, while the data resource being saved in the caching for replacing browser, browser does not delay Deposit the backpack body information emptied in response message.
In the above embodiments of the present application five, after receiving module 20 receives asynchronous access request, detection can be passed through Module 40 detects the packet header of the asynchronous access request received, empties sound to determine the need for returning packet header as empty Information is answered, if the removing field in detecting packet header of asynchronous access request, has determined that and needed to return to Client browse The content of device, that is, correspond to the asynchronous access request and can return to client one by return module 60 and empty response message, The backpack body information for emptying response message can replace the data resource stored in original caching.It is mentioned through the embodiment of the present invention The scheme of confession compares the prior art and does not need to re-download entire access file, therefore, issues in the browser next time of client When access request, browser needs to reconnect server to obtain data resource, not only realizes client browser in this way Access server be can according to need again to obtain resource, guarantee can obtain server by autonomous control caching in time The data resource of upper update allows the more flexible processing of browser data cached, so that browser handles data Flow greatly reduce, avoid and waste time, improve the performance of access efficiency and browser, and then solve the relevant technologies In it is existing remove caching method when handle big quantity file, will lead to access efficiency it is low and reduction browser performance skill Art problem.
Above-mentioned removing field is the customized field of client, is easily noted that, in the caching of replacement browser While the data resource of preservation, if browser does not cache the backpack body information emptied in response message, it can know, due to clear Device of looking at does not cache the backpack body information emptied in response message, and therefore, provided scheme, operates in clothes through the embodiment of the present invention The above-mentioned modules being engaged on device, can be according to removing field and emptying response message and becoming the content in caching for returning Null value compares the prior art and does not need to re-download entire access file, empty file used to replace, therefore, because service Device makes the content in buffer area for sky, so that browser needs to reconnect server to obtain data resource, in this way Not only realizing browser can according to need again access server to obtain resource, and guarantee can be cached by autonomous control To obtain the data resource updated on server in time, and since the backpack body of the response message for the area that empties the cache is sky Value allows the more flexible processing of browser data cached, so that the flow of browser processing data greatly reduces, It avoids and wastes time, improve the performance of access efficiency and browser.
Step S20 provided by the above embodiments of the present application five to step S60 can be run on the server, it is preferable that A backpack body information can be returned by being added to the asynchronous access request of custom field using server to believe as the response of null value Breath, realizes the removing of the data resource to browser local cache, above scheme does not need to re-download entire data resource Corresponding file, and empty file has been used to replace the data in client and cached, so that browser can not when accessing file Resource is read from local cache, to need directly to access server, so that having updated data resource in server end Later, client can according to need data that are quick and directly reading update.
From the foregoing, it will be observed that the header packet information for emptying response message that server 2 returns in the above embodiments of the present application not only may be used Think null value, can not also be null value (for example returning to a json data { em:0 }), but empty sound since browser does not cache The backpack body information in information is answered, therefore, no matter backpack body information includes arbitrary content, and the caching of browser can all be emptied, and return The json data { em:0 } returned can be used to that browser is notified to empty the cache.Emptying can when the backpack body information of response message is empty To save bandwidth to greatest extent.
Specifically, server in the access request for receiving the asynchronous transmission, can check whether packet header contains removing word Section NohostCleanCache, it is preferable that be provided with the field checking, and when the value of the field is Yes, server can be with Returning to a backpack body is empty response, to empty the content of buffer area in client browser.At this time if the browsing of client When device issues access request again, such as access http://qq.com/foo.css, foo.css text will not be read from buffer area Part can directly access server to read foo.css file.
Preferably, it in the above embodiments of the present application four, when emptying the backpack body information in response message is null value, is servicing After return module 60 on device realizes that return empties response message to client, above-mentioned apparatus can also include following module: Response message module is received, empties response message for receive that server returns in response to access request;Extract response message Module, for extracting the null value for emptying backpack body information in response message;Cache module is covered, for null value to be covered browser The data resource being saved in buffer area, so that the buffer area of browser is emptied.
Implement specifically, above-mentioned reception response message module, extraction response message module and covering cache module correspond to Step S601 and step S603, above-mentioned module in example three may operate in corresponding to the server as a part of device In client.It can also pass through hardware realization by software realization.
In the above embodiments of the present application five, in a kind of optional scheme, the header packet information that can will empty in response message It is set as including at least following any one or more field informations: buffer control field, cache-time field and caching compiling Field, wherein buffer control field is set as not caching, and cache-time field is set as -1 or 0, and caching compiling field is set as It does not cache.
In another optional scheme, empty be not provided in the header packet information in response message it is following any one or Multiple field informations: buffer control field, cache-time field and caching compiling field.
From the foregoing, it will be observed that the set content for emptying response message being related in the present embodiment five, acquisition modes and this is clear The application example and various preferable examples of null response information, it is identical as example provided by above-described embodiment three, but need clear , the present embodiment five be not limited to the above embodiment three provided by scheme.
Likewise, be not meant in above-described embodiment five the application to the content for emptying response message of above-mentioned return with And acquisition modes have made restriction, it is above-mentioned to empty in response message in addition to needing to carry above-mentioned message header field relevant to caching In addition, which can also carry other fields, for example, location field, Server field, Content- Encoding field, Content-Length field, Content-Type field, Last-Modified field, Refresh word Section, Content-Disposition field, Transfer-Encoding field etc..
Preferably, different in addition to checking this after server receives asynchronous access request in above-mentioned each embodiment It walks and contains NohostCleanCache field in the message header of access request, can just return and empty response message, further, It can also check whether the value of the field is set as YES, can just return to backpack body if it is YES is empty response message.
It should be further noted that the access request of the asynchronous transmission in the above embodiments of the present application five may include One URL access information, wherein after the buffer area for executing browser is emptied, the device in above-described embodiment five may be used also To include:
Request sending module sends new access request for browser, wherein new access request includes URL access information; Detection module detects that the content in buffer area for sky, then inquires and obtains the domain name in URL access information;Obtain module, root According to the corresponding server address of domain Name acquisition in URL access information;Access modules, browser are accessed new by server address Server gets corresponding data resource.
Above-mentioned request sending module, detection module, acquisition module and access modules respectively correspond in above-described embodiment three The method that step S604 is realized to step 607, the example and application scenarios that aforementioned four module and corresponding step are realized It is identical, but it is not limited to the above embodiments three disclosure of that.Above-mentioned request sending module, obtains module and visit at detection module It asks that module operates in terminal, software or hardware realization can be passed through.
In addition, modules provided by the above embodiments of the present application five and scheme provided by example IV are also identical, The scene of application can also be identical.It is noted, of course, that the above scheme of the present embodiment five can be not limited to above-mentioned implementation The content and scene of example four.
It needs to be described in detail, needs the xmlhttp object to creation that several fields are set, then will set field Xmlhttp object be sent to server as the content of asynchronous access request, request corresponding data file.It is browsed receiving Before the access request of device asynchronous transmission, above-mentioned apparatus can also include: memory module, for saving corresponding different browser The header packet information of set access request, and the backpack body that access request is arranged is sky.Specifically, the access of the asynchronous transmission is asked The header packet information asked at least may include following field: customized removing field (NohostCleanCache), buffer update Time field (If-Modified-Since), buffer control field (Cache-Control) and caching compiling field (Pragma), these fields are stored in the memory of client, can be in the buffer area of memory, and correspondence is different The header packet information of access request set by browser is different, but the backpack body of the asynchronous access request is null value, specific to be arranged Content is as follows:
When browser is IE browser, it is YES that field is removed in setting, and setting buffer update time field is 0, and setting is slow Depositing control field is not cache, and it is not cache that caching compiling field, which is arranged,;
When browser is Firefox browser, it is YES that field is removed in setting, and setting buffer update time field is 0, It is not provided with buffer control field and caching compiling field;
When browser is Opera browser, it is YES that field is removed in setting, and setting buffer update time field is 0, if Setting buffer control field is not cache, and it is not cache that caching compiling field, which is arranged,;
When browser is Chrome browser, it is YES that field is removed in setting, and setting buffer control field is not cache, And it is not cache that caching compiling field, which is arranged, is not provided with buffer update time field.
It is further described, since the header packet information of above-mentioned asynchronous access information passes through one xmlhttp of creation Object is realized, then needs to create and run the Run Script for sending asynchronous access request, for example, can be in a browser An xmlhttp object is created with JavaScript script, client browser is asked using xmlhttp object to issue access It asks, it can very easily and server exchange data.
The application above scheme can be realized based on xmlhttp object, i.e., call in a browser and run xmlhttp After object, client terminal start-up notice server needs to carry out clear caching.
The xmlhttp object created in the embodiment of the present application can have different creation sides for different browsers Formula, for example, in IE browser, can be used ActiveXObject (" Msxml2.XMLHTTP ") or ActiveXObject (" Microsoft.XMLHTTP ") it creates, and in other modern browsers, new XMLHttpRequest () can be used It is created.
It should be noted that the xmlhttp object created in above-described embodiment five and being created in the embodiment three The contents such as content, acquisition modes, example and the application scenarios of xmlhttp object it is identical, but not limited to the examples three institutes are public The content opened.
It can be seen from the above description that the present invention realizes following technical effect: being mentioned through the embodiment of the present invention The scheme of confession, the content in caching will become null value, compare the prior art and do not need to re-download entire access file, use Empty file replaces, therefore, when issuing access request the browser next time of client, since content in buffer area is sky, So that browser needs to reconnect server to obtain data resource, not only realizing client browser in this way can be with Accessing server again as needed to obtain resource, guarantee can obtain the data resource updated on server in time, and Since the backpack body of the response message for the area that empties the cache is null value, so that the flow of browser processing data subtracts significantly It is few, it avoids and wastes time, improve the performance of access efficiency and browser.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
In the above embodiment of the invention, it all emphasizes particularly on different fields to the description of each embodiment, does not have in some embodiment The part of detailed description, reference can be made to the related descriptions of other embodiments.
In several embodiments provided herein, it should be understood that disclosed client, it can be by others side Formula is realized.Wherein, the apparatus embodiments described above are merely exemplary, such as the division of the unit, and only one Kind of logical function partition, there may be another division manner in actual implementation, for example, multiple units or components can combine or It is desirably integrated into another system, or some features can be ignored or not executed.Another point, it is shown or discussed it is mutual it Between coupling, direct-coupling or communication connection can be through some interfaces, the INDIRECT COUPLING or communication link of unit or module It connects, can be electrical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme 's.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list Member both can take the form of hardware realization, can also realize in the form of software functional units.
If the integrated unit is realized in the form of SFU software functional unit and sells or use as independent product When, it can store in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially The all or part of the part that contributes to existing technology or the technical solution can be in the form of software products in other words It embodies, which is stored in a storage medium, including some instructions are used so that a computer Equipment (can for personal computer, server or network equipment etc.) execute each embodiment the method for the present invention whole or Part steps.And storage medium above-mentioned includes: that USB flash disk, read-only memory (ROM, Read-Only Memory), arbitrary access are deposited Reservoir (RAM, Random Access Memory), mobile hard disk, magnetic or disk etc. be various to can store program code Medium.
The above is only a preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered It is considered as protection scope of the present invention.

Claims (17)

1. removing the method for cache file in a kind of browser characterized by comprising
Browser asynchronous transmission access request is to server;
It receives the server and responds the access request and return empty response message, wherein when the server detects When including customized removing field into the header packet information of the access request, return empties response message;
When the backpack body information emptied in response message is null value, the sky of backpack body information in response message is emptied described in extraction Value;The null value is covered to the data resource being saved in the buffer area of the browser, so that the caching of the browser Area is emptied.
2. the method according to claim 1, wherein the header packet information emptied in response message includes at least Any one or more field informations below: buffer control field, cache-time field and caching compiling field, wherein described Buffer control field is set as not caching, and the cache-time field is set as -1 or 0, and the caching compiling field is set as not Caching.
3. the method according to claim 1, wherein being not provided in the header packet information emptied in response message Any one or more field informations below: buffer control field, cache-time field and caching compiling field.
4. the method according to claim 1, wherein the access request include a URL access information, In, the data money being saved in the buffer area that the backpack body information in response message replaces the browser is emptied described in the use After source, the method also includes:
The browser sends new access request, wherein the new access request includes the URL access information;
When it is empty for detecting the content in the buffer area, inquires and obtain the domain name in the URL access information;
According to the corresponding server address of domain Name acquisition in the URL access information;
The browser accesses new demand servicing device by the server address, gets corresponding data resource.
5. the method according to claim 1, wherein the header packet information of the access request includes at least: making by oneself The removing field, buffer update time field, buffer control field and the caching compiling field of justice, receiving, browser is asynchronous Before the access request of transmission, the method also includes: corresponding different browser is believed the packet header of the access request is arranged Breath, and the backpack body that the access request is arranged is sky, wherein
When the browser is IE browser, it is YES that the removing field, which is arranged, and the buffer update time field, which is arranged, is 0, it is not cache, and it is not cache that the caching compiling field, which is arranged, that the buffer control field, which is arranged,;
When the browser is Firefox browser, it is YES that the removing field, which is arranged, and the buffer update time is arranged Field is 0, is not provided with the buffer control field and caching compiling field;
When the browser is Opera browser, it is YES that the removing field, which is arranged, and the buffer update time word is arranged Section is 0, and it is not cache, and it is not cache that the caching compiling field, which is arranged, that the buffer control field, which is arranged,;
When the browser is Chrome browser, it is YES that the removing field, which is arranged, and the buffer control field, which is arranged, is It does not cache, and it is not cache that the caching compiling field, which is arranged, is not provided with the buffer update time field.
6. removing the system of cache file in a kind of browser characterized by comprising
Client is used for browser asynchronous transmission access request;
Server establishes communication relations with the client, includes for working as in the header packet information for detecting the access request When customized removing field, return empties response message to the client;
Wherein, when the backpack body information emptied in response message is null value, the client includes: reception device, is used for It receives the server and responds the access request and return empty response message;Processor described empties sound for extracting The null value of backpack body information in information is answered, and the null value is covered to the data money being saved in the buffer area of the browser Source, so that the buffer area of the browser is emptied.
7. system according to claim 6, which is characterized in that the header packet information emptied in response message includes at least Any one or more field informations below: buffer control field, cache-time field and caching compiling field, wherein described Buffer control field is set as not caching, and the cache-time field is set as -1 or 0, and the caching compiling field is set as not Caching.
8. system according to claim 6, which is characterized in that be not provided in the header packet information emptied in response message Any one or more field informations below: buffer control field, cache-time field and caching compiling field.
9. system according to claim 6, which is characterized in that the access request includes a URL access information, In, the client further include:
Sending device sends new access request for the browser, wherein the new access request includes the URL access Information;
The processor is also used to when it is empty for detecting the content in the buffer area, is inquired and is obtained the URL access letter Domain name in breath, and access new demand servicing device according to the corresponding server address of domain name in the URL access information, gets pair The data resource answered.
10. system according to claim 6, which is characterized in that the header packet information of the access request includes at least: making by oneself The removing field, buffer update time field, buffer control field and the caching compiling field of justice, wherein the client Further include: memory, for saving the header packet information of access request set by corresponding different browser, and the access is asked The backpack body asked is sky, wherein
When the browser is IE browser, the removing field is YES, and the buffer update time field is 0, described slow Depositing control field is not cache, and the caching compiling field is not cache;
When the browser is Firefox browser, the removing field is YES, and the buffer update time field is 0, The buffer control field and caching compiling field are not saved;
When the browser is Opera browser, the removing field is YES, and the buffer update time field is 0, institute Stating buffer control field is not cache, and the caching compiling field is not cache;
When the browser is Chrome browser, the removing field is YES, and the buffer control field is not cache, The caching compiling field is not cache, and does not save the buffer update time field.
11. removing the device of cache file in a kind of browser characterized by comprising
Sending module, for browser asynchronous transmission access request to server;
Receiving module responds the access request and return empty response message for receiving the server, wherein described When server is detected in the header packet information of the access request comprising customized removing field, return empties response message;
Remove module, wherein when the backpack body information emptied in response message is null value, the removing module includes: to mention Modulus block, for extracting the null value for emptying backpack body information in response message;Overlay module, for the null value to be covered institute The data resource being saved in the buffer area of browser is stated, so that the buffer area of the browser is emptied.
12. device according to claim 11, which is characterized in that the header packet information emptied in response message at least wraps Include following any one or more field informations: buffer control field, cache-time field and caching compiling field, wherein institute It states buffer control field to be set as not caching, the cache-time field is set as -1 or 0, and the caching compiling field is set as It does not cache.
13. device according to claim 11, which is characterized in that do not set in the header packet information emptied in response message Set following any one or more field informations: buffer control field, cache-time field and caching compiling field.
14. device according to claim 11, which is characterized in that the access request includes a URL access information, In, described device further include:
The sending module is also used to the browser and sends new access request, wherein the new access request includes described URL access information;
Detection module, for inquiring and obtaining in the URL access information when it is empty for detecting the content in the buffer area Domain name;
Module is obtained, for according to the corresponding server address of domain Name acquisition in the URL access information;
Access modules access new demand servicing device by the server address for the browser, get corresponding data money Source.
15. device according to claim 11, which is characterized in that the header packet information of the access request includes at least: from The removing field, buffer update time field, buffer control field and the caching compiling field of definition, wherein described device Further include: memory module, for saving the header packet information of access request set by corresponding different browser, and described in setting The backpack body of access request is sky, wherein
When the browser is IE browser, the removing field is YES, and the buffer update time field is 0, described slow Depositing control field is not cache, and the caching compiling field is not cache;
When the browser is Firefox browser, the removing field is YES, and the buffer update time field is 0, The buffer control field and caching compiling field are not saved;
When the browser is Opera browser, the removing field is YES, and the buffer update time field is 0, institute Stating buffer control field is not cache, and the caching compiling field is not cache;
When the browser is Chrome browser, the removing field is YES, and the buffer control field is not cache, The caching compiling field is not cache, and does not save the buffer update time field.
16. removing the method for cache file in a kind of browser characterized by comprising
Receive the access request of the browser asynchronous transmission of client;
It whether detects in the header packet information of the access request comprising customized removing field;
When detecting the removing field, return empties response message, wherein the response message that empties carries backpack body letter Breath, in the case where the backpack body information is null value, the backpack body information is used to replace in the buffer area of the browser The data resource of preservation, so that the buffer area of the browser is emptied.
17. removing the device of cache file in a kind of browser characterized by comprising
Receiving module, the access request of the browser asynchronous transmission for receiving client;
Whether detection module includes customized removing field in the header packet information for detecting the access request;
Return module, for when detecting the removing field, return to empty response message, wherein described to empty response letter Breath carries backpack body information, and in the case where the backpack body information is null value, the backpack body information is for replacing the browser Buffer area in the data resource that has been saved so that the buffer area of the browser is emptied.
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 CN104615597A (en) 2015-05-13
CN104615597B true 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)

Families Citing this family (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
CN106777033B (en) * 2016-12-09 2019-06-25 北京齐尔布莱特科技有限公司 The method that Squid removes cache file according to catalogue format
CN108259198B (en) * 2016-12-28 2021-08-06 中国移动通信集团辽宁有限公司 Method, device and equipment for prejudging domain name cache hit rate
CN108388657B (en) * 2018-03-06 2022-04-05 五八有限公司 Cookie storage method, device, equipment and readable storage medium
CN114301607B (en) * 2021-12-30 2024-02-06 山石网科通信技术股份有限公司 Certificate clearing method and device for browser, 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

Also Published As

Publication number Publication date
CN104615597A (en) 2015-05-13

Similar Documents

Publication Publication Date Title
US10110695B1 (en) Key resource prefetching using front-end optimization (FEO) configuration
US10404556B2 (en) Methods and computer program products for correlation analysis of network traffic in a network device
CN104615597B (en) The methods, devices and systems of cache file are removed in browser
CA2839006C (en) Methods for making ajax web applications bookmarkable and crawlable and devices thereof
US6785769B1 (en) Multi-version data caching
Koashoek et al. Dynamic documents: Mobile wireless access to the WWW
US20160330269A1 (en) Method and system for fulfilling server push directives on an edge proxy
US20140310392A1 (en) Method and apparatus for processing composite web transactions
CN107391664A (en) Page data processing method and system based on WEB
US20150188999A1 (en) System and method to extend the capabilities of a web browser to improve the web application performance
US11252147B2 (en) Secure web application delivery platform
CN104615771B (en) A kind of method and device obtaining web data
CN110351288A (en) An a kind of product contains the data push method of multiple columns
CN107463657A (en) File operation method and terminal
CN103269313A (en) Method for achieving embedded linux home gateway captive portal
CN105279156B (en) Network information communication means and network information browsing apparatus
CN105871961B (en) A kind of method and device of gray scale publication routing
CN107645543A (en) Method and system applied to the non-80 caching miniport services of caching server HTTP
CN103957252B (en) The journal obtaining method and its system of cloud stocking system
EP2901658B1 (en) Request-agnostic caching for a data resource collection
CN110532455A (en) A kind of Web page picture acquisition methods and system based on Chrome browser
CN108259198A (en) A kind of pre-judging method, device and the equipment of domain name cache hit rate
CN106919600A (en) One kind failure network address access method and terminal
CN104462223B (en) A kind of Web browser method and device based on peer-to-peer network pattern
CN109561027A (en) Flow optimization method, load balancer and the storage medium of transparent caching

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