CN104219272A - Method, terminal and system for updating caches - Google Patents

Method, terminal and system for updating caches Download PDF

Info

Publication number
CN104219272A
CN104219272A CN201310221080.9A CN201310221080A CN104219272A CN 104219272 A CN104219272 A CN 104219272A CN 201310221080 A CN201310221080 A CN 201310221080A CN 104219272 A CN104219272 A CN 104219272A
Authority
CN
China
Prior art keywords
data
ajax
background server
data cached
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.)
Granted
Application number
CN201310221080.9A
Other languages
Chinese (zh)
Other versions
CN104219272B (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 CN201310221080.9A priority Critical patent/CN104219272B/en
Publication of CN104219272A publication Critical patent/CN104219272A/en
Application granted granted Critical
Publication of CN104219272B publication Critical patent/CN104219272B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a method, a terminal and a system for updating caches. The method for updating the caches includes starting Web application programs, recording starting time of the Web application programs, receiving application download requests of the Web application programs, acquiring timestamps in AJAX [asynchronous JavaScript and XML (extensive markup language)] cache data if the AJAX cache data corresponding to the application download requests are available locally, judging whether the starting time is later than or identical to the timestamps or not, and omitting updating of the AJAX cache data if the starting time is later than or identical to the timestamps; transmitting AJAX cache data verification requests to background servers corresponding to the application download requests if the starting time is not later than or identical to the timestamps, and updating the AJAX cache data according to return data of the background servers. Issue time of the background servers is recorded by the timestamps. According to the technical scheme, the method, the terminal and the system have the advantages that only the cache data which are downloaded before the Web application programs are started need to be verified, the cache data which are downloaded after the Web application programs are started do not need to be verified, and accordingly the correctness of the cache data can be guaranteed at a low cost.

Description

Buffering updating method, terminal and system
Technical field
The present invention relates to web development technologies field, particularly relate to buffering updating method, terminal and system.
Background technology
AJAX refers to asynchronous JavaScript and XML of Asynchronous JavaScript and XML(), AJAX is a kind of technology for creating interactivity web application.The XMLHttpRequest object of JavaScript can be used directly to communicate with server by AJAX, JavaScript, by this object, JavaScript can at the situation of not reload page and Web server swap data.
The local memory technology localStorage of existing standard Http buffer memory and Html5, when suspension, can be used for as off-line application provides data.
To in the research and practice process of prior art, inventor finds that prior art at least exists following problem: the local memory technology localStorage of Html5 oneself can not eliminate and upgrade data cached, and limited storage space.Although standard Http buffer memory can eliminate buffer memory by arranging buffer memory time-out time, the bad control of time granularity automatically, arranging and excessive or too smallly all can not meet actual needs; Although can add If-Modify-Since head in request, obtain latest data, each request all will verify, and needs to initiate network and connects, cause upgrading efficiency low.Above two schemes is all only solution storage problem, can not effectively with background server synchronized update data, data cached correctness cannot be ensured by less cost.
Summary of the invention
The embodiment of the present invention provides buffering updating method, terminal and system, and it can ensure data cached correctness with less cost.
The embodiment of the present invention is by the following technical solutions:
First aspect, the embodiment of the present invention provides a kind of buffering updating method, comprising:
Start web application, the start-up time of record web application;
Receive the application download request of web application;
If the AJAX that this locality stores application download request corresponding is data cached, the record background server during acquisition AJAX is data cached issues the timestamp of time;
Judge whether start-up time is less than or equal to timestamp, if so, do not need to upgrade AJAX data cached; Otherwise, send the data cached data check request of AJAX to the background server that application download request is corresponding, upgrade AJAX according to the return data of background server data cached.
Second aspect, the embodiment of the present invention provides a kind of buffering updating method, comprising:
Terminal starts web application, the start-up time of record web application;
Terminal receives the application download request of web application;
If the AJAX that this locality stores application download request corresponding is data cached, the record background server during terminal acquisition AJAX is data cached issues the timestamp of time;
Whether terminal judges is less than or equal to timestamp start-up time, if so, does not need to upgrade AJAX data cached; Otherwise, send the data cached data check request of AJAX to the background server that application download request is corresponding;
Background server receives the data cached data check request of AJAX, and AJAX is data cached, according to check results to terminal return data in verification;
It is data cached that terminal upgrades AJAX according to the return data of background server.
The third aspect, the embodiment of the present invention provides a kind of terminal for performing buffering updating method, comprising:
Application program launching unit, for starting web application, the start-up time of record web application;
Download request receiving element, for receiving the application download request of web application;
Timestamp acquiring unit, if it is data cached to store for this locality the AJAX applying download request corresponding, the record background server during acquisition AJAX is data cached issues the timestamp of time;
First check request transmitting element, for judging whether start-up time is less than or equal to timestamp, if so, does not need to upgrade AJAX data cached; Otherwise, send the data cached data check request of AJAX to the background server that application download request is corresponding,
First data cached updating block, data cached for upgrading AJAX according to the return data of background server.
Fourth aspect, the embodiment of the present invention provides a kind of system for performing buffering updating method, comprise terminal and background server, terminal comprises application program launching unit, download request receiving element, timestamp acquiring unit, the first check request transmitting element, the first data cached updating block, and background server comprises the first data check unit:
Application program launching unit, for starting web application, the start-up time of record web application;
Download request receiving element, for receiving the application download request of web application;
Timestamp acquiring unit, if it is data cached to store for this locality the AJAX applying download request corresponding, the record background server during terminal acquisition AJAX is data cached issues the timestamp of time;
Whether the first check request transmitting element, be less than or equal to timestamp for terminal judges start-up time, if so, do not need to upgrade AJAX data cached; Otherwise, send the data cached data check request of AJAX to the background server that application download request is corresponding;
First data check unit, for receiving the data cached data check request of AJAX, AJAX is data cached, according to check results to terminal return data in verification;
First data cached updating block, data cached for upgrading AJAX according to the return data of background server.
The beneficial effect that the technical scheme that the embodiment of the present invention provides is brought:
When receiving the application request of web application, if the AJAX that this locality stores application request corresponding is data cached, record background server during acquisition AJAX is data cached issues the timestamp of time, judge whether the start-up time of web application is less than or equal to timestamp, if, illustrate this AJAX data cached be web application start after download data cached, do not need to upgrade AJAX data cached, otherwise, illustrate this AJAX data cached be web application start before download data cached, need to verify, the background server corresponding to application request sends data check request, AJAX is upgraded data cached according to the return data of background server, the embodiment of the present invention only verifies web application and starts the data cached of front download, before starting web application, the data cached of download upgrades, do not verify web application and start the data cached of rear download, do not need to upgrade web application and start the data cached of rear download, thus effectively with background server synchronized update data, data cached correctness is ensured, the data processing performance of lifting means with less cost.
Accompanying drawing explanation
In order to be illustrated more clearly in the technical scheme in the embodiment of the present invention, below the accompanying drawing used required in describing the embodiment of the present invention is briefly described, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, to those skilled in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to the content of the embodiment of the present invention and these accompanying drawings.
Fig. 1 is the method flow diagram of first embodiment of the buffering updating method of the embodiment of the present invention.
Fig. 2 is the method flow diagram of second embodiment of the buffering updating method of the embodiment of the present invention.
Fig. 3 is the method flow diagram of the 3rd embodiment of the buffering updating method of the embodiment of the present invention.
Fig. 4 is the method flow diagram of the 4th embodiment of the buffering updating method of the embodiment of the present invention.
Fig. 5 is the method flow diagram of the 5th embodiment of the buffering updating method of the embodiment of the present invention.
Fig. 6 is the schematic flow sheet of the 6th embodiment of the buffering updating method of the embodiment of the present invention.
Fig. 7 is the block diagram of terminal first embodiment for performing buffering updating method of the embodiment of the present invention.
Fig. 8 is the block diagram of terminal second embodiment for performing buffering updating method of the embodiment of the present invention.
Fig. 9 is the block diagram of system first embodiment for performing buffering updating method of the embodiment of the present invention.
Figure 10 is the block diagram of system second embodiment for performing buffering updating method of the embodiment of the present invention.
Embodiment
The technical problem solved for making the present invention, the technical scheme of employing and the technique effect that reaches are clearly, be described in further detail below in conjunction with the technical scheme of accompanying drawing to the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those skilled in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
Please refer to Fig. 1, it is the method flow diagram of first embodiment of the buffering updating method of the embodiment of the present invention.The present embodiment is mainly used in the terminal can running web application, comprise smart mobile phone, E-book reader, MP3(Moving Picture Experts Group Audio Layer III, dynamic image expert compression standard audio frequency aspect 3) player, MP4(Moving Picture Experts Group Audio Layer IV, dynamic image expert compression standard audio frequency aspect 4) player, PC, notebook computer, panel computer etc.The method comprises:
S101, startup web application, the start-up time of record web application.
Web application general reference is based on the application program of B/S framework, and web application and Web server carry out data interaction, and web application can be browser, support the electronic book reader etc. that backstage is downloaded.
The application download request of S102, reception web application.
Terminal is according to the instruction of user, or the instruction of web application acquiescence, receives the application download request that web application sends.Such as, browser sends downloading web pages content requests, and electronic book reader sends downloads the request of books chapters and sections.
If S103 this locality stores application download request, corresponding AJAX is data cached, obtain this AJAX data cached in record background server issue the timestamp of time.
After receiving application download request, judge local cache space store apply AJAX corresponding to download request data cached time, then obtain the timestamp that this AJAX is data cached.The background server of the embodiment of the present invention, refers to the Web server that can respond Web application; When background server issues data, can produce a time attribute, this time attribute can as the data cached timestamp of AJAX.
The AJAX of the embodiment of the present invention is data cached is preferably JSON form or XML format, and these two kinds of forms can support that complicated objectification stores; Certainly, can also be other form.
S104, judge whether the start-up time of web application is less than or equal to the data cached timestamp of AJAX, if so, continue step S105, otherwise, continue step S106.
S105, do not need upgrade AJAX data cached.Buffer update flow process terminates, and directly can give application download request by data cached for this AJAX response.
The start-up time of web application is less than or equal to the data cached timestamp of AJAX, illustrate AJAX data cached be open just download after web application data cached, be equivalent to the data of online Real time request, therefore think effective, do not need verification, do not need to upgrade, can directly respond to application download request.
It should be noted that, the embodiment of the present invention provides buffering updating method, AJAX is upgraded data cached if do not needed, then the method terminates, the data cached response of this AJAX of follow-up use is the extension of the method to the application download request of web application, those of ordinary skill in the art can understand the process of data cached response application download request according to prior art, no longer repeat at this.
S106, send the data cached data check request of AJAX to background server corresponding to application download request.
The start-up time of web application is greater than the data cached timestamp of AJAX, illustrate AJAX data cached be open download before web application data cached, belong to the last data starting web application buffer memory, therefore need verification.
S107, to upgrade AJAX according to the return data of background server data cached.
Background server to verify and to terminal return data AJAX is data cached according to data check request, and it is data cached that terminal upgrades AJAX according to return data.Buffer update flow process terminates, can by the data cached response of AJAX upgraded to applying download request.
The embodiment of the present invention adopts AJAX buffer memory, has following features: the first, AJAX is data cached leaves local disk in, and memory space is infinitely-great in theory.The data cached reading of the second, AJAX is the Http flow process of standard, does not need extra cache read fetch logic.Three, AJAX data cached form is various, such as can use JSON form or XML format, can support the storage of complicated objectification.
To sum up, the buffering updating method of the embodiment of the present invention, what only verification web application was downloaded before starting is data cached, before starting web application, the data cached of download upgrades, do not verify web application start after download data cached, do not need upgrade web application start after download data cached, thus effectively with background server synchronized update data, data cached correctness is ensured, the data processing performance of lifting means with less cost.When the network of terminal is online, can be pre-loaded and data cached to local disk, when the reasons such as environment cause network to disconnect or vulnerable network time, web application still can be local data cached by reading, and provide the experience of application on site to user; Such as, when network is online, electronic book reader has downloaded books chapters and sections, when network disconnects, as long as electronic book reader is not closed, this programme can't verify data cached, and electronic book reader still can provide the experience of the online reading books chapters and sections of similar smoothness.This programme can reduce the experience impact that unstable networks factor brings user, accomplishes transparent to user simultaneously.
Please refer to Fig. 2, it is the method flow diagram of second embodiment of the buffering updating method of the embodiment of the present invention.Compared with the present embodiment and said method first embodiment, add to contents such as background server downloading datas.The method comprises:
S201, startup web application, the start-up time of record web application.
S202, send data download request to background server corresponding to web application, the return data of background server is stored as AJAX data cached.Wherein, this return data comprises timestamp and the content authentication value that record background server issues the time.Timestamp and content authentication value are two attributes of return data, and namely AJAX is data cached comprises this two attributes.
This step is in advance from background server downloading data, and the opportunity of pre-download data and quantity can be specified by web application, also can be set by the user.Such as, when electronic book reader opens the first page of certain chapters and sections, electronic book reader can send whole content of pages requests of downloading these chapters and sections in advance.This step can download the content of several application download requests of web application in advance, a general only corresponding background server of application download request, and a web application can comprise several application download requests, a web application can several background servers corresponding.
It should be noted that, when concrete enforcement the technical program, this step S202 and following steps S203 does not have sequencing relation.Step S203 to step S212 for receive application download request after, the flow process that renewal AJAX during this application download request of terminal response is data cached; And step S202 is after starting web application, the step of downloading data in advance, this step can appear at any time after starting web application.
The application download request of S203, reception web application.
S204, judge that the local AJAX whether storing application download request corresponding is data cached, if so, continue step S206, otherwise, continue step S205.
If the AJAX that S205 this locality does not store application download request corresponding is data cached, the background server corresponding to application download request sends data download request, the return data of background server is stored as AJAX data cached.Wherein, this return data comprises timestamp and the content authentication value that record background server issues the time.Buffer update flow process terminates, and can give application download request by data cached for this AJAX response.
If S206 this locality stores application download request, corresponding AJAX is data cached, obtain this AJAX data cached in record background server issue the timestamp of time.
S207, judge whether the start-up time of web application is less than or equal to the data cached timestamp of AJAX, if so, continue step S208, otherwise, continue step S209.
S208, do not need upgrade AJAX data cached.Buffer update flow process terminates, and directly can give application download request by data cached for this AJAX response.
The start-up time of web application is less than or equal to the data cached timestamp of AJAX, illustrate AJAX data cached be open just download after web application data cached, be equivalent to the data of online Real time request, therefore think effective, do not need verification, can directly respond to application download request.
Content authentication value during S209, acquisition AJAX are data cached, obtains random number, sends the data check request of the data cached content check value of AJAX and random number to the background server that application download request is corresponding.
The start-up time of web application is greater than the data cached timestamp of AJAX, illustrate AJAX data cached be open download before web application data cached, belong to the data of last buffer memory, therefore need verification.
In the embodiment of the present invention, define data check agreement, comprise the data check request of terminal and the response of background server.Data check request format is as follows: url:http: //host/path md5=x & t=y.Md5 is content authentication value, and y is random number, and read data from buffer memory is avoided in the effect of random number.Content authentication value is used to compare with back-end data.Response format is as follows: { md5:xxxxx, t:Tg, content:Content}, md5 are content authentication value, and Tg is the timestamp that record background server issues the time, and Content is for issuing content; When back-end data is identical with the content authentication value of data check request, illustrate that AJAX is data cached identical with back-end data, background server response does not have the return data of physical contents, and Content is empty.
S210, judge that whether the content authentication value in the return data of background server is identical with the content authentication value of data check request, if so, continue step S211, otherwise, continue step S212.
S211, do not need upgrade AJAX data cached.Buffer update flow process terminates, and data cached for this AJAX response is given application download request.
Content authentication value in the return data that terminal receives is identical with the content authentication value of data check request, illustrates that AJAX is data cached identical with the back-end data of background server, therefore does not need to upgrade, and front end javaScript can directly abandon this return data.
S212, with return data replace AJAX data cached.Buffer update flow process terminates, and the data cached response of AJAX after replacement is given application download request.
Content authentication value in the return data that terminal receives is not identical with the content authentication value of data check request, illustrate that AJAX is data cached not identical with the back-end data of background server, therefore it is data cached to replace AJAX with return data, upgrades data cached.
To sum up, the buffering updating method of the embodiment of the present invention, can carry out downloading data in advance after starting web application.When receiving the application download request of web application, judge that downloading data and front one-shot web application in advance download data cached in, whether there is the AJAX corresponding with this application download request data cached, if do not had, then arrive background server and download; If had, then judge that this AJAX is data cached by timestamp to download before startup web application, or download after starting web application, if download after startup web application, then data cached without the need to upgrading this AJAX, if download before startup web application, then verify this AJAX data cached whether consistent with the back-end data of background server, if, then data cached without the need to upgrading this AJAX, otherwise, use the return data of background server to replace AJAX data cached.The embodiment of the present invention can effectively with background server synchronized update data, ensure data cached correctness with less cost.
Please refer to Fig. 3, it is the method flow diagram of the 3rd embodiment of the buffering updating method of the embodiment of the present invention.Compared with the present embodiment and said method second embodiment, add contents such as forcing verification.The method comprises:
S301, startup web application, the start-up time of record web application.
S302, send data download request to background server corresponding to web application, the return data of background server is stored as AJAX data cached.
This step is in advance from background server downloading data, and the opportunity of pre-download data and quantity can be specified by web application, also can be set by the user.
The application download request of S303, reception web application.
S304, judge that the local AJAX whether storing application download request corresponding is data cached, if so, continue step S306, otherwise, continue step S305.
If the AJAX that S305 this locality does not store application download request corresponding is data cached, the background server corresponding to application download request sends data download request, the return data of background server is stored as AJAX data cached.Buffer update flow process terminates, and can give application download request by data cached for this AJAX response.
If the AJAX that S306 this locality stores application download request corresponding is data cached, the record background server during acquisition AJAX is data cached issues the timestamp of time.
S307, judge whether the start-up time of web application is less than or equal to the data cached timestamp of AJAX, if so, continue step S308, otherwise, continue step S309.
S308, do not need upgrade AJAX data cached.Buffer update flow process terminates, and directly can give application download request by data cached for this AJAX response.
The content authentication value that S309, acquisition AJAX are data cached, obtains random number, sends the data check request of the data cached content check value of AJAX and random number to the background server that application download request is corresponding.
S310, judge that whether the content authentication value in the return data of background server is identical with the content authentication value of data check request, if so, continue step S311, otherwise, continue step S312.
S311, do not need upgrade AJAX data cached.Buffer update flow process terminates, and directly can give application download request by data cached for this AJAX response.
S312, with return data replace AJAX data cached.Buffer update flow process terminates, and the data cached response of AJAX after replacement is given application download request.
It should be noted that, when concrete enforcement the technical program, above step S302, step S303, and following step S313, these 3 steps do not have sequencing relation.Step S303 to step S312 for receive application download request after, the flow process that renewal AJAX during this application download request of terminal response is data cached.After step S302 just starts web application, the step of downloading data in advance, this step can appear at any time after starting web application.Step S313 to step S317 is for forcing checking process, after this pressure checking process can appear at web application startup, verify the AJAX of last time startup web application download is data cached at once, also can be after web application starts, periodically verify data cached, can also be user send force verification instruction verify AJAX is data cached; Such as, user can by refreshing the pressure checking process of the action launching step S313 to step S317 of the webpage of browser.
The data cached request of pressure verification AJAX of S313, reception web application.
Terminal is according to the instruction of user, or the instruction of web application acquiescence, receives the data cached request of pressure verification AJAX that web application sends.Force in the data cached request of verification AJAX, can verify successively the AJAX of multiple application download requests of web application is data cached, also can verifying the AJAX of one of them application download request of web application is data cached, ensureing by forcing verification the correctness that the AJAX of web application is data cached.
The content authentication value that S314, acquisition AJAX are data cached, obtains random number, and the background server corresponding to web application sends the data check request comprising this content authentication value and random number.The form of the data check request of step S314 and S309 can be identical.
S315, judge that whether the content authentication value in the return data of background server is identical with the content authentication value of this data check request, if so, continue step S316, otherwise, continue step S317.
S316, do not need upgrade AJAX data cached.Buffer update flow process terminates.
S317, with return data replace AJAX data cached.Buffer update flow process terminates.
To sum up, the buffering updating method of the embodiment of the present invention, combine the data cached more new technological process of AJAX of embody rule download request and force checking process, force checking process can provide wrong update mechanism, Web application is frequently changed to back-end data, forces checking process effectively can ensure the data cached consistency with back-end data of AJAX; The data cached more new technological process of AJAX of embody rule download request only verifies web application and starts the data cached of front download, and that downloads after not verifying web application startup is data cached, ensures data cached correctness with less cost.
Please refer to Fig. 4, it is the method flow diagram of the 4th embodiment of the buffering updating method of the embodiment of the present invention.The present embodiment is mainly used in the system of terminal and the Web background server composition that can run web application.Compared with the present embodiment and said method first embodiment, mainly add background server content such as deal with data in terminal buffers renewal process.The method comprises:
S401, terminal start web application, the start-up time of record web application.
S402, terminal receive the application download request of web application.
Terminal is according to the instruction of user, or the instruction of web application acquiescence, receives the application download request that web application sends.
If the AJAX that S403 this locality stores application download request corresponding is data cached, the record background server during terminal acquisition AJAX is data cached issues the timestamp of time.
When background server issues data, can produce a time attribute, this time attribute can as the data cached timestamp of AJAX.Terminal judges local cache district store AJAX corresponding to application download request data cached time, then obtain the data cached timestamp of AJAX.
The AJAX of the embodiment of the present invention is data cached is preferably JSON form or XML format, and these two kinds of forms can support that complicated objectification stores; Certainly, can also be other form.
Whether the start-up time of S404, terminal judges web application is less than or equal to the data cached timestamp of AJAX, if so, continues step S405, otherwise, continue step S406.
S405, do not need upgrade AJAX data cached.Buffer update flow process terminates, and directly can give application download request by data cached for this AJAX response.
The start-up time of web application is less than or equal to the data cached timestamp of AJAX, illustrate AJAX data cached be open just download after web application data cached, therefore think effective, do not need School Affairs to upgrade.
S406, terminal send the data cached data check request of AJAX to the background server that application download request is corresponding.
The start-up time of web application is greater than the data cached timestamp of AJAX, illustrate AJAX data cached be open download before web application data cached, belong to the last data starting web application buffer memory, therefore need verification.
The data check request that the AJAX that S407, background server receiving terminal send is data cached, AJAX is data cached, according to check results to terminal return data in verification.
Whether background server compares AJAX data cached identical with back-end data, the correctness that verification AJAX is data cached, according to this check results to terminal return data.
It is data cached that S408, terminal upgrade AJAX according to the return data of background server.
Background server is to the backward terminal return data of the data cached verification of AJAX, and it is data cached that terminal upgrades AJAX according to return data, and then response application download request.
To sum up, the buffering updating method of the embodiment of the present invention, terminal only verifies web application and starts the data cached of front download, background server verifies that this is data cached, upgrade the data cached of download before web application startup, terminal does not verify the data cached of the rear download of web application startup, does not need to upgrade the data cached of the rear download of web application startup, thus effectively with background server synchronized update data, ensure data cached correctness with less cost.
Please refer to Fig. 5, it is the method flow diagram of the 5th embodiment of the buffering updating method of the embodiment of the present invention.The present embodiment is mainly used in the system of terminal and the Web background server composition that can run web application.Compared with the present embodiment and said method second embodiment, mainly add background server content such as deal with data in terminal buffers renewal process and in terminal downloads data procedures.The method comprises:
S501, terminal start web application, the start-up time of record web application.
S502, terminal send data download request to the background server that web application is corresponding.
S503, background server return the data of corresponding data download request to terminal.
It is data cached that S504, terminal are stored as AJAX the return data of background server in step S503.This return data comprises timestamp and the content authentication value that record background server issues the time.Timestamp and content authentication value are two attributes of return data.
Step S502 to step S504 belongs to the flow process of downloading data in advance, can be to be specified by web application, also can be set by the user.
It should be noted that, when concrete enforcement the technical program, this step S502 and following steps S505 does not have sequencing relation.Step S505 to step S512 is after terminal receives application download request, to the flow process should applying download request and carry out the data cached renewal of AJAX; And step S502 to step S504 belongs to terminal and starts after web application, the flow process of downloading data in advance, this flow process can appear at any time after starting web application.
S505, terminal receive the application download request of web application.
S506, judge that the local AJAX whether storing application download request corresponding is data cached, if so, continue step S510, otherwise, continue step S507.
If the AJAX that S507 this locality does not store application download request corresponding is data cached, terminal sends data download request to the background server that application download request is corresponding.
S508, background server return the data of corresponding data download request to terminal.
It is data cached that S509, terminal are stored as AJAX the return data of background server.This return data comprises timestamp and the content authentication value that record background server issues the time.
If the AJAX that S510 this locality stores application download request corresponding is data cached, the record background server during acquisition AJAX is data cached issues the timestamp of time.
S511, judge whether the start-up time of web application is less than or equal to the data cached timestamp of AJAX, if so, continue step S512, otherwise, continue step S513.
S512, do not need upgrade AJAX data cached.
Judge whether the start-up time of web application is less than or equal to the data cached timestamp of AJAX, illustrate AJAX data cached be open just download after web application data cached, therefore think effective, do not need verification.
Content authentication value during S513, acquisition AJAX are data cached, obtains random number, sends the data check request of the data cached content check value of AJAX and random number to the background server that application download request is corresponding.
The start-up time of web application is greater than the data cached timestamp of AJAX, illustrate AJAX data cached be open download before web application data cached, belong to the last data starting web application buffer memory, therefore need verification.
S514, background server receive the data cached data check request of AJAX, and AJAX is data cached, according to check results to terminal return data in verification.
In the embodiment of the present invention, background server receives the data cached data check request comprising this content authentication value of AJAX, judge that whether the content authentication code of the back-end data that this data check request is corresponding is identical with the content authentication value in data check request, if, verify out AJAX correctly data cached, return the data of content check value to terminal; Otherwise, verify out AJAX data cached incorrect, return to terminal and comprise timestamp, the content authentication value of back-end data, the data of this back-end data that record background server issues the time.
Whether the content authentication value in the return data of S515, terminal judges background server is identical with the content authentication value of data check request, if so, continues step S516, otherwise, continue step S517.
S516, do not need upgrade AJAX data cached.
Content authentication value in the return data that terminal receives is identical with the content authentication value of data check request, illustrates that AJAX is data cached identical with the back-end data of background server, therefore does not need to upgrade, and front end javaScript can directly abandon this return data.
S517, with return data replace AJAX data cached.
Content authentication value in the return data that terminal receives is not identical with the content authentication value of data check request, illustrate that AJAX is data cached not identical with the back-end data of background server, therefore it is data cached to replace AJAX with return data, upgrades data cached.
To sum up, the buffering updating method of the embodiment of the present invention, terminal can be carried out in advance from background server downloading data after starting web application, when receiving the application download request of web application, judge this in advance downloading data and front one-shot web application download data cached in whether have this application download request corresponding AJAX data cached, if do not had, then arrive background server to download, if had, what only verification was downloaded before the web application of terminal starts is data cached, do not verify and start the data cached of rear download at web application, background server data cachedly to verify this, data cached with the AJAX of more new terminal.Embodiment of the present invention terminal can be effectively data cached with background server synchronized update, ensures data cached correctness with less cost.
Please refer to Fig. 6, it is the schematic flow sheet of the 6th embodiment of the buffering updating method of the embodiment of the present invention.The present embodiment is mainly used in the system of terminal and the Web background server composition that can run web application.The present embodiment is mainly from the data interaction forcing checking process and AJAX data cached renewal process description terminal and background server, compared with said method the 3rd embodiment, mainly add background server in terminal downloads data procedures and buffer memory to force in checking procedure the contents such as deal with data.
The method combines the data cached more new technological process of AJAX forcing checking process and embody rule download request, and after starting web application, the start-up time of record web application, terminal enters two flow processs below respectively according to applicable cases.
A, when terminal open application program require force verification or refresh application time, enter pressure checking process, comprising:
The data cached request of pressure verification AJAX of A1, reception web application.
The content authentication value that A2, acquisition AJAX are data cached, obtains random number, and the background server corresponding to web application sends the data check request comprising this content authentication value and random number.
A3, background server receive the data cached data check request of AJAX, and AJAX is data cached, according to check results to terminal return data in verification.
Background server receives the data cached data check request comprising this content authentication value of AJAX, judge that whether the content authentication code of the back-end data that this data check request is corresponding is identical with the content authentication value in data check request, if, verify out AJAX correctly data cached, return the data of content check value to terminal; Otherwise, verify out AJAX data cached incorrect, return to terminal and comprise timestamp, the content authentication value of back-end data, the data of this back-end data that record background server issues the time.
It is data cached that A4, terminal upgrade AJAX according to the return data of background server.
Concrete, whether the content authentication value in the return data of terminal judges background server is identical with the content authentication value of this data check request, if so, do not need to upgrade AJAX data cached, otherwise, replace AJAX with return data data cached.
B, when terminal receive application download request time, enter the data cached more new technological process of AJAX, comprising:
B1, terminal receive the application download request of web application, judge whether this locality stores corresponding AJAX data cached by query caching.
If the AJAX that B2 this locality does not store application download request corresponding is data cached, terminal sends data download request to the background server that application download request is corresponding, continues step B3, B4.
B3, background server return the data of corresponding application download request to terminal.
B4, that the return data of background server is stored as AJAX is data cached.
If the AJAX that B5 this locality stores application download request corresponding is data cached, and is less than or equal to AJAX data cached timestamp start-up time, do not need to upgrade AJAX data cached, forward end shows that this AJAX is data cached.
If the AJAX that B6 this locality stores application download request corresponding is data cached, and be greater than AJAX data cached timestamp start-up time, terminal sends the data check request of the data cached content check value of AJAX and random number to the background server that application download request is corresponding, continues step B7, B8.
B7, background server receive the data cached data check request of AJAX, and AJAX is data cached, according to check results to terminal return data in verification.
Whether the content authentication value in the return data of B8, terminal judges background server is identical with the content authentication value of data check request, if so, do not need to upgrade AJAX data cached, otherwise, replace AJAX with return data data cached.
To sum up, the buffering updating method of the embodiment of the present invention, the data cached more new technological process of AJAX in conjunction with embody rule download request and pressure checking process, terminal and background server carry out data interaction, force checking process can provide wrong update mechanism, Web application is frequently changed to back-end data, forces checking process effectively can ensure the data cached consistency with back-end data of AJAX; The data cached more new technological process of AJAX of embody rule download request only verifies web application and starts the data cached of front download, and that downloads after not verifying web application startup is data cached, ensures data cached correctness with less cost.
Be below device embodiment and the system embodiment of the embodiment of the present invention, embodiment of the method for the present invention, device embodiment, system embodiment belong to same design, the detail content of not detailed description in device embodiment, system embodiment, can with reference to said method embodiment.
Please refer to Fig. 7, it is the block diagram of terminal first embodiment for performing buffering updating method of the embodiment of the present invention.This terminal comprises:
Application program launching unit 701, for starting web application, the start-up time of record web application;
Download request receiving element 702, for receiving the application download request of web application;
Timestamp acquiring unit 703, if it is data cached to store for this locality the AJAX applying download request corresponding, the record background server during acquisition AJAX is data cached issues the timestamp of time;
First check request transmitting element 704, for judging whether start-up time is less than or equal to timestamp, if so, does not need to upgrade AJAX data cached; Otherwise, send the data cached data check request of AJAX to the background server that application download request is corresponding;
First data cached updating block 705, data cached for upgrading AJAX according to the return data of background server.
To sum up, the terminal of the embodiment of the present invention, what only verification web application was downloaded before starting is data cached, before starting web application, the data cached of download upgrades, do not verify web application and start the data cached of rear download, do not need upgrade web application start after download data cached, thus effectively with background server synchronized update data, ensure data cached correctness with less cost.
Please refer to Fig. 8, it is the block diagram of terminal second embodiment for performing buffering updating method of the embodiment of the present invention.The present embodiment is on the basis of above-mentioned terminal first embodiment, mainly adds to background server downloading data, forces the contents such as verification.This terminal comprises:
Application program launching unit 701, for starting web application, the start-up time of record web application;
Download request receiving element 702, for receiving the application download request of web application;
Timestamp acquiring unit 703, if it is data cached to store for this locality the AJAX applying download request corresponding, the record background server during acquisition AJAX is data cached issues the timestamp of time;
First check request transmitting element 704, for judging whether start-up time is less than or equal to timestamp, if so, does not need to upgrade AJAX data cached; Otherwise, send the data cached data check request of AJAX to the background server that application download request is corresponding;
First data cached updating block 705, data cached for upgrading AJAX according to the return data of background server.
Preferably, terminal also comprises the first check value acquiring unit 706:
First check value acquiring unit 706, before sending the data cached data check request of AJAX for the background server corresponding to application download request, the content authentication value during acquisition AJAX is data cached;
Timestamp acquiring unit 703, if it is data cached to store specifically for this locality the AJAX applying download request corresponding, sends the data cached data check request comprising this content authentication value of AJAX to the background server that application download request is corresponding.
Preferably, the first data cached updating block 705, specifically for judging that whether the content authentication value in the return data of background server is identical with the content authentication value of data check request, if so, does not need to upgrade AJAX data cached; Otherwise, replace AJAX with return data data cached.
Preferably, terminal also comprises the first random number acquiring unit 707:
First random number acquiring unit 707, before sending the data cached data check request of AJAX, obtains random number for the background server corresponding to application download request;
Timestamp acquiring unit 703, if it is data cached to store specifically for this locality the AJAX applying download request corresponding, sends the data cached data check request comprising this content authentication value and random number of AJAX to the background server that application download request is corresponding.
Preferably, AJAX is data cached is JSON form or XML format.
Preferably, terminal also comprises application download unit 709:
Application download unit 709, sends data download request for the background server corresponding to web application, the return data of background server is stored as AJAX data cached;
Wherein, this return data comprises timestamp and the content authentication value that record background server issues the time.
Preferably, terminal also comprises data download unit 708:
Data download unit 708, if it is data cached not store for this locality the AJAX applying download request corresponding, the background server corresponding to application download request sends data download request, the return data of background server is stored as AJAX data cached;
Wherein, this return data comprises timestamp and the content authentication value that record background server issues the time.
Preferably, terminal also comprises the data cached updating block 714 of pressure check request receiving element 710, second check value acquiring unit 711, second check request transmitting element 713, second:
Force check request receiving element 710, for receiving the data cached request of pressure verification AJAX of web application;
Second check value acquiring unit 711, for obtain AJAX corresponding to web application data cached in content authentication value;
Second check request transmitting element 713, sends for the background server corresponding to web application the data check request comprising this content authentication value;
Second data cached updating block 714, for judging that whether the content authentication value in the return data of background server is identical with the content authentication value of this data check request, if so, do not upgrade AJAX data cached; Otherwise, replace AJAX with return data data cached.
Preferably, terminal also comprises the second random number acquiring unit 712:
Second random number acquiring unit 712, before comprising the data check request of this content authentication value, obtains random number for the background server transmission corresponding to web application;
Second check request transmitting element 713, sends specifically for the background server corresponding to web application the data check request comprising this content authentication value and random number.
To sum up, the terminal of the embodiment of the present invention, combine the data cached more new technological process of AJAX of embody rule download request and force checking process, force checking process can provide wrong update mechanism, Web application is frequently changed to back-end data, forces checking process effectively can ensure the data cached consistency with back-end data of AJAX; The data cached more new technological process of AJAX of embody rule download request only verifies web application and starts the data cached of front download, and that downloads after not verifying web application startup is data cached, ensures data cached correctness with less cost.
Please refer to Fig. 9, it is the block diagram of system first embodiment for performing buffering updating method of the embodiment of the present invention.The present embodiment, compared with above-mentioned terminal first embodiment, adds background server 800 content.
This system comprises terminal 700 and background server 800, terminal 700 comprises application program launching unit 701, download request receiving element 702, the data cached updating block 705 of timestamp acquiring unit 703, first check request transmitting element 704, first, and background server 800 comprises the first data check unit 801:
Application program launching unit 701, for starting web application, the start-up time of record web application;
Download request receiving element 702, for receiving the application download request of web application;
Timestamp acquiring unit 703, if it is data cached to store AJAX corresponding to application download request for this locality, terminal 700 obtain AJAX data cached in record background server 800 issue the timestamp of time;
For terminal 700, first check request transmitting element 704, judges whether start-up time is less than or equal to timestamp, if so, do not need to upgrade AJAX data cached; Otherwise the background server 800 corresponding to application download request sends the data cached data check request of AJAX;
First data check unit 801, for receiving the data cached data check request of AJAX, AJAX is data cached, according to check results to terminal 700 return data in verification;
First data cached updating block 705, data cached for upgrading AJAX according to the return data of background server 800.
To sum up, the system of the embodiment of the present invention, that downloads before 700, terminal verification web application starts is data cached, background server 800 verifies that this is data cached, upgrade the data cached of download before web application startup, terminal 700 does not verify the data cached of the rear download of web application startup, does not need to upgrade the data cached of the rear download of web application startup, thus effectively with background server 800 synchronized update data, ensure data cached correctness with less cost.
Please refer to Figure 10, it is the block diagram of system second embodiment for performing buffering updating method of the embodiment of the present invention.The present embodiment, compared with above-mentioned terminal second embodiment, adds background server 800 content.
This system comprises terminal 700 and background server 800, terminal 700 comprises application program launching unit 701, download request receiving element 702, the data cached updating block 705 of timestamp acquiring unit 703, first check request transmitting element 704, first, and background server 800 comprises the first data check unit 801:
Application program launching unit 701, for starting web application, the start-up time of record web application;
Download request receiving element 702, for receiving the application download request of web application;
Timestamp acquiring unit 703, if it is data cached to store AJAX corresponding to application download request for this locality, terminal 700 obtain AJAX data cached in record background server 800 issue the timestamp of time;
For terminal 700, first check request transmitting element 704, judges whether start-up time is less than or equal to timestamp, if so, do not need to upgrade AJAX data cached; Otherwise the background server 800 corresponding to application download request sends the data cached data check request of AJAX;
First data check unit 801, for receiving the data cached data check request of AJAX, AJAX is data cached, according to check results to terminal 700 return data in verification;
First data cached updating block 705, data cached for upgrading AJAX according to the return data of background server 800.
Preferably, terminal 700 also comprises the first check value acquiring unit 706:
Before first check value acquiring unit 706 sends the data cached data check request of AJAX for the background server 800 corresponding to application download request, the content authentication value during acquisition AJAX is data cached;
Timestamp acquiring unit 703, sends the data cached data check request comprising this content authentication value of AJAX specifically for the background server 800 corresponding to application download request;
First data check unit 801, the data cached data check request comprising this content authentication value of AJAX is received specifically for background server 800, judge that whether the content authentication code of the back-end data that this data check request is corresponding is identical with the content authentication value in data check request, if, verify out AJAX correctly data cached, return the data of content check value to terminal 700; Otherwise, verify out AJAX data cached incorrect, return to terminal 700 and comprise timestamp, the content authentication value of back-end data, the data of this back-end data that record background server 800 issues the time.
Preferably, the first data cached updating block 705, judges that specifically for terminal 700 whether the content authentication value in the return data of background server 800 is identical with the content authentication value of data check request, if so, does not need to upgrade AJAX data cached; Otherwise, replace AJAX with return data data cached.
Preferably, terminal 700 also comprises the first random number acquiring unit 707:
First random number acquiring unit 707, before sending the data cached data check request of AJAX, obtains random number for the background server 800 corresponding to application download request;
Timestamp acquiring unit 703, sends the data cached data check request comprising this content authentication value and random number of AJAX specifically for the background server 800 corresponding to application download request.
Preferably, AJAX is data cached is JSON form or XML format.
Preferably, terminal 700 also comprises application download unit 709, and background server 800 also comprises application and downloads response unit 802:
Application download unit 709, sends data download request for the background server 800 corresponding to web application, the return data of background server 800 is stored as AJAX data cached;
Response unit 802 is downloaded in application, for returning the data of corresponding data download request to terminal 700;
Wherein, this return data comprises timestamp and the content authentication value that record background server 800 issues the time.
Preferably, terminal 700 also comprises data download unit 708, and background server 800 also comprises data and downloads response unit 803:
Data download unit 708, if the AJAX not storing application download request corresponding for this locality is data cached, terminal 700 sends data download request to the background server 800 that application download request is corresponding, the return data of background server 800 is stored as AJAX data cached;
Data download response unit 803, for returning the data of corresponding data download request to terminal 700;
Wherein, this return data comprises timestamp and the content authentication value that record background server 800 issues the time.
Preferably, terminal 700 also comprises forces the data cached updating block 714 of check request receiving element 710, second check value acquiring unit 711, second check request transmitting element 713, second, and background server 800 also comprises the second data check unit 804:
Force check request receiving element 710, for receiving the data cached request of pressure verification AJAX of web application;
Second check value acquiring unit 711, for obtain AJAX corresponding to web application data cached in content authentication value;
Second check request transmitting element 713, sends for the background server 800 corresponding to web application the data check request comprising this content authentication value;
Second data check unit 804, for receiving the data cached data check request comprising this content authentication value of AJAX, judge that whether the content authentication code of the back-end data that this data check request is corresponding is identical with the content authentication value in data check request, if, verify out AJAX correctly data cached, return the data of content check value to terminal 700; Otherwise, verify out AJAX data cached incorrect, return to terminal 700 and comprise timestamp, the content authentication value of back-end data, the data of this back-end data that record background server 800 issues the time;
Second data cached updating block 714, for judging that whether the content authentication value in the return data of background server 800 is identical with the content authentication value of this data check request, if so, do not upgrade AJAX data cached; Otherwise, replace AJAX with return data data cached.
Preferably, terminal 700 also comprises the second random number acquiring unit 712:
Second random number acquiring unit 712, before sending and comprise the data check request of this content authentication value, obtains random number for terminal 700 to background server 800 corresponding to web application;
Second check request transmitting element 713, sends specifically for the background server 800 corresponding to web application the data check request comprising this content authentication value and random number.
To sum up, the system of the embodiment of the present invention, the data cached more new technological process of AJAX in conjunction with embody rule download request and pressure checking process, terminal 700 and background server 800 carry out data interaction, force checking process can provide wrong update mechanism, Web application is frequently changed to back-end data, forces checking process effectively can ensure the data cached consistency with back-end data of AJAX; The data cached more new technological process of AJAX of embody rule download request only verifies web application and starts the data cached of front download, and that downloads after not verifying web application startup is data cached, ensures data cached correctness with less cost.
The embodiment of the present invention also provides a kind of terminal, this terminal comprises: memory, one or more than one processor and one or more than one program, more than one or one program is stored in memory, more than one or one program is used for execution buffering updating method by one or more than one processor, and the method comprises:
Start web application, the start-up time of record web application;
Receive the application download request of web application;
If the AJAX that this locality stores application download request corresponding is data cached, the record background server during acquisition AJAX is data cached issues the timestamp of time;
Judge whether start-up time is less than or equal to timestamp, if so, do not need to upgrade AJAX data cached; Otherwise, send the data cached data check request of AJAX to the background server that application download request is corresponding, upgrade AJAX according to the return data of background server data cached.
Preferably, before sending the data cached data check request of AJAX to the background server that application download request is corresponding, method also comprises: the content authentication value during acquisition AJAX is data cached;
Send the data cached data check request of AJAX to the background server that application download request is corresponding, be specially:
The data cached data check request comprising this content authentication value of AJAX is sent to the background server that application download request is corresponding.
Preferably, upgrade AJAX according to the return data of background server data cached, comprising:
Judge that whether the content authentication value in the return data of background server is identical with the content authentication value of data check request, if so, do not need to upgrade AJAX data cached; Otherwise, replace AJAX with return data data cached.
Preferably, before sending the data cached data check request of AJAX to the background server that application download request is corresponding, method also comprises: obtain random number;
Send the data cached data check request comprising this content authentication value of AJAX to the background server that application download request is corresponding, be specially:
The data cached data check request comprising this content authentication value and random number of AJAX is sent to the background server that application download request is corresponding.
Preferably, AJAX is data cached is JSON form or XML format.
Preferably, method also comprises:
The background server corresponding to web application sends data download request, the return data of background server is stored as AJAX data cached;
Wherein, this return data comprises timestamp and the content authentication value that record background server issues the time.
Preferably, method also comprises:
If the AJAX that this locality does not store application download request corresponding is data cached, the background server corresponding to application download request sends data download request, the return data of background server is stored as AJAX data cached;
Wherein, this return data comprises timestamp and the content authentication value that record background server issues the time.
Preferably, start web application, after the start-up time of record web application, method also comprises:
Receive the data cached request of pressure verification AJAX of web application;
Content authentication value during the AJAX that acquisition web application is corresponding is data cached, the background server corresponding to web application sends the data check request comprising this content authentication value;
Judge that whether the content authentication value in the return data of background server is identical with the content authentication value of this data check request, if so, do not upgrade AJAX data cached; Otherwise, return data is replaced AJAX data cached.
Preferably, before comprising the data check request of this content authentication value to the background server transmission that web application is corresponding, method also comprises: obtain random number;
The background server corresponding to web application sends the data check request comprising this content authentication value, is specially:
The background server corresponding to web application sends the data check request comprising this content authentication value and random number.
To sum up, the terminal of the embodiment of the present invention, what only verification web application was downloaded before starting is data cached, before starting web application, the data cached of download upgrades, do not verify web application and start the data cached of rear download, do not need upgrade web application start after download data cached, thus effectively with background server synchronized update data, ensure data cached correctness with less cost.
One of ordinary skill in the art will appreciate that all or part of step realizing above-described embodiment can have been come by hardware, the hardware that also can carry out instruction relevant by program completes, this program can be stored in a computer-readable recording medium, and storage medium can comprise memory, disk or CD etc.
Above content is only preferred embodiment of the present invention, and for those of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, this description should not be construed as limitation of the present invention.

Claims (32)

1. a buffering updating method, is characterized in that, comprising:
Start web application, record the start-up time of described web application;
Receive the application download request of described web application;
If the AJAX that this locality stores described application download request corresponding is data cached, obtain described AJAX data cached in record background server issue the timestamp of time;
Judge whether described start-up time is less than or equal to described timestamp, if so, do not need to upgrade described AJAX data cached; Otherwise, send the data cached data check request of described AJAX to the background server that described application download request is corresponding, upgrade described AJAX according to the return data of described background server data cached.
2. method according to claim 1, is characterized in that, the described background server corresponding to described application download request also comprises before sending the data cached data check request of described AJAX: obtain described AJAX data cached in content authentication value;
The described background server corresponding to described application download request sends the data cached data check request of described AJAX, is specially:
The data cached data check request comprising this content authentication value of described AJAX is sent to the background server that described application download request is corresponding.
3. method according to claim 2, is characterized in that, it is data cached that the described return data according to described background server upgrades described AJAX, comprising:
Judge that whether the content authentication value in the return data of described background server is identical with the content authentication value of data check request, if so, do not need to upgrade described AJAX data cached; Otherwise, described return data is replaced described AJAX data cached.
4. method according to claim 2, is characterized in that, the described background server corresponding to described application download request also comprises before sending the data cached data check request of described AJAX: obtain random number;
The described background server corresponding to described application download request sends the data cached data check request comprising this content authentication value of described AJAX, is specially:
The data cached data check request comprising this content authentication value and random number of described AJAX is sent to the background server that described application download request is corresponding.
5. method according to claim 1, is characterized in that, before the application download request of the described web application of described reception, also comprises:
The background server corresponding to described web application sends data download request, the return data of described background server is stored as AJAX data cached;
Wherein, this return data comprises timestamp and the content authentication value that record background server issues the time.
6. method according to claim 1, is characterized in that, after the application download request of the described web application of described reception, also comprises:
If the AJAX that this locality does not store described application download request corresponding is data cached, the background server corresponding to described application download request sends data download request, the return data of described background server is stored as AJAX data cached;
Wherein, this return data comprises timestamp and the content authentication value that record background server issues the time.
7. method according to claim 1, is characterized in that, described startup web application, after recording the start-up time of described web application, also comprises:
Receive the data cached request of pressure verification AJAX of described web application;
Obtain described AJAX corresponding to described web application data cached in content authentication value, send the data check request comprising this content authentication value to background server corresponding to described web application;
Judge that whether the content authentication value in the return data of described background server is identical with the content authentication value of this data check request, if so, do not upgrade described AJAX data cached; Otherwise, described return data is replaced described AJAX data cached.
8. method according to claim 7, is characterized in that, the described background server corresponding to described web application also comprises before sending and comprising the data check request of this content authentication value: obtain random number;
The described background server corresponding to described web application sends the data check request comprising this content authentication value, is specially:
The background server corresponding to described web application sends the data check request comprising this content authentication value and random number.
9. a buffering updating method, is characterized in that, comprising:
Terminal starts web application, records the start-up time of described web application;
Terminal receives the application download request of described web application;
If the AJAX that this locality stores described application download request corresponding is data cached, terminal obtain described AJAX data cached in record background server issue the timestamp of time;
Whether start-up time described in terminal judges is less than or equal to described timestamp, if so, does not need to upgrade described AJAX data cached; Otherwise, send the data cached data check request of described AJAX to the background server that described application download request is corresponding;
Background server receives the data cached data check request of described AJAX, verifies described AJAX data cached, according to check results to terminal return data;
It is data cached that terminal upgrades described AJAX according to the return data of described background server.
10. method according to claim 9, is characterized in that, the described background server corresponding to described application download request also comprises before sending the data cached data check request of described AJAX: obtain described AJAX data cached in content authentication value;
The described background server corresponding to described application download request sends the data cached data check request of described AJAX, is specially:
The data cached data check request comprising this content authentication value of described AJAX is sent to the background server that described application download request is corresponding;
Described background server receives the data cached data check request of described AJAX, verifies described AJAX data cached, according to check results to terminal return data, comprising:
Background server receives the data cached data check request comprising this content authentication value of described AJAX, judge that whether the content authentication code of the back-end data that this data check request is corresponding is identical with the content authentication value in data check request, if, verify out described AJAX correctly data cached, return the data of content check value to terminal; Otherwise, verify out described AJAX data cached incorrect, return to terminal and comprise timestamp, the content authentication value of back-end data, the data of this back-end data that record background server issues the time.
11. methods according to claim 10, is characterized in that, it is data cached that described terminal upgrades described AJAX according to the return data of described background server, comprising:
Whether the content authentication value in the return data of background server described in terminal judges is identical with the content authentication value of data check request, if so, do not need to upgrade described AJAX data cached; Otherwise, described return data is replaced described AJAX data cached.
12. methods according to claim 10, is characterized in that, the described background server corresponding to described application download request also comprises before sending the data cached data check request of described AJAX: obtain random number;
The described background server corresponding to described application download request sends the data cached data check request comprising this content authentication value of described AJAX, is specially:
The data cached data check request comprising this content authentication value and random number of described AJAX is sent to the background server that described application download request is corresponding.
13. methods according to claim 9, is characterized in that, described terminal also comprises before receiving the application download request of described web application:
Terminal sends data download request to the background server that described web application is corresponding;
Background server returns the data of corresponding described data download request to terminal;
It is data cached that terminal is stored as AJAX the return data of described background server;
Wherein, this return data comprises timestamp and the content authentication value that record background server issues the time.
14. methods according to claim 9, is characterized in that, described terminal also comprises after receiving the application download request of described web application:
If the AJAX that this locality does not store described application download request corresponding is data cached, terminal sends data download request to the background server that described application download request is corresponding;
Background server returns the data of corresponding described data download request to terminal;
It is data cached that terminal is stored as AJAX the return data of described background server;
Wherein, this return data comprises timestamp and the content authentication value that record background server issues the time.
15. methods according to claim 9, is characterized in that, described terminal starts web application, after recording the start-up time of described web application, also comprises:
Terminal receives the data cached request of pressure verification AJAX of described web application;
Terminal obtain described AJAX corresponding to described web application data cached in content authentication value, send the data check request comprising this content authentication value to background server corresponding to described web application;
Background server receives the data cached data check request comprising this content authentication value of described AJAX, judge that whether the content authentication code of the back-end data that this data check request is corresponding is identical with the content authentication value in data check request, if, verify out described AJAX correctly data cached, return the data of content check value to terminal; Otherwise, verify out described AJAX data cached incorrect, return to terminal and comprise timestamp, the content authentication value of back-end data, the data of this back-end data that record background server issues the time;
Whether the content authentication value in the return data of background server described in terminal judges is identical with the content authentication value of this data check request, if so, do not upgrade described AJAX data cached; Otherwise, described return data is replaced described AJAX data cached.
16. methods according to claim 15, is characterized in that, the described background server corresponding to described web application also comprises before sending and comprising the data check request of this content authentication value: obtain random number;
The described background server corresponding to described web application sends the data check request comprising this content authentication value, is specially:
The background server corresponding to described web application sends the data check request comprising this content authentication value and random number.
17. 1 kinds for performing the terminal of buffering updating method, is characterized in that, comprising:
Application program launching unit, for starting web application, records the start-up time of described web application;
Download request receiving element, for receiving the application download request of described web application;
Timestamp acquiring unit, if the AJAX storing described application download request corresponding for this locality is data cached, obtain described AJAX data cached in record background server issue the timestamp of time;
First check request transmitting element, for judging whether described start-up time is less than or equal to described timestamp, if so, does not need to upgrade described AJAX data cached; Otherwise, send the data cached data check request of described AJAX to the background server that described application download request is corresponding;
First data cached updating block, data cached for upgrading described AJAX according to the return data of described background server.
18. terminals according to claim 17, is characterized in that, also comprise the first check value acquiring unit:
First check value acquiring unit, before sending the data cached data check request of described AJAX for the background server corresponding to described application download request, obtain described AJAX data cached in content authentication value;
Described timestamp acquiring unit, if the AJAX storing described application download request corresponding specifically for this locality is data cached, send the data cached data check request comprising this content authentication value of described AJAX to the background server that described application download request is corresponding.
19. terminals according to claim 18, is characterized in that:
First data cached updating block, specifically for judging that whether the content authentication value in the return data of described background server is identical with the content authentication value of data check request, if so, does not need to upgrade described AJAX data cached; Otherwise, described return data is replaced described AJAX data cached.
20. terminals according to claim 18, is characterized in that, also comprise the first random number acquiring unit:
First random number acquiring unit, before sending the data cached data check request of described AJAX, obtains random number for the background server corresponding to described application download request;
Described timestamp acquiring unit, if the AJAX storing described application download request corresponding specifically for this locality is data cached, send the data cached data check request comprising this content authentication value and random number of described AJAX to the background server that described application download request is corresponding.
21. terminals according to claim 17, is characterized in that, also comprise application download unit:
Application download unit, sends data download request for the background server corresponding to described web application, the return data of described background server is stored as AJAX data cached;
Wherein, this return data comprises timestamp and the content authentication value that record background server issues the time.
22. terminals according to claim 17, is characterized in that, also comprise data download unit:
Data download unit, if the AJAX not storing described application download request corresponding for this locality is data cached, the background server corresponding to described application download request sends data download request, the return data of described background server is stored as AJAX data cached;
Wherein, this return data comprises timestamp and the content authentication value that record background server issues the time.
23. terminals according to claim 17, is characterized in that, also comprise and force check request receiving element, the second check value acquiring unit, the second check request transmitting element, the second data cached updating block:
Force check request receiving element, for receiving the data cached request of pressure verification AJAX of described web application;
Second check value acquiring unit, for obtain described AJAX corresponding to described web application data cached in content authentication value;
Second check request transmitting element, sends for the background server corresponding to described web application the data check request comprising this content authentication value;
Second data cached updating block, for judging that whether the content authentication value in the return data of described background server is identical with the content authentication value of this data check request, if so, do not upgrade described AJAX data cached; Otherwise, described return data is replaced described AJAX data cached.
24. terminals according to claim 23, is characterized in that, also comprise the second random number acquiring unit:
Second random number acquiring unit, before comprising the data check request of this content authentication value, obtains random number for the background server transmission corresponding to described web application;
Second check request transmitting element, sends specifically for the background server corresponding to described web application the data check request comprising this content authentication value and random number.
25. 1 kinds for performing the system of buffering updating method, it is characterized in that, comprise terminal and background server, terminal comprises application program launching unit, download request receiving element, timestamp acquiring unit, the first check request transmitting element, the first data cached updating block, and background server comprises the first data check unit:
Application program launching unit, for starting web application, records the start-up time of described web application;
Download request receiving element, for receiving the application download request of described web application;
Timestamp acquiring unit, if the AJAX storing described application download request corresponding for this locality is data cached, terminal obtain described AJAX data cached in record background server issue the timestamp of time;
Whether the first check request transmitting element, be less than or equal to described timestamp for start-up time described in terminal judges, if so, do not need to upgrade described AJAX data cached; Otherwise, send the data cached data check request of described AJAX to the background server that described application download request is corresponding;
First data check unit, for receiving the data cached data check request of described AJAX, verifies described AJAX data cached, according to check results to terminal return data;
First data cached updating block, data cached for upgrading described AJAX according to the return data of described background server.
26. systems according to claim 25, is characterized in that, described terminal also comprises the first check value acquiring unit:
Before first check value acquiring unit is used for sending the data cached data check request of described AJAX to the background server that described application download request is corresponding, obtain described AJAX data cached in content authentication value;
Described timestamp acquiring unit, sends the data cached data check request comprising this content authentication value of described AJAX specifically for the background server corresponding to described application download request;
First data check unit, the data cached data check request comprising this content authentication value of described AJAX is received specifically for background server, judge that whether the content authentication code of the back-end data that this data check request is corresponding is identical with the content authentication value in data check request, if, verify out described AJAX correctly data cached, return the data of content check value to terminal; Otherwise, verify out described AJAX data cached incorrect, return to terminal and comprise timestamp, the content authentication value of back-end data, the data of this back-end data that record background server issues the time.
27. systems according to claim 26, is characterized in that:
Described first data cached updating block, whether identical with the content authentication value of data check request specifically for the content authentication value in the return data of background server described in terminal judges, if so, do not need to upgrade described AJAX data cached; Otherwise, described return data is replaced described AJAX data cached.
28. systems according to claim 26, is characterized in that, described terminal also comprises the first random number acquiring unit:
First random number acquiring unit, before sending the data cached data check request of described AJAX, obtains random number for the background server corresponding to described application download request;
Described timestamp acquiring unit, sends the data cached data check request comprising this content authentication value and random number of described AJAX specifically for the background server corresponding to described application download request.
29. systems according to claim 25, is characterized in that, described terminal also comprises application download unit, and described background server also comprises application and downloads response unit:
Application download unit, sends data download request for the background server corresponding to described web application, the return data of described background server is stored as AJAX data cached;
Response unit is downloaded in application, for returning the data of corresponding described data download request to terminal;
Wherein, this return data comprises timestamp and the content authentication value that record background server issues the time.
30. systems according to claim 25, is characterized in that, described terminal also comprises data download unit, and described background server also comprises data and downloads response unit:
Data download unit, if the AJAX not storing described application download request corresponding for this locality is data cached, terminal sends data download request to the background server that described application download request is corresponding, the return data of described background server is stored as AJAX data cached;
Data download response unit, for returning the data of corresponding described data download request to terminal;
Wherein, this return data comprises timestamp and the content authentication value that record background server issues the time.
31. systems according to claim 25, it is characterized in that, described terminal also comprises forces check request receiving element, the second check value acquiring unit, the second check request transmitting element, the second data check unit, and described background server also comprises the second data check unit:
Force check request receiving element, for receiving the data cached request of pressure verification AJAX of described web application;
Second check value acquiring unit, for obtain described AJAX corresponding to described web application data cached in content authentication value;
Second check request transmitting element, sends for the background server corresponding to described web application the data check request comprising this content authentication value;
Second data check unit, for receiving the data cached data check request comprising this content authentication value of described AJAX, judge that whether the content authentication code of the back-end data that this data check request is corresponding is identical with the content authentication value in data check request, if, verify out described AJAX correctly data cached, return the data of content check value to terminal; Otherwise, verify out described AJAX data cached incorrect, return to terminal and comprise timestamp, the content authentication value of back-end data, the data of this back-end data that record background server issues the time;
Second data cached updating block, for judging that whether the content authentication value in the return data of described background server is identical with the content authentication value of this data check request, if so, do not upgrade described AJAX data cached; Otherwise, described return data is replaced described AJAX data cached.
32. systems according to claim 30, is characterized in that, described terminal also comprises the second random number acquiring unit:
Second random number acquiring unit, before sending and comprise the data check request of this content authentication value, obtains random number for described terminal to background server corresponding to described web application;
Second check request transmitting element, sends specifically for the background server corresponding to described web application the data check request comprising this content authentication value and random number.
CN201310221080.9A 2013-06-05 2013-06-05 Buffering updating method, terminal and system Active CN104219272B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310221080.9A CN104219272B (en) 2013-06-05 2013-06-05 Buffering updating method, terminal and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310221080.9A CN104219272B (en) 2013-06-05 2013-06-05 Buffering updating method, terminal and system

Publications (2)

Publication Number Publication Date
CN104219272A true CN104219272A (en) 2014-12-17
CN104219272B CN104219272B (en) 2018-08-03

Family

ID=52100402

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310221080.9A Active CN104219272B (en) 2013-06-05 2013-06-05 Buffering updating method, terminal and system

Country Status (1)

Country Link
CN (1) CN104219272B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106453667A (en) * 2016-12-20 2017-02-22 北京小米移动软件有限公司 Method and device for updating cached data
CN106649370A (en) * 2015-10-30 2017-05-10 北京国双科技有限公司 Acquisition method and device for website access information
CN113112564A (en) * 2020-01-13 2021-07-13 长沙市海图科技有限公司 Method, system and storage medium for CAD (computer-aided design) online calling WMTS (wireless multimedia transport service)
CN113810468A (en) * 2021-08-13 2021-12-17 济南浪潮数据技术有限公司 Method, system, device and storage medium for distributing request by gateway under K8s architecture

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20030083118A (en) * 2002-04-19 2003-10-30 엘지전자 주식회사 Method for software updating of optical disc record/player
US20040220924A1 (en) * 2002-02-14 2004-11-04 Wootton Steven Marlow System and method for updating a cache
CN102034059A (en) * 2010-12-02 2011-04-27 东莞宇龙通信科技有限公司 Method and device for managing application program and terminal
CN102624926A (en) * 2012-04-11 2012-08-01 中兴通讯股份有限公司 Method and system for fusion and openness of abilities
CN102779128A (en) * 2011-05-10 2012-11-14 北京磊友信息科技有限公司 Method and device for offline running of HTML5 (hypertext markup language 5) application program in mobile terminal
CN103064699A (en) * 2012-11-28 2013-04-24 镇江为天下信息服务有限公司 Method for quickly updating files in software upgrading process

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040220924A1 (en) * 2002-02-14 2004-11-04 Wootton Steven Marlow System and method for updating a cache
KR20030083118A (en) * 2002-04-19 2003-10-30 엘지전자 주식회사 Method for software updating of optical disc record/player
CN102034059A (en) * 2010-12-02 2011-04-27 东莞宇龙通信科技有限公司 Method and device for managing application program and terminal
CN102779128A (en) * 2011-05-10 2012-11-14 北京磊友信息科技有限公司 Method and device for offline running of HTML5 (hypertext markup language 5) application program in mobile terminal
CN102624926A (en) * 2012-04-11 2012-08-01 中兴通讯股份有限公司 Method and system for fusion and openness of abilities
CN103064699A (en) * 2012-11-28 2013-04-24 镇江为天下信息服务有限公司 Method for quickly updating files in software upgrading process

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106649370A (en) * 2015-10-30 2017-05-10 北京国双科技有限公司 Acquisition method and device for website access information
CN106453667A (en) * 2016-12-20 2017-02-22 北京小米移动软件有限公司 Method and device for updating cached data
CN106453667B (en) * 2016-12-20 2019-06-18 北京小米移动软件有限公司 Update data cached method and device
CN113112564A (en) * 2020-01-13 2021-07-13 长沙市海图科技有限公司 Method, system and storage medium for CAD (computer-aided design) online calling WMTS (wireless multimedia transport service)
CN113112564B (en) * 2020-01-13 2023-03-10 长沙市海图科技有限公司 Method, system and storage medium for CAD (computer-aided design) online calling WMTS (wireless multimedia transport service)
CN113810468A (en) * 2021-08-13 2021-12-17 济南浪潮数据技术有限公司 Method, system, device and storage medium for distributing request by gateway under K8s architecture
CN113810468B (en) * 2021-08-13 2023-04-18 济南浪潮数据技术有限公司 Method, system, equipment and storage medium for distributing requests by gateway under K8s architecture

Also Published As

Publication number Publication date
CN104219272B (en) 2018-08-03

Similar Documents

Publication Publication Date Title
CN104965717A (en) Method and apparatus for loading page
CN106649349B (en) Data caching method, device and system for game application
CN102521280B (en) Loading method and loading device of EPub electronic book
CN201682522U (en) Conversation information storage system and application server
CN103873502A (en) Cache updating method and system, and update resource providing method and system
US8516041B1 (en) Pre-fetching asynchronously requested content
CN104657170A (en) Data updating method, device and system
CN102385594A (en) Method and device for controlling inner cores of multi-core browser
CN107656937B (en) Method and device for realizing consistency of read-write data
CN107463613A (en) Page loading method and device
CN102456035A (en) Webpage resource cache control method, device and system
CN105338078A (en) Data storage method and device used for storing system
CN108932332A (en) The loading method and device of static resource
CN101656789A (en) Method for managing application information of mobile phone and application manager
WO2008112103A1 (en) Selectively updating web pages on a mobile client
CN103747074B (en) mobile monitoring system based on Web server
CN104219272A (en) Method, terminal and system for updating caches
CN104657401A (en) Web cache updating method
CN102647481A (en) Device and method for accessing preset network address
CN103051689A (en) Program updating downloading method and device
CN113259342A (en) Login verification method, device, computer equipment and medium
CN103440143A (en) System and method for upgrading mobile web application
CN111813851B (en) Method, system and mobile terminal for synchronizing data from mobile application to webpage
CN104133869A (en) Webpage page refreshing method
CN103390043A (en) Method for displaying network data and device for displaying network data

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant