The content of the invention
The purpose of the present invention is a kind of data cache method, device and computer-processing equipment, facilitates user browse data,
Improve user experience.
The purpose of the present invention is achieved through the following technical solutions:
A kind of data cache method, methods described include:
Obtain the solicited message of data;
Whether the data of inquiry request have caching;
If there being caching, cache policy is determined according to the type of the data of request;
Request of data result is obtained according to the cache policy of determination and shown.
Preferably, the cache policy includes frequent updating strategy;It is described to be asked according to the cache policy of determination acquisition data
The step of seeking result specifically includes:According to frequent updating strategy, after request of data result is obtained every time, according to request of data knot
Cached corresponding to fruit renewal.
Preferably, it is described according to frequent updating strategy, after request of data result is obtained every time, according to request of data result
The step of being cached corresponding to renewal specifically includes:
According to frequent updating strategy, network connection status is detected, if there is network connection, obtains request of data result and root
Corresponding cache is updated according to request of data result.
Preferably, it is described according to frequent updating strategy, after request of data result is obtained every time, according to request of data result
The step of being cached corresponding to renewal specifically includes:
According to frequent updating strategy, network connection status is detected, if without network connection, obtains history buffer data.
Preferably, the cache policy includes permanent cache policy;Methods described further comprises:If cache policy is forever
Long cache policy, then only once obtain request of data result and preserve.
Preferably, the cache policy includes timing cache policy;Methods described further comprises:If cache policy is fixed
When cache policy, then according to preset time obtain request of data, and according to request of data result renewal corresponding to cache.
Preferably, the cache policy includes overtime cache policy;It is described to be asked according to the cache policy of determination acquisition data
The step of seeking result specifically includes:According to overtime more new strategy, if sending request of data or obtaining request of data result institute's used time
Between exceed preset time, then obtain history buffer data.
Preferably, methods described further comprises:If the data for inquiring request do not have caching, preset buffer memory strategy
And request of data result is obtained according to preset buffer memory strategy.
A kind of computer-processing equipment, including processor and computer-readable recording medium, described in the processor obtains
Computer program on computer-readable recording medium, and perform as described above any methods described the step of.
A kind of data buffer storage device, including:
Acquisition module, for obtaining the solicited message of data;
Whether enquiry module, the data for inquiry request have caching;
Cache policy module, if for there being caching, cache policy is determined according to the type of the data of request;
Processing module, for obtaining request of data result according to the cache policy of determination and showing.
The present invention data cache method due to including:Obtain the solicited message of data;Whether the data of inquiry request deposit
There is caching;If there being caching, cache policy is determined according to the type of the data of request;Number is obtained according to the cache policy of determination
According to request results and show.In this way, after the data request information that user terminal obtains user, user terminal will be inquired about
Whether the data that user is asked locally are having caching, if there being caching, will be determined according to the type of the data of request
Cache policy, request of data result is then obtained according to the cache policy of determination and shows user, so as to according to not
With request of data type determine cache policy, the data that user needs are cached, facilitate user to view number in time
According to raising Consumer's Experience.
Embodiment
Although operations are described as the processing of order by flow chart, many of which operation can by concurrently,
Concomitantly or simultaneously implement.The order of operations can be rearranged.Processing can be terminated when its operations are completed,
It is also possible to the additional step being not included in accompanying drawing.Processing can correspond to method, function, code, subroutine, son
Program etc..
Computer equipment includes user equipment and the network equipment.Wherein, user equipment or client include but is not limited to electricity
Brain, smart mobile phone, PDA etc.;The network equipment includes but is not limited to the service of single network server, multiple webservers composition
Device group or the cloud being made up of a large amount of computers or the webserver based on cloud computing.Computer equipment can isolated operation realize
The present invention, it also can access network and the present invention realized by the interactive operation with other computer equipments in network.Calculate
Network residing for machine equipment includes but is not limited to internet, wide area network, Metropolitan Area Network (MAN), LAN, VPN etc..
Term " first ", " second " etc. are may have been used herein to describe unit, but these units should not
When limited by these terms, it is used for the purpose of making a distinction a unit with another unit using these terms.Here institute
The term "and/or" used includes any and all combination of the associated item listed by one of them or more.When one
Unit is referred to as " connecting " or during " coupled " to another unit, and it can be connected or coupled to another unit, or
There may be temporary location.
Term used herein above is not intended to limit exemplary embodiment just for the sake of description specific embodiment.Unless
Context clearly refers else, otherwise singulative used herein above "one", " one " also attempt to include plural number.Should also
When understanding, term " comprising " and/or "comprising" used herein above provide stated feature, integer, step, operation,
The presence of unit and/or component, and do not preclude the presence or addition of other one or more features, integer, step, operation, unit,
Component and/or its combination.
The invention will be further described with preferred embodiment below in conjunction with the accompanying drawings.
As shown in figure 1, a kind of data cache method, methods described include disclosed in the present embodiment:
S101, the solicited message for obtaining data;
Whether S102, the data of inquiry request have caching;
If S103, having caching, cache policy is determined according to the type of the data of request;
S104, request of data result is obtained according to the cache policy of determination and shown.
In this way, after the data request information that user terminal obtains user, user terminal will inquire about user and ask
Whether the data asked locally are having caching, if there being caching, will determine cache policy according to the type of the data of request,
Then request of data result is obtained according to the cache policy of determination and shows user, so as to be asked according to different data
Type is sought to determine cache policy, the data that user needs are cached, facilitates user to view data in time, improves user
Experience.
In the application scenarios of the present embodiment example, when user can use the software of installation on mobile terminals, such as using
The softwares such as microblogging, wechat, web browser, request of data can be that user clicks on refreshing or clicks on particular content, mobile terminal
Software after the data request information of user is received, will inquire about user request data whether have in the mobile terminal it is slow
Deposit, if having data cached, cache policy will be determined according to the type of the data of request, then user terminal will be according to true
Fixed cache policy sends the request of data acquisition to server, and server will basis after the request of user terminal transmission is obtained
Request content sends data, and user terminal can accordingly receives request of data result, can also shown after receiving, so as to convenient
User, which checks, to be browsed.Can be with the operation in other application scene, such as on other-end in the present embodiment, or apply not
In same program.
According to one of example, the cache policy includes frequent updating strategy;The cache policy according to determination
The step of obtaining request of data result specifically includes:According to frequent updating strategy, after request of data result is obtained every time, according to
Cached corresponding to the renewal of request of data result.
In the present embodiment, the request of data of network data is needed for some, such as MSN, web page browsing are soft
Part etc., it is necessary in real time more network data, therefore frequent updating strategy can be applied for the request of data of this kind of software, from
And request of data will be sent to server after the request of data of user is received every time, and after request of data result is obtained more
Cached corresponding to new, so as to ensure the real-time of data.Certainly, the request of data of not all this software all determines frequently
More new strategy, possible user log in these softwares merely to checking historical data etc., so normally only in the number asked
Just it is defined as frequent updating strategy during according to request of data for network data, can so saves network traffic data, be other
Network data reserves channel, facilitates data transfer, can also save the electricity of user terminal.
Specifically, it is described according to frequent updating strategy, after request of data result is obtained every time, according to request of data result
The step of being cached corresponding to renewal specifically includes:
According to frequent updating strategy, network connection status is detected, if there is network connection, obtains request of data result and root
Corresponding cache is updated according to request of data result.
In the case where network condition is good, the request of frequent updating can be met, to meet that user obtains the real-time of data
Property.
And for example, it is specifically, described according to frequent updating strategy, please according to data after request of data result is obtained every time
The step of being cached corresponding to result renewal is asked to specifically include:
According to frequent updating strategy, network connection status is detected, if without network connection, obtains history buffer data.
Network condition it is poor or without network connection in the case of, history buffer data can first be showed user,
First check or use for user.Request of data is being transmitted when network condition is preferable, is obtaining request of data result.
According to other in which example, the cache policy includes permanent cache policy;Methods described further comprises:If
Cache policy is permanent cache policy, then only once obtains request of data result and preserve.
The data of real-time, such as how many provincial unit of inquiry China are not needed in the present embodiment for some, certain
The area in individual province or area has much etc. information, it is possible to uses permanent cache policy.In this case only need to send
Data acquisition request, stored after then obtaining request of data result, such as be stored to can in caching, Zhi Houyong
When these data are inquired about at family again, it is possible to data are directly called from caching, so as to save the time, facilitate user to check in time
Data.
According to other in which example, the cache policy includes timing cache policy;Methods described further comprises:If
Cache policy is timing cache policy, then obtains request of data according to preset time, and update and correspond to according to request of data result
Caching.
Extra high data for some requirement of real-time in the present embodiment, for example, China population how many, certain
How is the weather conditions of city in a couple of days, can use timing cache policy.In this case can be set according to user default
Time timing sends data acquisition request, so as to timing acquisition to request of data result, then updates in caching, so as to both may be used
To ensure the real-time of data, network traffic data and user terminal electricity can also be saved.Preset time can be one month one
It is secondary, or weekly etc., if network condition is poor during preset time, can be delayed to network condition it is good when obtain transmission data
Request, so as to obtain request of data result.
According to other in which example, the cache policy includes overtime cache policy;The caching plan according to determination
The step of slightly obtaining request of data result specifically includes:, please if sending request of data or obtaining data according to overtime more new strategy
Ask the time used in result to exceed preset time, then obtain history buffer data.
If network condition is poor in the present embodiment, user terminal is in lasting transmission request of data or obtains request of data result
Time used has exceeded default time threshold, and user terminal will call history buffer data to carry out data display, so that
User can temporarily check historical data, and request of data is being transmitted when network condition is preferable, and obtaining data please
Seek result.
According to other in which example, methods described further comprises:If the data for inquiring request do not have caching,
Preset buffer memory strategy simultaneously obtains request of data result according to preset buffer memory strategy.
In the present embodiment if software be for the first time install or be cleaned data, the software also without cache data,
Cache policy will be so determined according to the data type that the software is asked, and request of data is sent according to the cache policy of determination
And obtain request of data result.
The reply only returned in the present embodiment to request is cached, and data list structure is preserved based on key assignments, in original
One layer is being added to do caching process in some network architectures, each request spells upper parameter and makees major key as the field of a uniqueness,
It is ensured that do not repeat to preserve.Without the concern for the data structure of complexity in the present embodiment, data are sent just for each request
Request results.
Different designs are made that to different cache policies, the demand difference of various requests in the present embodiment.Some is not required to
Cache a data of the needs under no net state in return once just, some, which simply requests once to return every time below, to be delayed
Deposit, temporally whether judgement time-out operates some again, is based on local perdurable data library storage in the present invention, has light weight
The mobile client database of level, convenient inquiry and retrospect.
A kind of computer-processing equipment disclosed in the present embodiment, including processor and computer-readable recording medium, it is described
Processor obtains the computer program on the computer-readable recording medium, and performs the step of any methods described as described above
Suddenly.
As shown in Fig. 2 a kind of data buffer storage device disclosed in the present embodiment, including:
Acquisition module 201, for obtaining the solicited message of data;
Whether enquiry module 202, the data for inquiry request have caching;
Cache policy module 203, if for there being caching, cache policy is determined according to the type of the data of request;
Processing module 204, for obtaining request of data result according to the cache policy of determination and showing.
In this way, after the data request information that user terminal obtains user, user terminal will inquire about user and ask
Whether the data asked locally are having caching, if there being caching, will determine cache policy according to the type of the data of request,
Then request of data result is obtained according to the cache policy of determination and shows user, so as to be asked according to different data
Type is sought to determine cache policy, the data that user needs are cached, facilitates user to view data in time, improves user
Experience.
In the application scenarios of the present embodiment example, when user can use the software of installation on mobile terminals, such as using
The softwares such as microblogging, wechat, web browser, request of data can be that user clicks on refreshing or clicks on particular content, mobile terminal
Software after the data request information of user is received, will inquire about user request data whether have in the mobile terminal it is slow
Deposit, if having data cached, cache policy will be determined according to the type of the data of request, then user terminal will be according to true
Fixed cache policy sends the request of data acquisition to server, and server will basis after the request of user terminal transmission is obtained
Request content sends data, and user terminal can accordingly receives request of data result, can also shown after receiving, so as to convenient
User, which checks, to be browsed.Can be with the operation in other application scene, such as on other-end in the present embodiment, or apply not
In same program.
Cache policy includes frequent updating strategy;In the present embodiment, the request of data of network data, example are needed for some
Such as MSN, web browser software etc., it is necessary to more network data, therefore please for the data of this kind of software in real time
Frequent updating strategy can be applied by asking, please so as to send data to server after the request of data of user is received every time
Ask, and corresponding caching is updated after request of data result is obtained, so as to ensure the real-time of data.Certainly, it is not all
The request of data of this software all determines frequent updating strategy, and possible user logs in these softwares merely to checking historical data
Etc., so being normally only just defined as frequent updating strategy when the data asked are the request of data of network data, so
Network traffic data can be saved, channel is reserved for other network datas, facilitates data transfer, the electricity of user terminal can also be saved
Amount.
Cache policy includes permanent cache policy;The data of real-time are not needed in the present embodiment for some, such as are looked into
How many provincial unit of China is ask, some is saved or the area in area has much etc. information, it is possible to using permanent caching
Strategy.In this case only need to send a data acquisition request, stored after then obtaining request of data result, such as
Can in caching is stored to, when user inquires about these data again afterwards, it is possible to data are directly called from caching, so as to
The time is saved, facilitates user to check data in time.
Cache policy includes timing cache policy;It is not extra high number for some requirement of real-time in the present embodiment
According to, for example, China population how many, the weather conditions of certain city in a couple of days are how, can use timing cache policy.It is this
In the case of data acquisition request can be sent according to the preset time timing that user is set, so as to which timing acquisition is to request of data knot
Fruit, then update in caching, so as to can both ensure the real-time of data, network traffic data and user terminal can also be saved
Electricity.Preset time can be one month once, or weekly etc., if network condition is poor during preset time, Ke Yiyan
When to network condition it is good when obtain transmission request of data, so as to obtain request of data result.
Cache policy includes overtime cache policy;If network condition is poor in the present embodiment, user terminal is in lasting transmission
Time used in request of data or acquisition request of data result has exceeded default time threshold, and user terminal will call history buffer
Data carry out data display, so that user can temporarily check historical data, are entering when network condition is preferable
Row sends request of data, obtains request of data result.
Different designs are made that to different cache policies, the demand difference of various requests in the present embodiment.Some is not required to
Cache a data of the needs under no net state in return once just, some, which simply requests once to return every time below, to be delayed
Deposit, temporally whether judgement time-out operates some again, is based on local perdurable data library storage in the present invention, has light weight
The mobile client database of level, convenient inquiry and retrospect.
Above content is to combine specific preferred embodiment further description made for the present invention, it is impossible to is assert
The specific implementation of the present invention is confined to these explanations.For general technical staff of the technical field of the invention,
On the premise of not departing from present inventive concept, some simple deduction or replace can also be made, should all be considered as belonging to the present invention's
Protection domain.