Specific embodiment
Here exemplary embodiment will be illustrated in detail, its example is illustrated in the accompanying drawings.Following description is related to
During accompanying drawing, unless otherwise indicated, the same numbers in different accompanying drawings represent same or analogous key element.Following exemplary embodiment
Described in implementation method do not represent all implementation methods consistent with the application.Conversely, they be only with it is such as appended
The example of the consistent apparatus and method of some aspects described in detail in claims, the application.
It is the purpose only merely for description specific embodiment in term used in this application, and is not intended to be limiting the application.
" one kind ", " described " and " being somebody's turn to do " of singulative used in the application and appended claims is also intended to include majority
Form, unless context clearly shows that other implications.It is also understood that term "and/or" used herein refers to and wraps
May be combined containing one or more associated any or all of project listed.
It will be appreciated that though various information, but this may be described using term first, second, third, etc. in the application
A little information should not necessarily be limited by these terms.These terms are only used for being distinguished from each other open same type of information.For example, not departing from
In the case of the application scope, the first information can also be referred to as the second information, and similarly, the second information can also be referred to as
One information.Depending on linguistic context, word as used in this " if " can be construed to " ... when " or " when ...
When " or " in response to determining ".
The application provide embodiment in, client as data inquiry request sender, server is used as data
The recipient of inquiry request, the client can be specially mobile phone, panel computer, notebook computer, desktop computer etc..Its
In, client can send data inquiry request when the data display page or refresh data displayed page is entered to server,
The data that inquiry is obtained are inquired about and returned to server after the data inquiry request is received, and client receives return
Data after be shown.
Example below in conjunction with a specific flowing water type data is illustrated, as shown in figure 1, inquiring about fund branch at one
In the scene for going out/taking in, user opens the stored value card app (Application, using journey installed on mobile phone (i.e. client)
Sequence), check nearest payment funding/income data by clicking on " bill " on mobile phone screen.Now, mobile phone can be to the electricity
The server of sub- wallet app sends billing data inquiry request, and billing data is returned after the server lookup, and the mobile phone connects
Show the billing data of return after receipts on screen.
The example in conjunction with a specific pipeline data is illustrated below, as shown in Fig. 2 inquiring about circle of friends at one
In the scene that good friend releases news, user opens the chat software installed on mobile phone (i.e. client), passes through on mobile phone screen
" circle of friends " is clicked on to check the information of nearest good friend's issue.Now, mobile phone can send friend to the server of the chat software
Circle information inquiring request, returns to circle of friends information after the server lookup, the mobile phone shows return after receiving on screen
Circle of friends information.
It should be noted that pipeline data is without modification function, once i.e. data genaration, can only be deleted, and
Can not modify.
Fig. 3 is referred to, is the flow chart of the data query method that the embodiment of the application one is provided, comprised the following steps:
Step 110:Client is received for inquiring about in target pages after the query statement of data, is read from local data source
The id set of data and the data in the target pages is taken, last inquiry mesh is preserved in the local data source
The data that server is returned during the mark page.
It is described to be typically what is triggered by user for inquiring about the query statement of data in target pages in the present embodiment, such as
In Fig. 2, after user clicks on " circle of friends ", it is possible to the query statement of data in triggering inquiry homepage (i.e. target pages), make
Client receives query statement for inquiring about data in homepage.
Again for example, in fig. 4, user want to know the information of " flying bird " issue before other friends issue information
When, lower page of data query statement, the refresh page if one page is not descended can be triggered by way of drop-down data list
Face.Similar, when user wants to know the information of other friends issue after the information of " Zhang San " issue, can also be by upper
Draw the mode of data list, triggering page up data query instruction, if without page up, triggering refresh page.
The data that server is returned when last inquiry target pages are preserved in the local data source.
General, each data can have an id, the unique mark of corresponding generation when the id is server record data.
Server return inquiry obtain data when can also carry the id so that in the local data source id of data with
It is consistent on server.
Generally, target pages can show multiple data, so data in the target pages under reading local data source
Id also can be multiple, the multiple id read under the local data source can be referred to as into an id collection in the present embodiment
Close.
Step 120:The user end to server sends data inquiry request, is carried in the data inquiry request described
First id gathers the quantity with the target pages display data.
Generally, the quantity for display data being capable of in target pages is limited.The bill page as shown in Figure 1 can show number
According to quantity be 5.The quantity for being capable of display data in the circle of friends page as shown in Figure 2 only has 3.
Step 130:After the server receives the data inquiry request, the page object is inquired about according to the quantity
The 2nd id set of data in face.
In the present embodiment, the server is receiving the data inquiry request for target pages of client transmission
Afterwards, so can according in the data inquiry request carry quantity target pages are inquired about in the server storage
Data, and obtain the 2nd id set of data.
The memory space of the server can be the memory space such as database of server itself, can also be and institute
State the external data base that the external memory space of server association is for example associated with server.
The inquiry can be with data in paging query, i.e. the server target pages according to the quantity paging query
2nd id gathers.It is assumed that the data are 3, target pages are page 2, then server enters with 3 for one page carries out paging
And search the 2nd id set of data in page 2.
Step 140:The 2nd id set that the server will be inquired is compared with id set.
In actual applications, it is same that the data for being recorded on server (such as newly-increased data, delete data) for some reason
Data can be with the difference of record in client in target pages.
Hereinafter refer to described in Fig. 5, before 5 minutes user enter circle of friends when as shown in the figure on the left side in Fig. 4, after 5 minutes
If user is by upper stroke data list refresh page, then homepage content is just in the local data source that client reads
" Zhang San ... ", " little Bai ... " and " flying fish ... ", it is assumed that id is respectively 7,6,5, then the client is to clothes
The id set that the data inquiry request that business device sends is carried is { 7,6,5 }.Generally, by after 5 minutes, may be different
Good friend issued new information, so the difference that the data that homepage is inquired on server will read with client.It is false
" elder sister " has issued an information " beans are had a meal quickly beans today in kindergarten, it is stated that also praised by teacher " before being located at 1 minute,
Information id is 8, then the 2nd id collection of server lookup to circle of friends homepage is combined into { 8,7,6 }.
Step 150:In the case where comparing and showing that id set and the 2nd id set have identical id, the clothes
When business device returns to Query Result to client, the data of the identical id are not returned.
The example in previous step is continued to use, because the 2nd id set { 8,7,6 } and id set { 7,6,5 } is with identical
Id:7 and 6;So when server returns to Query Result to client, the data that id is 7 and 6 are not returned to, it is 8 only to return to id
Data are " beans are had a meal quickly beans today in kindergarten, it is stated that also praised by teacher " of " elder sister " and " before one minute " issue.
Step 160:After the client receives the Query Result that the server is returned, read from local data source with described
Show after data are merged in the target pages got.
In the present embodiment, continue to continue to use the example with previous step, client receives the inquiry of server return
Result is " beans are had a meal quickly beans today in kindergarten, it is stated that also praised by teacher " of " elder sister " issue, and the id of the information is
8。
Client reads in local data source and obtains data and be:
Id is 7, " Zhang San ... ";
Id is 6, " little Bai ... ";
Id is 5, " flying fish ... ".
After the client merging data, because the Query Result surface for returning increased newly one " elder sister " before 1 minute
" beans are had a meal quickly beans today in kindergarten, it is stated that also praised by teacher " information of issue, and due to not returning to other numbers
According to, illustrate that the data that id is 7,6,5 are still present, and due to being only able to display 3 data in mobile phone screen, after being sorted according to id,
As shown in the figure on the right in Fig. 5, the information of displaying is " elder sister ... ";" Zhang San ... ";" little Bai ... ".
In the embodiment of the present application, by comparing the data inquired on local data that client reads and server,
For simultaneous data in client and server, server need not return to the data, and client is directly using local
The data for reading.In this way, not only realize when client data is inquired about that Flux Loss is reduced, and due to server
It is present in the data of client and server simultaneously without returning, the data volume for returning to client is reduced, so as to shorten number
According to query responding time.
If it is noted that client receive inquiry target pages data query instruction after, in local data
The data of the fall short page are read in source, illustrates that client first enters into target pages, then the client just it is direct to
Server sends the data inquiry request for target pages.It is unlike the embodiments above, nothing in asking in this case
Id set need to be carried.It is no longer specific herein to launch because this data query is same as the prior art.But, it is and existing
Unlike technology, after server returns to Query Result, Query Result can be stored in local data source by the client
In, when being easy to next client query, data in local data source can be read.
In actual applications, except the data for increasing newly in server, it is also possible to there are the data of deletion.In the reality of the application
Apply in example, the Query Result that the server lookup is obtained can be obtained in the following way:
In the case where comparing and showing that an id is existed only in the 2nd id set, by the corresponding data notes of the id
In entering Query Result;
In the case where comparing and showing that an id is existed only in id set, the id is charged into Query Result.
In the present embodiment, server in the case where comparing and showing that an id is existed only in the 2nd id set, explanation
The data of the id exist, do not exist on the client on the server, i.e., the data of the id are the data increased newly on server, institute
Need for the corresponding data of the id to charge to Query Result with the server, to cause that client knows the number of the newly-increased id
According to.
Server illustrates that the data of the id exist in the case where comparing and showing that an id is existed only in id set
Do not exist on server, exist on the client, i.e., the data of the id are the data deleted on server, so the server
The id is charged to Query Result by needs, to cause that client knows that the corresponding data of the id have been deleted.
Have been described above in the above-described embodiments, draw the id set and the 2nd id set with identical comparing
In the case of id, the data of the identical id are not returned.That is, for the data all existed on server and client side,
The data for not recording the identical id in Query Result do not record identical id in itself yet.
Below with one specifically example be illustrated, as shown in fig. 6, user refreshes circle of friends by upper stroke data list
Homepage, due to increasing the information " elder sister ... " that id is 8 in server lookup to homepage newly, deletes the information that id is 7 and " opens
Three ... ";So server gathers the 2nd id set that { 7,6,5 } and inquiry are obtained in the id that relatively client is provided
After { 8,6,5 }, the final Query Result for obtaining is:Id is 8 " elder sister ... ";Id is 7.In this way, client is received returning
After the Query Result for returning, it is recognised that having increased the information " elder sister ... " that id is 8 on server newly, the letter that id is 7 is deleted
Breath, and id is 6 and 5 Information invariability, so that the data shown after merging with the data read in local data source are such as
Shown in figure on the right of Fig. 6.
In one of the application specifically embodiment, the Query Result that the server is returned is received in the client
Afterwards, with it is described show after data are merged from the target pages that local data source reads after, methods described is also wrapped
Include:
The client updates data in the local data source according to the Query Result.
In the present embodiment, still it is illustrated with the example of Fig. 6, the data recorded in the client local data source
For:
Id is 7, " Zhang San ... ";
Id is 6, " little Bai ... ";
Id is 5, " flying fish ... ".
According to the Query Result, that is, increase the information that id is 8 newly, delete the information that id is 7, the local data after renewal
The data of record are in source:
Id is 8, " elder sister ... ";
Id is 6, " little Bai ... ";
Id is 5, " flying fish ... ".
In actual use, data storage can excessively cause client to be run relatively slowly in local data source, or
Person's client interim card etc. experiences poor situation, in order to solve the problems, such as because data storage excessively causes in local data source.
In embodiments herein, the option for deleting data in local data source can also be provided.
By the present embodiment, user can be by deleting the data preserved in local data source, so as to avoid client
The problem of storing excess data, so improves Consumer's Experience in local data source.
In actual applications, carry out paging query need consumption time and resource than larger, in order to solve this problem,
One of the application is specifically in embodiment, described from local in the step 110 on the basis of embodiment illustrated in fig. 3
Data source reads the id set of data and the data in the target pages, can specifically include:
Data in the target pages, the id set of the data and last number in page up are read from local data source
According to id.
Correspondingly, except carrying the id set and target pages displaying in the data inquiry request
Outside the quantity of data, in addition it is also necessary to carry positioning id, the positioning id is the id of last data in the page up.
After the server receives the data inquiry request, the number of data after the inquiry positioning id
2nd id gathers.
It is assumed that in the case that current page is homepage, if lower stroke of data list of user, due to the mesh
The mark page is not homepage, the client read in local data source data in the target pages, the data id set 4,
3,2 } and in page up the id of last data is 5;Positioning id is also carried in the data inquiry request that the client sends is
5.Server need to only inquire about the 2nd id set that positioning id is 3 data after 5 in inquiry.
It is noted that in the case where target pages are homepage, due to no page up, so just in the absence of positioning
Id, its query process is identical with above-described embodiment, and server directly inquires about second of number of data described in first page
Id gathers.
By the present embodiment, because server need not carry out paging query, the query process of server is optimized, so as to carry
The search efficiency of server high.
Fig. 7 is referred to, is the flow chart of the data query method that the embodiment of the application one is provided, the embodiment is from client
Side is described, and the embodiment can be comprised the following steps with corresponding diagram 3:
Step 210:Receive for inquiring about in target pages after the query statement of data, the mesh is read from local data source
The id set of data and the data in the mark page, preserves last inquiry target pages in the local data source
When server return data;
Step 220:Data inquiry request is sent to server, the id set is carried in the data inquiry request
With the quantity of the target pages display data;
Step 230:After receiving the Query Result that the server is returned, with described mesh read from local data source
Data show after merging in the mark page.
If it is noted that client receive inquiry target pages data query instruction after, in local data
The data of the fall short page are read in source, illustrates that client first enters into target pages, then the client just it is direct to
Server sends the data inquiry request for target pages.It is unlike the embodiments above, data query in this case
Id set need not be carried in request.It is no longer specific herein to launch because this data query is same as the prior art.But
It is that unlike the prior art, after server returns to Query Result, Query Result can be stored in this by the client
In ground data source, when being easy to next client query, data in local data source are read.
It is noted that after the client receives the Query Result that the server is returned, with described from local
After showing after data are merged in the target pages that data source reads, methods described also includes:
The client updates data in the local data source according to the Query Result.
In actual use, data storage can excessively cause client to be run relatively slowly in local data source, or
Person's client interim card etc. experiences poor situation, in order to solve the problems, such as because data storage excessively causes in local data source.
In embodiments herein, the option for deleting data in local data source can also be provided.
By the present embodiment, user can be by deleting the data preserved in local data source, so as to avoid client
The problem of storing excess data, so improves Consumer's Experience in local data source.
One of the application is specifically in embodiment, on the basis of embodiment illustrated in fig. 7, in the step 210, and institute
The id set that data and the data in the target pages are read from local data source is stated, can specifically be included:
Data in the target pages, the id set of the data and last number in page up are read from local data source
According to id.
Correspondingly, except carrying the id set and target pages displaying in the data inquiry request
Outside the quantity of data, in addition it is also necessary to carry positioning id, the positioning id is the id of last data in the page up.
Fig. 8 is referred to, is the flow chart of the data query method that the embodiment of the application one is provided, the embodiment is from server
Side is described, and the embodiment can be comprised the following steps with corresponding diagram 3:
Step 310:The data inquiry request for target pages that client sends is received, in the data inquiry request
Carry id set and target pages of client data from the target pages that local data source reads
The quantity of display data;
Step 320:The 2nd id set of data in the target pages is inquired about according to the quantity;
Step 330:The 2nd id set that will be inquired is compared with id set in the data inquiry request
Compared with;
Step 340:In the case where comparing and showing that id set and the 2nd id set have identical id, to described
When client returns to Query Result, the data with identical id are not returned.
In actual applications, except the data for increasing newly in server, it is also possible to there are the data of deletion.It is described in the application
Embodiment in, the Query Result that the server lookup is obtained, can following manner combination obtain:
Show that an id is existed only under the request during the 2nd id gathers comparing, by the corresponding data notes of the id
In entering Query Result;
In the case where comparing and showing that an id is only existed in id set, the id is charged into Query Result.
Certainly, also including having been described above:Show that the id set and the 2nd id set have identical id comparing
In the case of, the data of the identical id are not returned.That is, for the data all existed on server and client side,
The data for not recording the identical id in Query Result do not record identical id in itself yet.
In one of the application specifically embodiment, on the basis of embodiment illustrated in fig. 8, the data inquiry request
Also carry positioning id, the positioning id be the client from the target pages page up that local data source reads most
The latter id of data;
Then the step 320, specifically includes:
The 2nd id set of the number of data after the inquiry positioning id.
It is corresponding with aforementioned data querying method embodiment, present invention also provides the embodiment of data query arrangement.
The embodiment of the application data query arrangement can be applied in client respectively.Device embodiment can be by software
Realize, it is also possible to realized by way of hardware or software and hardware combining.As a example by implemented in software, as on a logical meaning
Device, be in by the processor of equipment where it, corresponding computer program instructions in nonvolatile memory are read
Deposit what middle operation was formed.From for hardware view, as shown in figure 9, one kind of equipment where the application data query arrangement is hard
Part structure chart, in addition to the processor shown in Fig. 9, network interface, internal memory and nonvolatile memory, device in embodiment
The equipment at place can also include other hardware generally according to the actual functional capability of the data query, and this is repeated no more.
It is the module map of the data query arrangement that the embodiment of the application one is provided referring to Figure 10, the embodiment is from client
Side is described, and described device includes:Reading unit 410, transmitting element 420 and display unit 430.
Wherein, reading unit 410, receive for inquiring about in target pages after the query statement of data, from local data
The id set of data and the data in the target pages is read in source, and last inquiry is preserved in the local data source
The data that server is returned during the target pages;
Transmitting element 420, data inquiry request is sent to server, and an id is carried in the data inquiry request
Set and the quantity of the target pages display data;
Display unit 430, after receiving the Query Result that the server is returned, reads with described from local data source
The target pages in data merge after show.
In an optional implementation:
Described device can also include:
Updating block, according to the Query Result, updates data in the local data source.
In an optional implementation:
The reading unit 410, specifically includes:
From local data source read data in the target pages, the data an id set and page up in last
The id of individual data,
The transmitting element 420, specifically includes:
Data inquiry request is sent to server, the id set, the mesh are carried in the data inquiry request
The quantity and positioning id of page presentation data are marked, the positioning id is the id of last data in the page up.
It is corresponding with aforementioned data querying method embodiment, present invention also provides the embodiment of data query arrangement.
The embodiment of the application data query arrangement can be applied in server respectively.Device embodiment can be by software
Realize, it is also possible to realized by way of hardware or software and hardware combining.As a example by implemented in software, as on a logical meaning
Device, be in by the processor of equipment where it, corresponding computer program instructions in nonvolatile memory are read
Deposit what middle operation was formed.It is that one kind of equipment where the application data query arrangement is hard as shown in figure 11 from for hardware view
Part structure chart, in addition to the processor shown in Figure 11, network interface, internal memory and nonvolatile memory, fills in embodiment
Equipment where putting can also include other hardware generally according to the actual functional capability of the data query, and this is repeated no more.
It is the module map of the data query arrangement that the embodiment of the application one is provided referring to Figure 12, the embodiment is from server
Side is described, and described device includes:Receiving unit 510, query unit 520, comparing unit 530 and returning unit 540.
Wherein, receiving unit 510, receive the data inquiry request for target pages that client sends, the data
Carried in inquiry request client data from the target pages that local data source reads an id set and
The quantity of the target pages display data;
Query unit 520, the 2nd id set of data in the target pages is inquired about according to the quantity;
Comparing unit 530, will inquire the 2nd id set and an id in the data inquiry request gather into
Row compares;
Returning unit 540, in the case where comparing and showing that id set and the 2nd id set have identical id, to
When the client returns to Query Result, the data with identical id are not returned.
In an optional implementation:
The Query Result, in the following way combination is obtained:
Show that an id is existed only under the request during the 2nd id gathers comparing, by the corresponding data notes of the id
In entering Query Result;
In the case where comparing and showing that an id is only existed in id set, the id is charged into Query Result.
In an optional implementation:
In the receiving unit 510, it is the client that the data inquiry request also carries positioning id, the positioning id
Hold the id of last data from the target pages page up that local data source reads;
Then, the query unit 520, specifically includes:
The 2nd id set of the number of data after the inquiry positioning id.
In sum, the embodiment for being provided by the application, in local data and server that relatively client reads
On after the data that inquire, for simultaneous data in client and server, server need not return to the data, and
Client directly uses the data for locally reading.In this way, not only realize when client data is inquired about reducing flow
Loss, and it is present in the data of client and server simultaneously without returning due to server, reduce and return to client
Data volume, so as to shorten the data query response time.
The function of unit and the implementation process of effect correspond to step in specifically referring to the above method in said apparatus
Implementation process, will not be repeated here.
For device embodiment, because it corresponds essentially to embodiment of the method, so related part is referring to method reality
Apply the part explanation of example.Device embodiment described above is only schematical, wherein described as separating component
The unit of explanation can be or may not be physically separate, and the part shown as unit can be or can also
It is not physical location, you can with positioned at a place, or can also be distributed on multiple NEs.Can be according to reality
Selection some or all of module therein is needed to realize the purpose of application scheme.Those of ordinary skill in the art are not paying
In the case of going out creative work, you can to understand and implement.
Those skilled in the art will readily occur to its of the application after considering specification and putting into practice invention disclosed herein
Its embodiment.The application is intended to any modification, purposes or the adaptations of the application, these modifications, purposes or
Person's adaptations follow the general principle of the application and including the undocumented common knowledge in the art of the application
Or conventional techniques.Description and embodiments are considered only as exemplary, and the true scope of the application and spirit are by following
Claim is pointed out.
It should be appreciated that the application is not limited to the precision architecture for being described above and being shown in the drawings, and
And can without departing from the scope carry out various modifications and changes.Scope of the present application is only limited by appended claim.