CN109657174A - Method and apparatus for more new data - Google Patents
Method and apparatus for more new data Download PDFInfo
- Publication number
- CN109657174A CN109657174A CN201811590761.1A CN201811590761A CN109657174A CN 109657174 A CN109657174 A CN 109657174A CN 201811590761 A CN201811590761 A CN 201811590761A CN 109657174 A CN109657174 A CN 109657174A
- Authority
- CN
- China
- Prior art keywords
- query
- query statement
- data
- update area
- query result
- 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
Links
Abstract
The embodiment of the present application discloses the method and apparatus for more new data.One specific embodiment of this method includes:, based on the query statement for including, to be updated to the data in buffer update area in the inquiry request in response to receiving inquiry request, wherein buffer update area, which is used to ease up with database, deposits into row data exchange;According to query statement, the query result to match with the query statement is obtained as target query result from database;Based on the target query as a result, generating target query result information;Matching based on the target query result information with the data being stored in buffer update area, is updated the data being stored in the buffer update area and the caching.The embodiment realizes the timeliness for guaranteeing the data in caching using the mode other than the entry-into-force time.
Description
Technical field
The invention relates to field of computer technology, and in particular to the method and apparatus for more new data.
Background technique
With the development of internet, caching (Cache) technology is widely used in various searching systems.
Relevant mode is usually to use simple cache technology, i.e., is limited with regular time section, during this period of time, such as
Fruit cache is then obtained from caching in search result;If exceeding the above-mentioned period, need to access again actual
Back end storage system.
Summary of the invention
The embodiment of the present application proposes the method and apparatus for more new data.
In a first aspect, the embodiment of the present application provides a kind of method for more new data, this method comprises: in response to connecing
Inquiry request is received, based on the query statement for including in inquiry request, the data in buffer update area are updated, wherein
Buffer update area, which is used to ease up with database, deposits into row data exchange;According to query statement, obtained and the inquiry language from database
The query result that sentence matches is as target query result;Based on target query as a result, generating target query result information;It is based on
The matching of target query result information and the data being stored in buffer update area, in being stored in buffer update area and caching
Data are updated.
In some embodiments, above-mentioned based on target query result information with the data being stored in buffer update area
Match, the data being stored in buffer update area and caching are updated, comprising: is stored in buffer update area in response to determination
At least one query result information in there is no the query result informations that match with target query result information, target is looked into
It askes result information write-in buffer update area and target query result is written and cache.
In some embodiments, above-mentioned to be based on target query as a result, generating target query result information includes: to look into target
It askes result to be converted, generates identification code corresponding with the target query result as target query result information.
In some embodiments, this method further include: at least one query statement being stored in buffer update area
In query statement, obtain the accessed access information of the query statement;Based on the access information that the query statement is accessed, really
It is fixed whether to remove data relevant to the query statement.
In some embodiments, the above-mentioned access information being accessed based on the query statement, it is determined whether removing is looked into this
Ask the relevant data of sentence, comprising: based on the last of the query statement for including in the accessed access information of the query statement
The once accessed time determines that the last time is accessed the difference of time and current time;In response to determining that the difference is greater than
Preset threshold determines and removes data relevant to the query statement.
Second aspect, the embodiment of the present application provide a kind of device for more new data, which includes: to update list
Member is configured in response to receive inquiry request, based on the query statement for including in inquiry request, in buffer update area
Data are updated, wherein buffer update area, which is used to ease up with database, deposits into row data exchange;Acquiring unit is configured to
According to query statement, the query result to match with the query statement is obtained as target query result from database;It generates single
Member is configured to based on target query as a result, generating target query result information;Matching unit is configured to look into based on target
The matching of data asking result information and being stored in buffer update area, to the data being stored in buffer update area and caching into
Row updates.
In some embodiments, above-mentioned matching unit is further configured to: being stored in buffer update area in response to determination
In at least one query result information in there is no the query result informations that match with target query result information, by target
Query result information is written buffer update area and target query result is written and caches.
In some embodiments, above-mentioned generation unit is further configured to: being converted, is generated to target query result
Identification code corresponding with target query result is as target query result information.
In some embodiments, device further include: determination unit is configured to for being stored in buffer update area
Query statement at least one query statement obtains the accessed access information of the query statement;Based on the query statement quilt
The access information of access, it is determined whether remove data relevant to the query statement.
In some embodiments, above-mentioned determination unit is further configured to: for being stored in buffer update area extremely
Query statement in a few query statement obtains the accessed access information of the query statement;It is interviewed based on the query statement
The last time of the query statement for including in the access information asked is accessed the time, determine the last time be accessed the time and
The difference of current time;In response to determining that the difference is greater than preset threshold, data relevant to the query statement are removed.
The third aspect, the embodiment of the present application provide a kind of server, which includes: one or more processors;
Storage device is stored thereon with one or more programs;When one or more programs are executed by one or more processors, so that
One or more processors realize the method as described in implementation any in first aspect.
Fourth aspect, the embodiment of the present application provide a kind of computer-readable medium, are stored thereon with computer program, should
The method as described in implementation any in first aspect is realized when program is executed by processor.
Method and apparatus provided by the embodiments of the present application for more new data, firstly, in response to receiving inquiry request,
Based on the query statement for including in inquiry request, the data in buffer update area are updated, wherein buffer update area is used for
Ease up with database and deposits into row data exchange;Then, according to query statement, match from database acquisition with the query statement
Query result is as target query result;Next, based on acquired target query as a result, generating target query result letter
Breath;Finally, based on the target query result information and the matching of data that is stored in buffer update area, to being stored in the caching
Data in more new district and the caching are updated.To realize the number guaranteed in caching using the mode other than the entry-into-force time
According to timeliness.
Detailed description of the invention
By reading a detailed description of non-restrictive embodiments in the light of the attached drawings below, the application's is other
Feature, objects and advantages will become more apparent upon:
Fig. 1 is that one embodiment of the application can be applied to exemplary system architecture figure therein;
Fig. 2 is the flow chart according to one embodiment of the method for more new data of the application;
Fig. 3 is the timing diagram according to an application scenarios of the method for more new data of the embodiment of the present application;
Fig. 4 is the flow chart according to another embodiment of the method for more new data of the application;
Fig. 5 is the structural schematic diagram according to one embodiment of the device for more new data of the application;
Fig. 6 is adapted for the structural schematic diagram for the computer system for realizing the server of the embodiment of the present application.
Specific embodiment
The application is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched
The specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order to
Convenient for description, part relevant to related invention is illustrated only in attached drawing.
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phase
Mutually combination.The application is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 is shown can be using the application for the method for more new data or the example of the device for more new data
Property framework 100.
As shown in Figure 1, system architecture 100 may include terminal device 101,102,103, network 104 and server 105.
Terminal device 101,102,103 is interacted by network 104 with server 105, to receive or send message etc..Terminal device 101,
102, the various client applications comprising database can be installed on 103, such as the application of web browser applications, searching class,
Instant messaging tools, mailbox client, social platform software etc..
Terminal device 101,102,103 can be hardware, be also possible to software.When terminal device 101,102,103 is hard
When part, can be with database application and support the various electronic equipments of search function, including but not limited to smart phone,
Tablet computer, E-book reader, MP3 player (Moving Picture Experts Group Audio Layer III,
Dynamic image expert's compression standard audio level 3), MP4 (Moving Picture Experts Group Audio Layer
IV, dynamic image expert's compression standard audio level 4) player, pocket computer on knee and desktop computer etc..Work as end
When end equipment 101,102,103 is software, it may be mounted in above-mentioned cited electronic equipment.It may be implemented into multiple soft
Part or software module (such as providing Distributed Services), also may be implemented into single software or software module.It does not do herein
It is specific to limit.
Server 105 can be to provide the server of various services, for example, application on terminal device 101,102,103
Routine access database provides the background server supported.Background server can be to transmitted by receive, terminal device
Inquiry request is responded, and query result corresponding with above-mentioned inquiry request is fed back to terminal device.Specifically, background service
Caching and buffer update area can be installed in device, so as to be updated by buffer update area to the data in caching,
To guarantee the timeliness of the data in caching.
It should be noted that above-mentioned inquiry request, which can also arise directly from, is mounted on the local application journey of server 105
Sequence.At this point, query result corresponding with above-mentioned inquiry request can be fed directly to local application program by server 105.
At this point it is possible to which terminal device 101,102,103 and network 104 is not present.
It should be noted that server can be hardware, it is also possible to software.When server is hardware, may be implemented
At the distributed server cluster that multiple servers form, individual server also may be implemented into.It, can when server is software
To be implemented as multiple softwares or software module (such as providing Distributed Services), single software or software also may be implemented into
Module.It is not specifically limited herein.
It should be noted that above-mentioned buffer update area can be hardware, it is also possible to software.When buffer update area is hardware
When, the storage equipment that can be mounted in server or terminal may be implemented into;It can also be implemented as individual server, it can also be with
It is implemented as multiple distributed server clusters for more new data.When buffer update area is software, may be implemented into multiple
Software or software module (such as updating the data in caching), also may be implemented into single software or software module.Herein
It is not specifically limited.Above-mentioned caching can be hardware, be also possible to software.When caching is hardware, may be implemented into can pacify
High-speed processing apparatus on server or terminal, such as built-in storage;It can also be implemented as single cache server, it can also
To be implemented as the distributed cache server cluster of multiple storage data in need frequently accessed.It, can when caching is software
To be implemented as multiple softwares or software module (such as managing the data being stored in caching);Also it may be implemented into single soft
Part or software module.It is not specifically limited herein.
It should also be noted that, the method provided by the embodiment of the present application for more new data is generally by server 105
It executes;Correspondingly, the device for more new data is generally positioned in server 105.
It should be understood that the number of terminal device, network and server in Fig. 1 is only schematical.According to realization need
It wants, can have any number of terminal device, network and server.
With continued reference to Fig. 2, the process of one embodiment of the method for more new data according to the application is shown
200.This for more new data method the following steps are included:
Step 201, in response to receiving inquiry request, based on the query statement for including in inquiry request, to buffer update
Data in area are updated.
In the present embodiment, above-mentioned inquiry request can be for characterizing the information for obtaining specific data.Wherein, above-mentioned spy
Fixed number evidence can usually be determined by the query statement included by inquiry request.Above-mentioned inquiry request can be and above-mentioned execution
Transmitted by the electronic equipment of main body communication connection;It is also possible to be triggered by the application program being mounted in above-mentioned executing subject
, it is not limited thereto.Key assignments (Key-Value, KV) type memory database can be used usually to realize in above-mentioned caching.It is above-mentioned
Key assignments type memory database can include but is not limited at least one of following: Redis database (a kind of open source, support network
Log type database), memcache caching system (a kind of distributed cache systems).It is appreciated that above-mentioned caching
Data in more new district usually may include query statement (Query) and query result information (Result);In above-mentioned caching
Data usually may include the query statement as key and the query result as value.
In the present embodiment, for the executing subject (server 105 as shown in Figure 1) of the method for more new data in response to
Inquiry request is received, the data in buffer update area can be updated based on the query statement for including in inquiry request.
Wherein, above-mentioned buffer update area, which can be used for easing up with database, deposits into row data exchange.Specifically, the side of above-mentioned data exchange
Formula can be showed themselves in that obtains data from above-mentioned database, and data write-in acquired from above-mentioned database is above-mentioned slow
The new district Cun Geng;Data can also be obtained from above-mentioned buffer update area, and the data acquired in the above-mentioned buffer update area are written
Caching.
In the present embodiment, query statement and corresponding query result can be with associated storages in above-mentioned buffer update area
In.Optionally, for the query statement in above-mentioned buffer update area is newly written, at this point, corresponding query result can be temporary
For null value (null).
In the present embodiment, above-mentioned executing subject can determine in buffer update area with the presence or absence of in above-mentioned inquiry request
Including the identical data of query statement.It is not present in response to determination, above-mentioned executing subject can will wrap in above-mentioned inquiry request
The query statement write-in buffer update area included.Exist in response to determining, in order to avoid being repeatedly written the caused wasting of resources, leads to
Often, no longer buffer update area is written in above-mentioned query statement by above-mentioned executing subject.
In some optional implementations of the present embodiment, above-mentioned executing subject will directly can also be asked with above-mentioned inquiry
Above-mentioned buffer update area is written in the query statement for including in asking.In these implementations, above-mentioned buffer update area is usually required that
Has biggish capacity.
In some optional implementations of the present embodiment, above-mentioned buffer update area can be distributed structure/architecture, thereafter
End can be made of multiple examples.In these implementations, at least one buffer update area in distributed structure/architecture, on
Above-mentioned caching can be written more for the query statement for including in received inquiry request by various modes by stating executing subject
New district.As an example, above-mentioned executing subject can use consistency Hash (Consistent Hashing) algorithm, pass through
RocksDB (a kind of high-performance embedded database for key assignments type database) is realized to above-mentioned each buffer update area example
Data write-in.As another example, above-mentioned executing subject query statement can also be written according to preset mapping table
Corresponding buffer update area.Wherein, above-mentioned mapping table can be used for characterizing between query statement and buffer update area
Corresponding relationship.
Step 202, it according to query statement, obtains from database and is looked into the query result that query statement matches as target
Ask result.
In the present embodiment, above-mentioned executing subject can be according to being written above-mentioned buffer update area in above-mentioned steps 201
Query statement, obtain from the database for carrying out data exchange with above-mentioned buffer update area and match with above-mentioned query statement
Query result is as target query result.
In the present embodiment, above-mentioned database is usually key assignments type database.As an example, above-mentioned database can be
Redis database is also possible to memcache caching system.It is appreciated that above-mentioned executing subject can determine first with it is above-mentioned
The key that query statement matches.Then, above-mentioned executing subject it is available it is corresponding with identified key value as with it is above-mentioned
The query result that query statement matches.Finally, above-mentioned matched query result can be determined as target by above-mentioned executing subject
Query result.
Step 203, target query is based on as a result, generating target query result information.
In the present embodiment, above-mentioned executing subject can be based on the target query acquired in step 202 as a result, generating target
Query result information.It is looked into as an example, acquired target query result directly can be determined as target by above-mentioned executing subject
Ask result information.
In some optional implementations of the present embodiment, above-mentioned executing subject can also be to above-mentioned target query result
It is converted, generates identification code corresponding with above-mentioned target query result as target query result information.Wherein, to above-mentioned mesh
The method that mark query result is converted may include the various algorithms that can generate summary info.Above-mentioned algorithm may include but
It is not limited at least one of following: MD5 (Message Digest Algorithm5,5 algorithm of informative abstract), SHA (Secure
Hash Algorithm, secure hash algorithm).
Step 204, based on target query result information and the matching of data that is stored in buffer update area, to being stored in
Data in buffer update area and caching are updated.
In the present embodiment, above-mentioned executing subject can be based on step 203 target query result information generated and deposit
It is stored in the matching of the data in buffer update area, the data being stored in buffer update area and caching are updated.
Specifically, above-mentioned executing subject exists and above-mentioned target query result information pair in response to determining in buffer update area
Step 203 target query result information generated, can be written buffer update area by the query statement answered, and by above-mentioned mesh
Mark query result write-in caching.
In some optional implementations of the present embodiment, above-mentioned executing subject can be first from being stored in buffer update
Determine query result information corresponding with above-mentioned query statement as candidate query at least one query result information in area
Result information;Then, above-mentioned executing subject is in response to the above-mentioned candidate query result information of determination and step 203 target generated
Query result information is inconsistent, step 203 target query result information generated can be written to buffer update area, and will
Target query result write-in caching.
It is directly determined it should be noted that above-mentioned target query result information can be by acquired target query result
, it is also possible to the identification code generated by matched target query result by conversion.Wherein, above-mentioned identification code can be used for
The above-mentioned target query result of unique identification.Above-mentioned identification code can be related to the method converted to target query result.Make
For example, according to MD5 algorithm, then above-mentioned identification code can be 128 strings of binary characters, can also be that other indicate shape
Formula.For example, target query result can be " admin ", the identification code generated by 16 MD5 small letter conversion methods be can be
"7a57a5a743894a0e".As another example, according to SHA algorithm, then above-mentioned identification code can be regular length (such as
SHA-1 can be 160, and SHA-256 can be 256) character string.
In the implementation that target query result information is identification code, be stored in above-mentioned buffer update area, with inquiry
The corresponding query result information of sentence is also all to utilize the mark converted and generated with the consistent method of above-mentioned conversion method
Know code.
In some optional implementations of the present embodiment, above-mentioned executing subject is in response to receiving looking into for terminal transmission
Request is ask, can be determined first in caching with the presence or absence of the query result to match with above-mentioned inquiry request;It is deposited in response to determination
The result to match with above-mentioned inquiry request can be sent to terminal;It is not present in response to determination, it can be from above-mentioned data
Obtained in library with above-mentioned inquiry request match as a result, acquired result is stored in cache in and the above results are sent out
Give terminal.
It should be noted that above-mentioned steps 202-204 can in the case where being not received by other inquiry requests, every
Preset time interval executes primary.It is appreciated that above-mentioned time interval is shorter, the frequency of update is faster, the data in caching
Timeliness it is also stronger.In practice, under the more demanding application scenario of the timeliness for the data in caching, it can continue
The query result to match with query statement is obtained from database, and gentle to buffer update area according to acquired query result
Data in depositing are updated.
With continued reference to one that Fig. 3, Fig. 3 are according to the application scenarios of the method for more new data of the embodiment of the present application
Timing diagram.In the timing diagram of the application scenarios of Fig. 3, terminal device sends the corresponding value of characterization inquiry " city " to server
Inquiry request 301.Server in response to determining the query statement " obtain ' city ' (Get city) " for including in buffer update area,
It can not have to again be repeatedly written above-mentioned query statement.At this point, being deposited in caching, buffer update area and database in server
The data of storage are respectively as shown in 3021,3022 and 3023.Optionally, server can also be according to inquiry response side general at present
Query result " Shanghai " 303 is fed back to terminal device by formula.Specifically, server can access cache first;If miss
Caching, then access database.When the data in database update, the data stored in database are as illustrated at 304.Service
Device obtains matched query result " Beijing " 305 according to above-mentioned query statement from database.Next, server is straight
It connects using query result as query result information 306.Optionally, server can also be converted in " Beijing " by MD5
" 9c0ca340eff4fdce " is used as query result information.Under these modes, correspondingly, " the inquiry knot in buffer update area
The corresponding data of fruit information " are also the result after MD5 is converted.Finally, server is in response to determining in buffer update area 3022
There is no with " Beijing " 306 matched data, by " Beijing " 305 be written caching and will " Beijing " 306 write-in buffer update area.
The data stored in updated caching and buffer update area can be respectively as shown in 3071 and 3072.
The method provided by the above embodiment of the application, firstly, in response to receiving inquiry request, based in inquiry request
Including query statement, the data in buffer update area are updated;Then, according to query statement, from database obtain with
The query result that the query statement matches is as target query result;Later, target query is based on as a result, generating target query
Result information;Finally, the matching based on target query result information with the data being stored in buffer update area, slow to being stored in
The new district Cun Geng is gentle deposit in data be updated.So as to by setting buffer update area and to the data in caching into
Row, which is more newly arrived, guarantees the timeliness of the data in caching.
With further reference to Fig. 4, it illustrates the processes 400 of another embodiment of the method for more new data.The use
In the process 400 of the method for more new data, comprising the following steps:
Step 401, in response to receiving inquiry request, based on the query statement for including in inquiry request, to buffer update
Data in area are updated.
Step 402, it according to query statement, obtains from database and is looked into the query result that query statement matches as target
Ask result.
Step 403, target query is based on as a result, generating target query result information.
Step 404, based on target query result information and the matching of data that is stored in buffer update area, to being stored in
Data in buffer update area and caching are updated.
Above-mentioned steps 401, step 402, step 403 and step 404 respectively with step 201, the step in previous embodiment
202, step 203 is consistent with step 204, and the description above with respect to step 201, step 202, step 203 and step 204 is also suitable
In step 401, step 402, step 403 and step 404, details are not described herein again.
Step 405, it for the query statement at least one query statement for being stored in buffer update area, obtains this and looks into
Ask the accessed access information of sentence;The access information being accessed based on the query statement, it is determined whether remove and the inquiry language
The relevant data of sentence.
In the present embodiment, the accessed access information of above-mentioned query statement can include but is not limited to following at least one
: query statement accessed time, the accessed total degree of query statement.
In the present embodiment, the access information that above-mentioned executing subject is accessed based on the query statement, can use various
Caching life cycle algorithm determines whether to remove data relevant to the query statement.Above-mentioned caching life cycle algorithm may include but unlimited
In at least one of following: LRU (Least recently used, least recently used), LFU (Least Frequently
Used is least commonly used), FIFO (First Input First Output, first in first out).It should be noted that above-mentioned
The caching life cycle algorithm such as LRU, LFU, FIFO is the well-known technique studied and applied extensively at present, and details are not described herein.
In the present embodiment, above-mentioned data relevant to the query statement can include but is not limited at least one of following:
The query statement being stored in caching is stored in caching, corresponding with query statement query result, is stored in caching
The query statement in more new district is stored in buffer update area, corresponding with query statement query result information.In practice,
The data being stored in caching are usually consistent with the data for being stored in buffer update area.As an example, above-mentioned executing subject
After determining that will be stored in the caching, query statement removes, the inquiry that will be stored in buffer update area generally also can determine whether
Erasing of information is tied in sentence and inquiry corresponding with the query statement.Optionally, above-mentioned executing subject is determining removing and the inquiry
After the relevant data of sentence, above-mentioned data relevant to the query statement can be removed.
In some optional implementations of the present embodiment, it is interviewed that above-mentioned executing subject is also based on the query statement
The last time of the query statement for including in the access information asked is accessed the time, determine the last time be accessed the time and
The difference of current time;In response to determining that the difference is greater than preset threshold, determines and remove data relevant to the query statement.
The inquiry language at least one query statement in these implementations, for being stored in above-mentioned buffer update area
The accessed timestamp of query statement last time can be stored in above-mentioned buffer update area by sentence, above-mentioned executing subject;Response
In determining that time that the accessed timestamp of query statement last time is characterized and above-mentioned executing subject execute this step behaviour
The difference of time when making is greater than preset threshold, and above-mentioned executing subject can determine that removing is stored in above-mentioned buffer area and caching more
Data in new district, relevant to the query statement.
Figure 4, it is seen that the method for more new data compared with the corresponding embodiment of Fig. 2, in the present embodiment
Process 400 embody for the query statement at least one query statement for being stored in buffer update area, obtain this and look into
Ask the accessed access information of sentence;The access information being accessed based on the query statement, it is determined whether remove and the inquiry language
The step of sentence relevant data.The visit that the scheme of the present embodiment description can be accessed according to the query statement stored as a result,
Information is asked to determine whether to remove data relevant to the query statement, to avoid by the control to data volume in caching
Lead to the reduced performance of the system where caching due to global buffer state.
With further reference to Fig. 5, as the realization to method shown in above-mentioned each figure, this application provides for updating device
One embodiment, the Installation practice is corresponding with embodiment of the method shown in Fig. 2, which specifically can be applied to various electricity
In sub- equipment.
As shown in figure 5, the device 500 provided in this embodiment for more new data includes updating unit 501, acquiring unit
502, generation unit 503 and matching unit 504.Wherein, updating unit 501 are configured in response to receive inquiry request, base
The query statement for including in inquiry request is updated the data in buffer update area, wherein buffer update area be used for
Database is gentle to deposit into row data exchange;Acquiring unit 502 is configured to obtain from database and look into this according to query statement
The query result that inquiry sentence matches is as target query result;Generation unit 503, be configured to based on target query as a result,
Generate target query result information;Matching unit 504 is configured to based on target query result information and is stored in buffer update
The matching of data in area is updated the data being stored in buffer update area and caching.
In the present embodiment, in the device 500 of more new data: updating unit 501, acquiring unit 502, generation unit
503 and matching unit 504 specific processing and its brought technical effect can be respectively with reference to the step in Fig. 2 corresponding embodiment
201, the related description of step 202, step 203 and step 204, details are not described herein.
In some optional implementations of the present embodiment, above-mentioned matching unit 504 can be further configured to ring
It should be not present and target query result information phase in determining at least one query result information being stored in buffer update area
Target query result information is written buffer update area and target query result is written slow by matched query result information
It deposits.
In some optional implementations of the present embodiment, above-mentioned generation unit 503 can be further configured to: right
Target query result is converted, and generates identification code corresponding with target query result as target query result information.
In some optional implementations of the present embodiment, the above-mentioned device 500 for more new data can also include
Determination unit (not shown).Wherein it is determined that unit may be configured to for be stored in buffer update area at least one
Query statement in a query statement obtains the accessed access information of the query statement;It is accessed based on the query statement
Access information, it is determined whether remove data relevant to the query statement.
In some optional implementations of the present embodiment, above-mentioned determination unit can be further configured to: for
The query statement being stored at least one query statement in buffer update area obtains the accessed access letter of the query statement
Breath;The last time for the query statement for including in the access information being accessed based on the query statement is accessed the time, determines
The last time is accessed the difference of time and current time;In response to determine the difference be greater than preset threshold, determine remove with
The relevant data of the query statement.
The device provided by the above embodiment of the application is based on by updating unit 501 in response to receiving inquiry request
The query statement for including in inquiry request is updated the data in buffer update area, wherein buffer update area is used for and number
Row data exchange is deposited into according to library is gentle;Then, acquiring unit 502 obtains and the query statement according to query statement from database
The query result to match is as target query result;Next, generation unit 503 is based on the target query as a result, generating mesh
Mark query result information;Finally, matching unit 504 is based on the target query result information and the number being stored in buffer update area
According to matching, the data being stored in the buffer update area and the caching are updated.To realize using the entry-into-force time
Mode in addition guarantees the timeliness of the data in caching.
Below with reference to Fig. 6, it illustrates the computer systems 600 for the server for being suitable for being used to realize the embodiment of the present application
Structural schematic diagram.Server shown in Fig. 6 is only an example, should not function and use scope band to the embodiment of the present application
Carry out any restrictions.
As shown in fig. 6, computer system 600 includes central processing unit (CPU) 601, it can be read-only according to being stored in
Program in memory (ROM) 602 or be loaded into the program in random access storage device (RAM) 603 from storage section 608 and
Execute various movements appropriate and processing.In RAM 603, also it is stored with system 600 and operates required various programs and data.
CPU 601, ROM 602 and RAM 603 are connected with each other by bus 604.Input/output (I/O) interface 605 is also connected to always
Line 604.
I/O interface 605 is connected to lower component: the importation 606 including keyboard, mouse etc.;It is penetrated including such as cathode
The output par, c 607 of spool (CRT), liquid crystal display (LCD) etc.;Storage section 608 including hard disk etc.;And including such as
The communications portion 609 of the network interface card of LAN card, modem etc..Communications portion 609 is held via the network of such as internet
Row communication process.Driver 610 is also connected to I/O interface 605 as needed.Detachable media 611, such as disk, CD, magnetic
CD, semiconductor memory etc. are mounted on as needed on driver 610, in order to from the computer program read thereon
It is mounted into storage section 608 as needed.
Particularly, in accordance with an embodiment of the present disclosure, it may be implemented as computer above with reference to the process of flow chart description
Software program.For example, embodiment of the disclosure includes a kind of computer program product comprising be carried on computer-readable medium
On computer program, which includes the program code for method shown in execution flow chart.In such reality
It applies in example, which can be downloaded and installed from network by communications portion 609, and/or from detachable media
611 are mounted.When the computer program is executed by central processing unit (CPU) 601, limited in execution the present processes
Above-mentioned function.
It should be noted that the computer-readable medium of the application can be computer-readable signal media or computer
Readable storage medium storing program for executing either the two any combination.Computer readable storage medium for example can be --- but it is unlimited
In system, device or the device of --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor, or any above combination.It calculates
The more specific example of machine readable storage medium storing program for executing can include but is not limited to: have the electrical connection, portable of one or more conducting wires
Formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable programmable read only memory
(EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device or
The above-mentioned any appropriate combination of person.In this application, computer readable storage medium can be it is any include or storage program
Tangible medium, which can be commanded execution system, device or device use or in connection.And in this Shen
Please in, computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal,
In carry computer-readable program code.The data-signal of this propagation can take various forms, including but not limited to
Electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be computer-readable
Any computer-readable medium other than storage medium, the computer-readable medium can send, propagate or transmit for by
Instruction execution system, device or device use or program in connection.The journey for including on computer-readable medium
Sequence code can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc. are above-mentioned
Any appropriate combination.
The calculating of the operation for executing the application can be write with one or more programming languages or combinations thereof
Machine program code, described program design language include object-oriented programming language-such as Java, Smalltalk, C+
+, it further include conventional procedural programming language-such as " C " language or similar programming language.Program code can
Fully to execute, partly execute on the user computer on the user computer, be executed as an independent software package,
Part executes on the remote computer or executes on a remote computer or server completely on the user computer for part.
In situations involving remote computers, remote computer can pass through the network of any kind --- including local area network (LAN)
Or wide area network (WAN)-is connected to subscriber computer, or, it may be connected to outer computer (such as utilize Internet service
Provider is connected by internet).
Flow chart and block diagram in attached drawing are illustrated according to the system of the various embodiments of the application, method and computer journey
The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation
A part of one module, program segment or code of table, a part of the module, program segment or code include one or more use
The executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in box
The function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actually
It can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it to infuse
Meaning, the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart can be with holding
The dedicated hardware based system of functions or operations as defined in row is realized, or can use specialized hardware and computer instruction
Combination realize.
Being described in unit involved in the embodiment of the present application can be realized by way of software, can also be by hard
The mode of part is realized.Described unit also can be set in the processor, for example, can be described as: a kind of processor, packet
Include updating unit, acquiring unit, generation unit and matching unit.Wherein, the title of these units not structure under certain conditions
The restriction of the pairs of unit itself, for example, updating unit is also described as " in response to receiving inquiry request, based on looking into
Ask the query statement for including in request, the unit being updated to the data in buffer update area ".
As on the other hand, present invention also provides a kind of computer-readable medium, which be can be
Included in server described in above-described embodiment;It is also possible to individualism, and without in the supplying server.It is above-mentioned
Computer-readable medium carries one or more program, when said one or multiple programs are executed by the device, makes
Obtain the server: in response to receiving inquiry request, based on the query statement for including in inquiry request, in buffer update area
Data are updated, wherein buffer update area, which is used to ease up with database, deposits into row data exchange;According to query statement, from number
The query result to match with query statement is obtained as target query result according to library;Based on target query as a result, generating target
Query result information;Matching based on target query result information with the data being stored in buffer update area, it is slow to being stored in
The new district Cun Geng is gentle deposit in data be updated.
Above description is only the preferred embodiment of the application and the explanation to institute's application technology principle.Those skilled in the art
Member is it should be appreciated that invention scope involved in the application, however it is not limited to technology made of the specific combination of above-mentioned technical characteristic
Scheme, while should also cover in the case where not departing from foregoing invention design, it is carried out by above-mentioned technical characteristic or its equivalent feature
Any combination and the other technical solutions formed.Such as features described above has similar function with (but being not limited to) disclosed herein
Can technical characteristic replaced mutually and the technical solution that is formed.
Claims (12)
1. a kind of method for more new data, comprising:
In response to receiving inquiry request, based on the query statement for including in the inquiry request, to the number in buffer update area
According to being updated, wherein the buffer update area is used for and database is gentle deposits into row data exchange;
According to the query statement, the query result to match with the query statement is obtained from the database and is looked into as target
Ask result;
Based on the target query as a result, generating target query result information;
Matching based on the target query result information with the data being stored in the buffer update area, it is described to being stored in
Data in buffer update area and the caching are updated.
It is described based on the target query result information and to be stored in described slow 2. according to the method described in claim 1, wherein
The matching of data in the new district Cun Geng is updated the data being stored in the buffer update area and the caching, comprising:
It is not present and the target in response to determining at least one query result information being stored in the buffer update area
The query result information that query result information matches, by the target query result information be written the buffer update area and
The caching is written into the target query result.
3. described to be based on the target query as a result, generating target query result according to the method described in claim 2, wherein
Information includes:
The target query result is converted, generates identification code corresponding with the target query result as target query
Result information.
4. method described in one of -3 according to claim 1, wherein the method also includes:
For the query statement at least one query statement for being stored in the buffer update area, the query statement quilt is obtained
The access information of access;The access information being accessed based on the query statement, it is determined whether remove relevant to the query statement
Data.
5. according to the method described in claim 4, wherein, the access information being accessed based on the query statement, determination is
It is no to remove data relevant to the query statement, comprising:
The last time for the query statement for including in the access information being accessed based on the query statement is accessed the time, determines
The last time is accessed the difference of time and current time;
In response to determining that the difference is greater than preset threshold, determines and remove data relevant to the query statement.
6. a kind of device for more new data, comprising:
Updating unit is configured in response to receive inquiry request, right based on the query statement for including in the inquiry request
Data in buffer update area are updated, wherein the buffer update area, which is used to ease up with database, deposits into row data exchange;
Acquiring unit is configured to be matched from database acquisition with the query statement according to the query statement
Query result is as target query result;
Generation unit is configured to based on the target query as a result, generating target query result information;
Matching unit is configured to based on the target query result information and the data that are stored in the buffer update area
Matching, is updated the data being stored in the buffer update area and the caching.
7. device according to claim 6, wherein the matching unit is further configured to:
It is not present and the target in response to determining at least one query result information being stored in the buffer update area
The query result information that query result information matches, by the target query result information be written the buffer update area and
The caching is written into the target query result.
8. device according to claim 7, wherein the generation unit is further configured to:
The target query result is converted, generates identification code corresponding with the target query result as target query
Result information.
9. the device according to one of claim 6-8, wherein described device further include:
Determination unit is configured to for the inquiry language at least one query statement for being stored in the buffer update area
Sentence obtains the accessed access information of the query statement;The access information being accessed based on the query statement, it is determined whether remove
Data relevant to the query statement.
10. device according to claim 9, wherein the determination unit is further configured to:
For the query statement at least one query statement for being stored in the buffer update area, the query statement quilt is obtained
The access information of access;The last time for the query statement for including in the access information being accessed based on the query statement is interviewed
It asks the time, determines that the last time is accessed the difference of time and current time;In response to determining that the difference is greater than preset threshold,
It determines and removes data relevant to the query statement.
11. a kind of server, comprising:
One or more processors;
Storage device is stored thereon with one or more programs;
When one or more of programs are executed by one or more of processors, so that one or more of processors are real
Now such as method as claimed in any one of claims 1 to 5.
12. a kind of computer-readable medium, is stored thereon with computer program, wherein the realization when program is executed by processor
Such as method as claimed in any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811590761.1A CN109657174B (en) | 2018-12-25 | 2018-12-25 | Method and device for updating data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811590761.1A CN109657174B (en) | 2018-12-25 | 2018-12-25 | Method and device for updating data |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109657174A true CN109657174A (en) | 2019-04-19 |
CN109657174B CN109657174B (en) | 2023-06-02 |
Family
ID=66116149
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811590761.1A Active CN109657174B (en) | 2018-12-25 | 2018-12-25 | Method and device for updating data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109657174B (en) |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110032567A (en) * | 2019-04-24 | 2019-07-19 | 江苏满运软件科技有限公司 | Report form inquiring method, device, server and storage medium |
CN110955669A (en) * | 2019-10-18 | 2020-04-03 | 苏州浪潮智能科技有限公司 | Front-end and back-end data consistency method and system based on event and memory database |
CN111339140A (en) * | 2020-02-21 | 2020-06-26 | 北京三快在线科技有限公司 | Data query method and device, storage medium and electronic equipment |
CN111694869A (en) * | 2020-06-16 | 2020-09-22 | 北京同邦卓益科技有限公司 | Method and device for querying data |
CN111737564A (en) * | 2019-08-29 | 2020-10-02 | 北京京东尚科信息技术有限公司 | Information query method, device, equipment and medium |
CN112527843A (en) * | 2020-12-18 | 2021-03-19 | 国家工业信息安全发展研究中心 | Data query method, device, terminal equipment and storage medium |
CN113010535A (en) * | 2021-03-12 | 2021-06-22 | 北京百度网讯科技有限公司 | Cache data updating method, device, equipment and storage medium |
CN113760982A (en) * | 2021-01-18 | 2021-12-07 | 西安京迅递供应链科技有限公司 | Data processing method and device |
CN113760982B (en) * | 2021-01-18 | 2024-05-17 | 西安京迅递供应链科技有限公司 | Data processing method and device |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102163195A (en) * | 2010-02-22 | 2011-08-24 | 北京东方通科技股份有限公司 | Query optimization method based on unified view of distributed heterogeneous database |
CN102622361A (en) * | 2011-01-28 | 2012-08-01 | 天脉聚源(北京)传媒科技有限公司 | Method for querying database |
US20170364557A1 (en) * | 2016-06-20 | 2017-12-21 | TmaxData Co., Ltd. | Method and apparatus for executing query and computer readable medium therefor |
CN107644071A (en) * | 2017-09-18 | 2018-01-30 | 广州爱九游信息技术有限公司 | Buffering updating method, device and data-storage system |
CN108090351A (en) * | 2017-12-14 | 2018-05-29 | 北京百度网讯科技有限公司 | For handling the method and apparatus of request message |
-
2018
- 2018-12-25 CN CN201811590761.1A patent/CN109657174B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102163195A (en) * | 2010-02-22 | 2011-08-24 | 北京东方通科技股份有限公司 | Query optimization method based on unified view of distributed heterogeneous database |
CN102622361A (en) * | 2011-01-28 | 2012-08-01 | 天脉聚源(北京)传媒科技有限公司 | Method for querying database |
US20170364557A1 (en) * | 2016-06-20 | 2017-12-21 | TmaxData Co., Ltd. | Method and apparatus for executing query and computer readable medium therefor |
CN107644071A (en) * | 2017-09-18 | 2018-01-30 | 广州爱九游信息技术有限公司 | Buffering updating method, device and data-storage system |
CN108090351A (en) * | 2017-12-14 | 2018-05-29 | 北京百度网讯科技有限公司 | For handling the method and apparatus of request message |
Non-Patent Citations (2)
Title |
---|
王景佩: "基于Redis的结构化数据缓存系统的设计与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
赵洁等: "多数据库中间件中分布异构数据缓冲区系统的实现", 《计算机应用研究》 * |
Cited By (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110032567A (en) * | 2019-04-24 | 2019-07-19 | 江苏满运软件科技有限公司 | Report form inquiring method, device, server and storage medium |
CN110032567B (en) * | 2019-04-24 | 2022-09-06 | 江苏满运软件科技有限公司 | Report query method, device, server and storage medium |
CN111737564A (en) * | 2019-08-29 | 2020-10-02 | 北京京东尚科信息技术有限公司 | Information query method, device, equipment and medium |
CN111737564B (en) * | 2019-08-29 | 2024-04-05 | 北京京东尚科信息技术有限公司 | Information query method, device, equipment and medium |
CN110955669B (en) * | 2019-10-18 | 2022-07-08 | 苏州浪潮智能科技有限公司 | Front-end and back-end data consistency method and system based on event and memory database |
CN110955669A (en) * | 2019-10-18 | 2020-04-03 | 苏州浪潮智能科技有限公司 | Front-end and back-end data consistency method and system based on event and memory database |
CN111339140A (en) * | 2020-02-21 | 2020-06-26 | 北京三快在线科技有限公司 | Data query method and device, storage medium and electronic equipment |
CN111694869A (en) * | 2020-06-16 | 2020-09-22 | 北京同邦卓益科技有限公司 | Method and device for querying data |
CN112527843B (en) * | 2020-12-18 | 2023-04-14 | 国家工业信息安全发展研究中心 | Data query method, device, terminal equipment and storage medium |
CN112527843A (en) * | 2020-12-18 | 2021-03-19 | 国家工业信息安全发展研究中心 | Data query method, device, terminal equipment and storage medium |
CN113760982A (en) * | 2021-01-18 | 2021-12-07 | 西安京迅递供应链科技有限公司 | Data processing method and device |
CN113760982B (en) * | 2021-01-18 | 2024-05-17 | 西安京迅递供应链科技有限公司 | Data processing method and device |
CN113010535A (en) * | 2021-03-12 | 2021-06-22 | 北京百度网讯科技有限公司 | Cache data updating method, device, equipment and storage medium |
CN113010535B (en) * | 2021-03-12 | 2024-03-08 | 北京百度网讯科技有限公司 | Cache data updating method, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN109657174B (en) | 2023-06-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109657174A (en) | Method and apparatus for more new data | |
CN109254733B (en) | Method, device and system for storing data | |
CN110019211A (en) | The methods, devices and systems of association index | |
CN108846753B (en) | Method and apparatus for processing data | |
CN109388626B (en) | Method and apparatus for assigning numbers to services | |
CN109447635B (en) | Information storage method and device for block chain | |
CN109413127A (en) | A kind of method of data synchronization and device | |
CN110019080A (en) | Data access method and device | |
JP7397094B2 (en) | Resource configuration method, resource configuration device, computer equipment, and computer program | |
CN109189857A (en) | Data-sharing systems, method and apparatus based on block chain | |
CN108011949B (en) | Method and apparatus for acquiring data | |
CN110019062A (en) | Method of data synchronization and system | |
CN108984553A (en) | Caching method and device | |
CN109885593A (en) | Method and apparatus for handling information | |
CN107613040A (en) | A kind of method and apparatus of domain name system DNS server lookup | |
CN110365745A (en) | Data processing system, method, apparatus, server and computer-readable medium | |
CN109992406A (en) | The method and client that picture requesting method, response picture are requested | |
CN110019263A (en) | Information storage means and device | |
CN109918381A (en) | Method and apparatus for storing data | |
CN109697034A (en) | A kind of method for writing data, device, electronic equipment and storage medium | |
CN110020271A (en) | Method and system for cache management | |
CN112199923A (en) | Identification generation method, system, device and medium based on distributed system | |
CN115658171A (en) | Method and system for solving dynamic refreshing of java distributed application configuration in lightweight mode | |
CN106446272B (en) | Method and apparatus for sending data | |
CN109271224A (en) | Method and apparatus for determining position |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |