Summary of the invention
A kind of method that the invention discloses WEB platform data buffer memory, comprising:
Client modules is from main body frame, the data cell content without buffer memory, each data cell attribute information of webpage of service end module webpage; Described data cell attribute mainly comprises whether data cell can supply the information such as client modules buffer memory, Update Level, version;
Client modules analyzes in described webpage, whether there is the data cell that needs buffer memory according to each data cell attribute information of described webpage;
If exist and need data cached unit in webpage, judge whether client modules this locality exists the described data cell that needs buffer memory;
If client modules this locality does not exist the data cell that needs buffer memory, from needing the data cell of buffer memory described in service end module acquisition request, carry out this locality storage, and generate the version information of described data cell;
If local, there is the described data cell that needs buffer memory, judge the Update Level in the attribute information of the data cell that this needs buffer memory;
According to described Update Level, the described data cell of buffer memory that needs is obtained.
Preferably, this needs described judgement in the Update Level in the attribute information of data cell of buffer memory, and described Update Level never comprises and upgrades, needs once in a while to upgrade, often needs to upgrade; The described described data cell that needs buffer memory being obtained further according to described Update Level is: the Update Level that needs the data cell of buffer memory if described is never to upgrade, during each accessed web page, client modules reads this data cell and loads from this locality; If the Update Level of this data cell upgrades for needing once in a while, in time client modules start cycle first during access destination webpage, from service end module, obtain the version information of this data cell, with this version information and the version information of this data cell of local storage, contrast, if version information is different, from this data cell content of service end request, and replace local data cell of having stored; If the Update Level of this data cell upgrades for often needing, when this webpage of the each request access of client modules, all will the version information obtaining from service end and the version information of local storage be compared, if version information is different, from this data cell content of service end request, and replace local data cell of having stored.
Preferably, also comprise: client modules loads data cell in the main body frame of the webpage from service end acquisition request, and and form complete web page display without the data cell content of buffer memory.
Preferably, whether described client modules is analyzed in described webpage and is had and need the data cell of buffer memory to be further according to each data cell attribute information of described webpage: client modules is according to each data cell attribute information of webpage all data cell attributes in analyzing web page one by one, judges in webpage, whether there is the data cell that needs buffer memory.
Preferably, also comprise: the instruction according to WEB portal service provider when issuing or upgrade web resource, arranges data cell attribute.
Preferably, client modules, from the main body frame of service end module webpage, without the data cell content of buffer memory, each data cell attribute information of webpage, adopts the Ajax page without flush mechanism when client sends request.
Preferably, if version information is different, from this data cell content of service end request, and replace after local data cell of having stored, more the version of new data element.
The system that the invention also discloses a kind of WEB platform data buffer memory, is comprised of two parts: service end module and client modules;
Described service end module comprises that network service submodule, back-end data sub module stored, page resource arrange submodule, page data output sub-module;
Described network service submodule, is used to client modules to provide services on the Internet;
Described back-end data sub module stored, is connected with described network service submodule, for storing the data cell that needs buffer memory and the data cell correlation attribute information of obtaining from service end module;
Described page resource arranges submodule, is connected with back-end data storing sub-units, for the data cell attribute for webpage, arrange, and for control mutual between vectoring information unit and client modules according to described setup of attribute; The attribute of described data cell comprises id, whether buffer memory switch, Update Level, version information;
Page data output sub-module, with described page resource, submodule being set is connected, for the data cell setup of attribute situation of submodule to webpage being set according to the connection request of client modules and page resource, generate the main frame of the page and the data resource that does not need client-cache, and be back to client modules by network;
Client modules comprises that data load four submodules such as submodule, Data Control submodule, data sub module stored, data display submodule;
Described data load submodule, be connected with Data Control submodule, for obtaining the main body frame, the data cell content without buffer memory, the data cell that needs buffer memory, each data cell attribute information of webpage etc. of the webpage that service end returns, and transferred to Data Control submodule;
Data sub module stored, for need the data cell of buffer memory to carry out localization storage to the webpage of WEB system, and the version information of storage data units;
Data Control submodule, is used to different websites to open up different storage spaces, for Data Control submodule, carries out the storage of data cell and reads;
Data Control submodule, is connected with data loading submodule, data sub module stored, data display submodule, is mainly used in loading submodule according to data and obtains each data cell attribute information of webpage, whether has the data cell that needs buffer memory in analyzing web page; And for judging the local Update Level that whether has the data cached unit of described needs and need data cached unit; And control the loading of data loading submodule to web data according to analyzing judged result, and control the storage data cached to needs of data sub module stored, control the displaying of data display submodule to web data;
Data display subelement, and data fast with Data Control submodule load submodule and are connected, and arrive in the main body frame of the webpage of service end acquisition request, and and form complete web page display without the data cell content of buffer memory for loading data cell.
The present invention has realized the configurable cache of the site resource that a part is seldom upgraded, and has reduced web access, saved access resources and improved access ageing.
Embodiment
One embodiment of the present of invention disclose a kind of method of WEB platform data buffer memory, as shown in Figure 1.Mainly comprise the steps:
Step 1, the instruction according to WEB portal service provider when issuing or upgrade web resource, arrange data cell attribute.
Whether what here, data cell attribute mainly comprised data cell can supply the information such as client modules buffer memory, Update Level, version.When data cell is updated, its version information is updated.
In this step, web resource is the various data cells in webpage, comprises monomer resource, as: picture, flash document, js document, css document, xml document etc.; Also comprise mixing resource, as: table (form, html tag, with normalized row and column, provide the element of structure for the data content in html document), div (layer, html tag, be used for providing for the content of bulk in html document (block-level) element of structure and background) etc., mix and in resource, generally at least comprise two or more monomer resources.
In addition, the various data resources in service end webpage are present in the main body frame of webpage, and the main body frame of service end webpage is as trunk, and each data cell of webpage is attached on trunk as leaf.
Each data cell all comprises two parts information: attribute and content.The attribute of data cell comprises id, whether buffer memory switch, Update Level, version information etc., and attribute arranges submodule setting by service end page resource, in client, controls in submodule and reads and analyze.The content of data cell determines whether in client, carry out buffer memory and how to upgrade, the content of data cell will be embodied directly in user's browser interface by its attribute.
In a lot of large-scale WEB websites, all site resources can be divided into following several Update Level substantially by its renewal frequency: never upgrade, upgrade once in a while, often upgrade, upgrade constantly.The information of upgrading more constantly, the necessity of its buffer memory is less, the resource of upgrading constantly class does not generally need buffer memory, for example: in real time news, stock information, forum's model etc., require each client send request of access all directly Connection Service end obtain web page resources; And other a few class WEB portal service providers can arrange each data cell of webpage according to actual conditions, by the buffer memory of client, carry out the access speed of optimizing webpage.
The version information of data cell can be defined as a special character string, this character string is comprised of numeral, also can comprise some letters, concrete form is defined by WEB portal service provider oneself, for example: v.2010.0012, represent that this data cell is the version of the 12nd time _ _ _ _ _ _ issue of issue in 2010.In general, this version of the larger expression of numerical value is newer.
Step 2: client modules is from main body frame, the data cell content without buffer memory, each data cell attribute information of webpage of service end module webpage.
In this step, the web data of client modules request access service end module, and receive main body frame, the data cell content without buffer memory, each data cell attribute information of webpage of generating web page after the request of loading service end module responds.
Step 3: client modules is according to whether having the data cell that needs buffer memory in each data cell attribute information analyzing web page of webpage.
In this step, client background is controlled submodule and is analyzed one by one data cell attributes all in this webpage according to each data cell attribute information of webpage, comprises and judges in webpage, whether there is the data cell that needs buffer memory.
Step 4: if exist and need data cached unit in webpage, judge whether this locality exists the data cached unit of described needs.
Step 5: if client modules this locality does not exist the data cell that needs buffer memory, this needs the data cell of buffer memory from service end module acquisition request, and carry out this locality storage, and generate the version information of this data cell.
In this step, if local, not existing the data cell that needs buffer memory, client data to control submodule will send request by loading submodule, with Connection Service end, obtain this data cell, and store in client stores submodule, generate the version information of this data cell simultaneously.
Step 6: have if local the data cell that needs buffer memory, further judge the Update Level in the attribute of the data cell that this needs buffer memory.
According to Update Level, minute three kinds of situations, carry out by following 7,8,9 steps.
Step 7: be never renewal if this needs the Update Level of the data cell of buffer memory, during each accessed web page, client modules reads this data cell and loads from this locality.
In this step, while accessing this page, connection server does not obtain this resource at every turn, and only reads the data of client terminal local data sub module stored.
In this step, such as the Banner (banner of webpage or headline) of webpage, Js document, Css document etc., this type of resource generally can not upgraded after website service is carried out again.In this case, once this resource is preserved in client data sub module stored, when user to access pages, Connection Service end does not obtain this resource so, and the data that only read client terminal local storage can achieve the goal.
Step 8: if the Update Level of this data cell upgrades for needing once in a while, in time client modules start cycle first during access destination webpage, from service end module, obtain the version information of this data cell, with this version information and the version information of this data cell of local storage, contrast, if version information is different, from this data cell content of service end request, and replace local data cell of having stored.
The concrete operations of this step are: client data is controlled submodule and will be utilized loading submodule transmission connection request, id by this data cell of network delivery is to service end, and service end generates the content of this data cell according to id parameter, and be back to client.Client loads submodule and has obtained the data cell content that service end is returned, and by client, controls submodule, deletes the old version of this data cell, and the data cell content of preserving redaction is in client stores submodule, so as other time read.
In this step, such as some advertising messages of throwing in this WEB website, some bulletin category information etc., this type of resource updates frequency ratio is lower, but still needs to upgrade every a period of time.In this case, while accessing this webpage first in this start cycle, just compare the resource version information of web data unit and client terminal local sub module stored, and other time open the resource of not comparing and directly transfer local storage in this website.The start cycle refers to that client PC is from opening machine to closing machine during this period of time.
Step 9: if the Update Level of this data cell upgrades for often needing, so when this webpage of the each request access of client modules, all will the version information obtaining from service end and the version information of local storage be compared, if version information is different, from this data cell content of service end request, and replace local data cell of having stored.
Such as some, do not require information, video information of real-time update etc.In this case, require each this webpage of access all to compare the resource version information of data cell and the client terminal local sub module stored of webpage.
Client modules loads data cell in the main body frame of the webpage from service end acquisition request, and and without the data cell content of buffer memory, form complete webpage, show together.
In this step, when the version of the data cell of service end module is consistent with the data cell version taking out in the local sub module stored of client modules, client is controlled submodule the content that directly reads the data cell that local sub module stored stores according to the id of this data cell and version information is loaded.
When service end resource version is while being new than the data cell of client terminal local sub module stored, client loads the data cell of newly obtaining from service end.
Preferably, in the present embodiment browser-presented the main body frame of webpage and data cell that need not buffer memory, and in the data cell of those palpus buffer memorys, some may need backstage Connection Service end to load, this operation may need the some time, therefore these web data unit can show such as " loading data, please wait for ... " Deng making man-machine interaction more friendly.
Preferably, in the present embodiment, client data will be controlled when submodule will send request by loading submodule and can be adopted the Ajax page to carry out carrying out alternately with service end module without the technology of flush mechanism, so both can alleviate the burden to network and server, improve the efficiency of processing, simultaneously also without the interaction flow that interrupts user to access pages data.
Preferably, in the present embodiment, when client is loaded submodule and is carried out the request of data cell by data, the page will create an XmlHttpRequest object, to server, send parameter, and the XmlDoc object of the data that passed over by reception service end of this object generation, client data loads submodule and is resolved XmlDoc object and will be further processed by Dom.
Preferably, in the present embodiment, the content of text of this data cell can be encoded (also can adopt the coded formats such as UTF-8) by UniCode form during service end generated data unit, so that client produces because of some special character extremely in resolving.
By the description of the present embodiment, the present invention program, the defect of the clean cut of having avoided traditional browser rs cache technology all to load for web page resources of the same type or all not loaded, by the data resource often not upgrading is carried out to buffer memory, realize its web page resources of control that the WEB portal service provider of service end can be autonomous and whether in client, carry out buffer memory, to reach, reduce mutual between service end and client, improve the object of user's interface access speed.
As shown in Figure 2, second embodiment of the invention provides a kind of system of Web platform data buffer memory.System is mainly comprised of two parts: service end module and client modules.
Wherein, service end module comprises that network service submodule, back-end data sub module stored, page resource arrange four submodules such as submodule, page data output sub-module.
Network service submodule, for, software module service-oriented, based on distributed program operation at net environment, adopt the internet universal standards such as HTTP and XML, make people in different places by the data on different terminal device access WEB, to be used to client modules to provide services on the Internet.
Back-end data sub module stored, is connected with network service submodule, for organizing according to data structure, the warehouse of store and management data.Can be network data stored data base, as sqlserver, mysql database.For storing the data cell that needs buffer memory and the data cell correlation attribute information of obtaining from service end module.
Page resource arranges submodule, be connected with back-end data storing sub-units, for WEB portal service provider data cell attribute for webpage when the issue web resource, arrange, the attribute of data cell comprises id, whether buffer memory switch, Update Level, version information etc.And for controlling mutual between guiding this data cell and client modules.
Data cell in webpage can be the monomer resource of webpage, as: picture, flash document, js document, css document, xml document etc.; Also can be mixing resource, as: data form (table), layer (div) etc., generally at least comprise two or more monomer resources in mixing resource.
Page data output sub-module, arranges submodule with page resource and is connected, and according to the connection request of client modules and page resource, submodule is set to the data cell setup of attribute situation in webpage, generates the data of the page.Page resource is divided into a lot of unit, and each data cell has independently id, the attribute such as buffer memory switch, Update Level and version information whether.Page data output sub-module finally generates main frame and all data resources that does not need client-cache of the page, and is back to client modules by network.
Client modules comprises that data load four submodules such as submodule, Data Control submodule, data sub module stored, data display submodule.Wherein:
Data load submodule, be connected with Data Control submodule, be mainly used in sending client modules request, Connection Service end module, the main body frame that obtains the webpage that service end returns, the data cell content without buffer memory, the data cell that needs buffer memory, each data cell attribute information of webpage etc., and transferred to Data Control submodule to analyze.
Data sub module stored, for need the data cell of buffer memory to carry out localization storage to the webpage of WEB system, and the version information of storage data units, to improve the access efficiency of webpage.
Data Control submodule is that different storage spaces is opened up in different websites, is convenient to Data Control submodule and carries out the storage of data cell and read.For the data cell of mixing resource, will open up independently space for storing.As: for a table who comprises picture and link (data form).
Data Control submodule, is connected with data loading submodule, data sub module stored, data display submodule, is mainly used in loading submodule according to data and obtains each data cell attribute information of webpage, whether has the data cell that needs buffer memory in analyzing web page; And for judging the local Update Level that whether has the data cached unit of described needs and need data cached unit; And control the loading of data loading submodule to web data according to analyzing judged result, and control the storage data cached to needs of data sub module stored, control the displaying of data display submodule to web data.
Data Control submodule and other submodules be alternately mainly: one, control data and load the request that submodule Connection Service end module sends web page access; Two, the web data file that Analysis Service end returns; Three, the id of the data cell of buffer memory creates independently storage space in client data sub module stored as required; Four, the version information of comparison data cell; Five, data cell is stored in data sub module stored; Six, data cell is read out from data sub module stored; Seven, control web data or data cell shows in browser.
Data display subelement, and data fast with Data Control submodule load submodule and are connected, arrive in the main body frame of the webpage of service end acquisition request, and and form complete webpage, displaying together without the data cell content of buffer memory for loading data cell.The result that user finally browses should be the complete page, comprising: the data cell without buffer memory that service end is returned, and the data cell of this locality of reading in client data sub module stored storage.
In addition, client modules can be connected by internet passage with service end module, and each function of client modules can realize by the multiple browser software operations such as IE of general terminal.Service end module generally runs on the server that various network services is provided, the generally operation realization on server of the function of its each module.
In the foregoing description, data refer to the web page contents that user will browse.
By the description of the present embodiment, the present invention program, has avoided traditional browser rs cache technology all to load for web page resources of the same type or the defect of the clean cut all not loading.The page resource that has increased service end on the basis of prior art framework arranges the Data Control submodule of submodule and client, realize its web page resources of control that the WEB portal service provider of service end can be autonomous and whether in client, carry out buffer memory, to reach, reduce mutual between service end and client, improve the object of user's interface access speed.
General current browser rs cache technology, because browser is present in the limitation of client, cannot learn user want access webpage which be to need real-time update, which only need be kept at gets final product in client terminal local buffer area, and in data cached, can only be according to the type clean cut of web page resources, i.e. the web page resources of certain type or all buffer memory, whole buffer memorys not, underaction.And by the enforcement of this programme, service end WEB portal service provider can be got involved in the reasonable preservation behavior of its site resource in each client, only has after all WEB portal service provider just can accurately indicate each web page resources whether buffer memory and Update Level.Therefore this programme can not only greatly reduce the mutual data traffic of client and service end module, alleviated the burden that data are brought to network and server in transmitting procedure, and not affecting user browses and deal with data in client executing, shorten user and wait pending data connection server to load the time of complete webpage, improved the efficiency that user processes.
Above-described embodiment is only used for further illustrating method and the device thereof of a kind of WEB platform data buffer memory of the present invention; but the present invention is not limited to embodiment; any simple modification, equivalent variations and modification that every foundation technical spirit of the present invention is done above embodiment, all fall in the protection domain of technical solution of the present invention.