A kind of update method of data, apparatus and system
Technical field
This specification is related to field of computer technology more particularly to a kind of update method of data, apparatus and system.
Background technique
With the continuous development of network technology and terminal technology, the type of network service is more and more abundant, and each net
The data volume of network business is also increasing.In order to improve the treatment effeciency of business, distributed system is come into being, distributed system
In server dispersion deployment is carried out by distributed deployment mode.
With the extensive use of distributed deployment mode, the requirement to the response time of deployment node is higher and higher, in order to
Response speed is provided, then usual people, can pass through the side of timed task by the data buffer storage being commonly used into memory
The above-mentioned data cached in the memory of server are periodically flushed in formula, so that the above-mentioned data in memory are in last state.So
And in practical applications, there are a type of data (such as configuration class data), and the variation frequency of the data of the type is not high,
That is to say that the data of the type may usually take a long time can just change.Therefore, if being directed to the number of the type
It is data cached according to equally using the mode such as above-mentioned timed task to update, then in order to save computing resource, need to brush timing
New period setting is longer, if the data of the type change, generally requiring a very long time just executes and cache more
Newly, it is possible to will cause the unavailable of business and within above-mentioned a period of time, so that service disconnection, business processing low efficiency
Under, therefore, in the more frontier of data, a kind of data cached variation of quick sensing is needed, and carry out buffer update and more efficient
The more new solution of the data of rate.
Summary of the invention
The purpose of this specification embodiment is to provide a kind of update method of data, apparatus and system, a kind of fast to provide
Speed perceives data cached variation, and carries out the more new solution of the data of buffer update and higher efficiency.
To realize that above-mentioned technical proposal, this specification embodiment are achieved in that
A kind of update method for data that this specification embodiment provides, which comprises
The buffer update event of target data is obtained, includes the mark of the target data in the buffer update event;
The corresponding device identification of mark of the target data is obtained from buffer update subscription database;
The buffer update notification message of the target data is sent to the corresponding first server of the device identification, so that
The first server is updated the target data of caching.
Optionally, before the buffer update event for obtaining target data, the method also includes:
The buffer update for receiving the target data that the first server is sent subscribes to request, and the buffer update is ordered
Read the device identification of the mark and the first server in request including the target data;
The buffer update is arrived into the device identification of first server storage corresponding with the mark of the target data
In subscription database.
Optionally, the target data is the data that the adjacent interval duration cached twice is more than scheduled duration threshold value.
Optionally, the buffer update event for obtaining target data, comprising:
Receive the buffer update event for the target data that second server is sent, the first server and described the
Two servers belong to the same business cluster.
Optionally, the corresponding relationship in the buffer update subscription database between the mark and device identification of data is logical
Cross DRM mechanism or Apache Kafka mechanism construction.
A kind of update method for data that this specification embodiment provides, which comprises
Receive the buffer update notification message for the target data that third server is sent;
The more new data of the target data is obtained from database;
It is updated according to the target data of the more new data to caching.
Optionally, the method also includes:
If the updating target data failure obtains the mesh when reaching the buffer update period of target data
Mark the recent renewal time of data;
Determine the recent renewal time of the target data and the interval duration at current time;
If the interval duration is less than the buffer update period, cancels and the target data of caching is carried out more
Newly;
If the interval duration is greater than the buffer update period, the target data is obtained from database more
New data, and be updated according to the target data of the more new data to caching.
A kind of update method for data that this specification embodiment provides, which comprises
Business datum is obtained, includes the more new data of target data in the business datum;
By business datum storage into database, and according to the more new data to the target data of caching into
Row updates;
The buffer update event of the target data is sent to third server.
A kind of third server that this specification embodiment provides, the third server include:
Update event obtains module and wraps in the buffer update event for obtaining the buffer update event of target data
Include the mark of the target data;
Identifier acquisition module, mark for obtaining the target data from buffer update subscription database is corresponding to be set
Standby mark;
Sending module is notified, for sending the caching of the target data to the corresponding first server of the device identification
Update notification message, so that the first server is updated the target data of caching.
Optionally, the third server further include:
Request receiving module is subscribed to, the buffer update for receiving the target data that the first server is sent is ordered
Request is read, it includes the mark of the target data and the equipment mark of the first server in request that the buffer update, which is subscribed to,
Know;
Memory module, for arriving the device identification of first server storage corresponding with the mark of the target data
In the buffer update subscription database.
Optionally, the target data is the data that the adjacent interval duration cached twice is more than scheduled duration threshold value.
Optionally, the update event obtains module, for receive second server transmission the target data it is slow
Update event is deposited, the first server and the second server belong to the same business cluster.
Optionally, the corresponding relationship in the buffer update subscription database between the mark and device identification of data is logical
Cross DRM mechanism or Apache Kafka mechanism construction.
A kind of first server that this specification embodiment provides, the first server include:
Notify receiving module, the buffer update notification message of the target data for receiving the transmission of third server;
Data acquisition module is updated, for obtaining the more new data of the target data from database;
Update module, for being updated according to the more new data to the target data of caching.
Optionally, the first server includes:
Nearest time-obtaining module, if failed for the updating target data, in the caching for reaching target data
When the update cycle, the recent renewal time of the target data is obtained;
It is spaced duration determining module, when for determining recent renewal time and the interval at current time of the target data
It is long;
Cancel module, if being less than the buffer update period for the interval duration, cancels to described in caching
Target data is updated;
The update module, if being also used to the interval duration greater than the buffer update period, from database
The more new data of the target data is obtained, and is updated according to the target data of the more new data to caching.
A kind of second server that this specification embodiment provides, the second server include:
Data acquisition module includes the more new data of target data for obtaining business datum, in the business datum;
Processing module, for storing the business datum into database, and according to the more new data to caching
The target data is updated;
Update event sending module, for sending the buffer update event of the target data to third server.
A kind of third server that this specification embodiment provides, the third server further include:
Processor;And
It is arranged to the memory of storage computer executable instructions, the executable instruction makes the place when executed
Manage device:
The buffer update event of target data is obtained, includes the mark of the target data in the buffer update event;
The corresponding device identification of mark of the target data is obtained from buffer update subscription database;
The buffer update notification message of the target data is sent to the corresponding first server of the device identification, so that
The first server is updated the target data of caching.
A kind of first server that this specification embodiment provides, the first server include:
Processor;And
It is arranged to the memory of storage computer executable instructions, the executable instruction makes the place when executed
Manage device:
Receive the buffer update notification message for the target data that third server is sent;
The more new data of the target data is obtained from database;
It is updated according to the target data of the more new data to caching.
A kind of second server that this specification embodiment provides, the second server include:
Processor;And
It is arranged to the memory of storage computer executable instructions, the executable instruction makes the place when executed
Manage device:
Business datum is obtained, includes the more new data of target data in the business datum;
By business datum storage into database, and according to the more new data to the target data of caching into
Row updates;
The buffer update event of the target data is sent to third server.
A kind of more new system for data that this specification embodiment provides, the more new system of the data include such as above-mentioned reality
Third server, first server such as provided by the above embodiment and the second service provided by the above embodiment of example offer are provided
Device, in which:
The first server and the second server belong to the same business cluster.
The technical solution provided by above this specification embodiment is as it can be seen that this specification embodiment passes through acquisition target data
Buffer update event, include the mark of target data in the buffer update event, then, from buffer update subscription database
The corresponding device identification of mark of target data is obtained, finally, sends number of targets to the corresponding first server of the device identification
According to buffer update notification message so that first server is updated the target data of caching, in this way, can be in caching
When target data changes, closed by the way that the mark of target data in buffer update subscription database is corresponding with device identification
System determines the first server for needing to update the target data of caching, and the target that notice first server caches it in time
Data are updated, so that cache contents can be updated in first time by being cached with the server of target data, are realized
To the quick sensing of data cached variation, the update efficiency of the data in caching is improved.
Detailed description of the invention
In order to illustrate more clearly of this specification embodiment or technical solution in the prior art, below will to embodiment or
Attached drawing needed to be used in the description of the prior art is briefly described, it should be apparent that, the accompanying drawings in the following description is only
The some embodiments recorded in this specification, for those of ordinary skill in the art, in not making the creative labor property
Under the premise of, it is also possible to obtain other drawings based on these drawings.
Fig. 1 is a kind of update method embodiment of data of this specification;
Fig. 2 is a kind of structural schematic diagram of the more new system of data of this specification;
Fig. 3 is the update method embodiment of this specification another kind data;
Fig. 4 is the update method embodiment of another data of this specification;
Fig. 5 is the update method embodiment of another data of this specification;
Fig. 6 is a kind of third server example of this specification;
Fig. 7 is a kind of first server embodiment of this specification;
Fig. 8 is a kind of second server embodiment of this specification;
Fig. 9 is a kind of server example of this specification.
Specific embodiment
This specification embodiment provides a kind of update method of data, apparatus and system.
In order to make those skilled in the art more fully understand the technical solution in this specification, below in conjunction with this explanation
Attached drawing in book embodiment is clearly and completely described the technical solution in this specification embodiment, it is clear that described
Embodiment be only this specification a part of the embodiment, instead of all the embodiments.The embodiment of base in this manual,
Every other embodiment obtained by those of ordinary skill in the art without making creative efforts, all should belong to
The range of this specification protection.
Embodiment one
As shown in Figure 1, this specification embodiment provides a kind of update method of data, the executing subject of this method can be
Server, wherein the server can be independent server, be also possible in the server cluster being made of multiple servers
One or more servers can also moreover, the server can be the background server of a certain business (such as finance services)
To be the background server etc. of certain website (such as shopping website or payment application).This method can be used for being buffered in certain service
When data in device change, notifies or control in time the server and the data of caching are updated etc. in processing.In order to
It is distinguished with subsequent related content, the executing subject server in the present embodiment is properly termed as second server.This method tool
Body may comprise steps of:
In step s 102, business datum is obtained, includes the more new data of target data in the business datum.
Wherein, business datum can with the related data of certain one or more business, such as transferred account service related data or
The related data etc. of payment transaction.Target data can be any data for needing to cache, specific such as configuration class data or specified
Service class data etc..More new data can be different data between the target data for updating front and back, and more new data can also
To be updated target data etc..
In an implementation, with the continuous development of network technology and terminal technology, the type of network service is more and more abundant, and
And the data volume of each network service is also increasing.In order to improve the treatment effeciency of business, distributed system is come into being, point
Server in cloth system carries out dispersion deployment by distributed deployment mode.
With the extensive use of distributed deployment mode, the requirement to the response time of deployment node is higher and higher, in order to
Response speed is provided, then usual people, can pass through the side of timed task by the data buffer storage being commonly used into memory
The above-mentioned data cached in the memory of server are periodically flushed in formula, so that the above-mentioned data in memory are in last state.So
And in practical applications, there are a type of data (such as configuration class data), and the variation frequency of the data of the type is not high,
That is to say that the data of the type may usually take a long time can just change.Therefore, if being directed to the number of the type
It is data cached according to equally using the mode such as above-mentioned timed task to update, then in order to save computing resource, need to brush timing
New period setting is longer, if the data of the type change, generally requiring a very long time just executes and cache more
Newly, it is possible to will cause the unavailable of business and within above-mentioned a period of time, so that service disconnection, business processing low efficiency
Under, for this purpose, this specification embodiment provides a kind of feasible program that can solve the above problem, can specifically include in following
Hold:
For a certain item business (such as financial business), the application program and business procedure of this business can be set, with
And the service system of this business, the server in the service system can be disposed by distributed deployment mode, this is answered
It may be mounted in the terminal device of user with program, business procedure may be mounted in server.When service system starting,
It can star the business procedure, in the database by the storage of corresponding data, each server in service system can be from data
Common data (i.e. target data) in the business are obtained in library to be cached.
When user needs to be implemented a certain business, the application program installed in terminal device can star, this applies journey
It may include option, key and link etc. in sequence, user can according to need the triggering that the item handled searches corresponding business
Mode (such as above-mentioned option, key or link), then, user can click corresponding option, key or link etc., terminal
Equipment can obtain corresponding data from the server in service system, and the data are presented to the user, and user can be with needle
Business processing is carried out to the data of acquisition.During carrying out business processing, may modify to target data (such as to
Wherein increase new data, or modification data content therein, or delete data content therein etc.), can generate in this way including
The business datum can be sent to second server by the business datum of the more new data of target data, terminal device, thus the
Two servers can receive the business datum of the more new data including target data.
In step S104, by the storage of above-mentioned business datum into database, and according to above-mentioned more new data to caching
Target data is updated.
Wherein, database can be the warehouse for coming tissue, storage and management data according to scheduled data structure, this explanation
In book embodiment, database can be used for storage and management business datum.
In an implementation, after second server receives business datum, can by the business datum store into database into
Row persistence saves.Due to being cached with target data in second server, at this point it is possible to obtain the update number in business datum
According to if the more new data is updated target data, second server can directly be replaced using more new data current
The target data of caching, if the more new data is to update different data between the target data of front and back, second service
The corresponding data content in the target data for updating data change current cache can be used in device.
In step s 106, the buffer update event of target data is sent to third server.
Wherein, buffer update event can be the event being updated to certain data of caching, and buffer update event can be with
Buffer update processing is executed for triggering corresponding equipment (such as server or terminal device).Third server, which can be, to be used for
Control or trigger the server that some or multiple servers for being cached with target data are updated target data, third clothes
Business device can be an independent server, be also possible to the server cluster etc. being made of multiple servers.
In an implementation, as shown in Fig. 2, each server therein can be with due to including multiple servers in operation system
It is an independent server, that is to say between multiple servers in operation system independently of each other, in order to notify business in time
Other servers in system are updated the target data of caching, and the caching of target data can be generated more in second server
New events, and the buffer update event of the target data can be sent to third server, so as to third server and time control
System or triggering operation system in other servers timely update its caching data.
It should be noted that the processing of above-mentioned steps S104 and step S106 can not no time sequencing restriction, i.e., on
The processing for stating step S104 and step S106 may be performed simultaneously, can also one of step first carry out, another step
It is executed again after previous step.
As shown in figure 3, this specification embodiment provides a kind of update method of data, the executing subject of this method can be
Server, wherein the server can be independent server, be also possible to the server cluster being made of multiple servers,
Moreover, the server can be the management server of the background server of a certain business (such as finance services), it is also possible to certain
The management server etc. of the background server of website (such as shopping website or payment application).This method can be used for being buffered in
When data in certain server change, notifies or control in time the server and processing is updated etc. to the data of caching
In.In order to distinguish with subsequent related content, the executing subject server in the present embodiment is properly termed as third server.It should
Method can specifically include following steps:
In step s 302, the buffer update event of target data is obtained, includes target data in the buffer update event
Mark.
Wherein, the mark of target data can be used for distinguishing target data and other data, which specifically can be mesh
Mark title or the coding etc. of data.
In an implementation, based on related content corresponding to above-mentioned Fig. 1, second server can send mesh to third server
The buffer update event of data is marked, correspondingly, the available buffer update event to the target data of third server, and
It may include the mark of target data in the slow update event, in this way, can be convenient subsequent lookup needs to carry out buffer update
Server.
In step s 304, the corresponding device identification of mark of target data is obtained from buffer update subscription database.
Wherein, device identification can be title or coding of equipment etc., such as IMEI (International Mobile
Equipment Identity, international mobile device identification) code etc..Buffer update subscription database can be used for memory buffers
The database of corresponding relationship between data and the equipment for caching the data, in practical applications, buffer update subscription database
In above-mentioned corresponding relationship can determine that above-mentioned corresponding relationship can be in table form by the mark of data and device identification
Storage, as shown in table 1.
Table 1
The mark of data |
Device identification |
Data A |
Server 1 |
Data A |
Server 2 |
Data B |
Server 1 |
It in an implementation, can be from buffer update thing after third server gets the buffer update event of target data
The mark of target data is extracted in part, it is then possible to search from buffer update subscription database, wherein whether including number of targets
According to mark, if in buffer update subscription database be not present target data mark, show other in operation system
The target data is not cached in server, at this point, third server can be without any processing.If buffer update subscription
According to the mark in library there are target data, the then corresponding device identification of the mark of available target data.For example, if target
Data are identified as data A, data A can be searched from buffer update subscription database as shown in Table 1 above, and can obtain
Access is according to the corresponding device identification of A, i.e. server 1 and server 2.
In step S306, the buffer update notice of target data is sent to the corresponding first server of above-mentioned device identification
Message, so that first server is updated the target data of caching.
Wherein, first server can be the server for being cached with target data, and first server may include a clothes
Business device can also include multiple servers etc..
In an implementation, after the corresponding device identification of the mark for obtaining target data by above-mentioned processing, available equipment
Corresponding first server is identified, since the target data cached in first server is updated in a timely manner not yet, third
Server can send the buffer update notification message of target data to first server.Based on the example of above-mentioned steps S304,
Third server can send the buffer update notification message of target data to server 1 and server 2 respectively.
After first server receives the buffer update notification message of target data, number of targets can be obtained from database
According to more new data, and the target data of current cache in first server is updated using the more new data, is obtained more
Target data after new, specifically, if the more new data is updated target data, first server can directly make
The target data of current cache is replaced with more new data, if the more new data is not identical between the target data of update front and back
Data, then first server can be used update data change current cache target data in corresponding data content.
As shown in figure 4, this specification embodiment provides a kind of update method of data, the executing subject of this method can be
Server, wherein the server can be independent server, be also possible in the server cluster being made of multiple servers
One or more servers can also moreover, the server can be the background server of a certain business (such as finance services)
To be the background server etc. of certain website (such as shopping website or payment application).This method can be used for being buffered in certain service
When data in device change, notifies or control in time the server and the data of caching are updated etc. in processing.In order to
It is distinguished with subsequent related content, the executing subject server in the present embodiment is properly termed as first server.This method tool
Body may comprise steps of:
In step S402, the buffer update notification message for the target data that third server is sent is received.
In step s 404, the more new data of target data is obtained from database.
In step S406, the target data of caching is updated according to the more new data.
In an implementation, if the more new data is updated target data, first server can be directly using more
New data replaces the target data of current cache, if the more new data is to update different number between the target data of front and back
According to then the corresponding data content in the target data for updating data change current cache can be used in first server.
This specification embodiment provides a kind of update method of data, by obtaining the buffer update event of target data,
It include then the mark of target data obtains target data from buffer update subscription database in the buffer update event
Corresponding device identification is identified, finally, the buffer update for sending target data to the corresponding first server of the device identification is logical
Message is known, so that first server is updated the target data of caching, in this way, can become in the target data of caching
When change, by the mark of target data in buffer update subscription database and the corresponding relationship of device identification, determination needs to update
The first server of the target data of caching, and notice first server is updated the target data that it is cached in time, from
And the server for being cached with target data is allowed to update cache contents in first time, it realizes to data cached variation
Quick sensing improves the update efficiency of the data in caching.
Embodiment two
As shown in figure 5, this specification embodiment provides a kind of update method of data, the executing subject of this method can be
First server, second server and third server, wherein first server and second server can be by multiple services
Any two or multiple servers, second server in the server cluster of device composition can be any in server cluster
Server, first server can be one or more servers in server cluster, and third server can be independent
Server is also possible to the server cluster being made of multiple servers, moreover, first server and second server can be
The background server of a certain business (such as finance services), after being also possible to certain website (such as shopping website or payment application)
Platform server etc., third server can be the management server of first server and second server.This method can be used for
When the data being buffered in certain server change, notifies or control in time the server and the data of caching are updated
Deng in processing.This method can specifically include following steps:
In order to notify in time the server for being cached with certain data (i.e. target data) timely update its caching target
Data avoid the occurrence of the unavailable phenomenon of business and occur, can first pass through preset treatment mechanism for target data and caching
There is the server of target data to be marked, specifically may refer to the processing of following step S502 and step S504.
In step S502, the buffer update subscription that third server receives the target data that first server is sent is asked
It asks, which subscribes to the device identification of the mark and first server in request including target data.
Wherein, target data can be more than the data of scheduled duration threshold value, i.e. mesh for the adjacent interval duration cached twice
The lower data of frequency that mark data can be changed with data content, the configuration data of specific such as operation system.
In an implementation, for a certain item business, first server and second server can be the background service of the business
Device, first server and second server can be disposed by distributed deployment mode.When the corresponding program of the business opens
When dynamic, the background server of the business can be stored corresponding data in the database, and the background server of the business can be with
It is cached from common data (i.e. target data) in the business are obtained in database.After the completion of caching, it is cached with the target
The server (such as first server and/or second server) of data can obtain the mark and service of the target data respectively
The device identification of device, and request is subscribed to based on the buffer update that above- mentioned information generate target data, it is cached with the target data
Server can send the buffer update to third server and subscribe to request, so that third server can receive target data
Buffer update subscribes to request, and it may include the mark of target data and setting for first server that the buffer update, which is subscribed in request,
Standby mark etc..
In step S504, third server by the device identification of first server it is corresponding with the mark of target data storage
Into buffer update subscription database.
Wherein, the corresponding relationship in buffer update subscription database between the mark and device identification of data is to pass through DRM
Mechanism or Apache Kafka mechanism construction, in practical applications, the build mechanism of above-mentioned corresponding relationship is not limited to above-mentioned side
Formula can also construct above-mentioned corresponding relationship in several ways, specifically may be set according to actual conditions, this specification embodiment
It does not limit this.
It in an implementation, may include that DRM becomes by taking third server uses DRM mechanism as an example, in the third server
More manager can be subscribed to from buffer update and be asked after the buffer update that third server receives target data subscribes to request
The middle mark and device identification for extracting target data is sought, then, DRM change management device mark to the target data and can be set
Standby mark is registered, and Publish-subscribe relationship is established, so that the corresponding server of device identification becomes the slow of target data
It deposits and updates subscriber (or be referred to as cache flush event subscription person etc.).By the above-mentioned means, can be by first service
The device identification of device and the mark of target data it is corresponding storage into buffer update subscription database.
The case where using Apache Kafka mechanism for third server, may refer to the phase of above-mentioned DRM mechanism inside the Pass
Hold, details are not described herein.
By the corresponding relationship of above-mentioned foundation, third server can be logical in time when determining that target data changes
Know or control and be cached with the server of target data and be updated in time, specifically may refer to following step S506~step S518
Processing.
In step S506, second server obtains business datum, includes the update number of target data in the business datum
According to.
The step content of above-mentioned steps S506 is identical as the step content of step S102 in above-described embodiment one, above-mentioned steps
The concrete processing procedure of S506 may refer to the related content of step S102 in above-described embodiment one, and details are not described herein.
In step S508, second server stores above-mentioned business datum into database, and according to above-mentioned update number
It is updated according to the target data to caching.
The step content of above-mentioned steps S508 is identical as the step content of step S104 in above-described embodiment one, above-mentioned steps
The concrete processing procedure of S508 may refer to the related content of step S104 in above-described embodiment one, and details are not described herein.
In step S510, second server sends the buffer update event of target data, the caching to third server
It include the mark of target data in update event.
The step content of above-mentioned steps S510 is identical as the step content of step S106 in above-described embodiment one, above-mentioned steps
The concrete processing procedure of S510 may refer to the related content of step S106 in above-described embodiment one, and details are not described herein.
Based on above-mentioned steps S506~step S510 processing, during user carries out business processing, if target
Data change, and second server can store updated target data into database, and send to third server
The buffer update event of target data, to notify third server target data to change, so that third server leads in time
Know or control and be cached with other servers of target data target data is updated, specifically may refer to following step S512
With the processing of step S514.
In step S512, the mark that third server obtains target data from buffer update subscription database is corresponding
Device identification.
The step content of above-mentioned steps S512 is identical as the step content of step S304 in above-described embodiment one, above-mentioned steps
The concrete processing procedure of S512 may refer to the related content of step S304 in above-described embodiment one, and details are not described herein.
In step S514, third server sends the slow of target data to the corresponding first server of above-mentioned device identification
Deposit update notification message.
The step content of above-mentioned steps S514 is identical as the step content of step S306 in above-described embodiment one, above-mentioned steps
The concrete processing procedure of S514 may refer to the related content of step S306 in above-described embodiment one, and details are not described herein.
The processing of S512 and step S514 through the above steps, third server from by DRM change management device register
It is searched in buffer update subscriber, the buffer update subscriber of target data, i.e. first server, it is then possible to the first clothes
The buffer update notification message for device transmission target data of being engaged in, the target data that it is cached so that first server timely updates, tool
The processing that body updates caching may refer to the processing of following step S516 and step S518.
In step S516, first server obtains the more new data of target data from database.
The step content of above-mentioned steps S516 is identical as the step content of step S406 in above-described embodiment one, above-mentioned steps
The concrete processing procedure of S516 may refer to the related content of step S406 in above-described embodiment one, and details are not described herein.
In step S518, first server is updated according to target data of the more new data to caching.
The step content of above-mentioned steps S518 is identical as the step content of step S406 in above-described embodiment one, above-mentioned steps
The concrete processing procedure of S518 may refer to the related content of step S406 in above-described embodiment one, and details are not described herein.
In practical applications, first server can be potentially encountered during the target data to caching is updated
Certain failures and make the target data of caching be unable to complete update, at this point, a kind of processing mode can be with are as follows: first server can
To send the notification message for updating failure to third server, third server sends target data to first server again
Buffer update notification message, until first server completes the update of target data.It can also handle in the following manner:
Still it is provided with timing in first server and updates data cached mechanism, it can be when updating target data fails, by fixed
Shi Gengxin data cached mechanism carries out data cached update, specifically may refer to the place following step S520~step S526
Reason.
In step S520, if updating target data fails, first server reaches the caching of target data more
When the new period, the recent renewal time of target data is obtained.
Wherein, the buffer update period may be set according to actual conditions, such as 5 seconds or 10 seconds specific.Recent renewal
Time can be the renewal time of currently stored target data.
In an implementation, if during first server is updated according to target data of the more new data to caching,
Updating target data failure, then first server can be by being arranged mesh of the data cached mechanism of update to caching of its setting
Whether mark data are updated, can be the target data that updates in the recent period using currently stored target data as sentencing specifically
Disconnected basis, to start the execution for updating data cached mechanism, for this purpose, can be in the buffer update period for reaching target data
When, obtain the renewal time of currently stored target data, the renewal time that can be will acquire as target data recently more
The new time.
In step S522, when first server determines recent renewal time and the interval at current time of target data
It is long.
In an implementation, the time at first server available current time, it is then possible to calculate the nearest of target data
The difference of the time at renewal time and current time, obtained difference is to be spaced duration, such as 10 seconds or 20 seconds specific.
In step S524, if above-mentioned interval duration is less than the buffer update period, first server is cancelled to caching
Target data be updated.
In an implementation, if above-mentioned interval duration is less than the buffer update period, currently stored target data has been shown
It is the data updated in the recent period, at this point it is possible to do not need again to be updated the target data of caching, i.e. first server can be with
Cancellation is updated the target data of caching.
In step S526, if above-mentioned interval duration is greater than the buffer update period, first server is from database
The more new data of target data is obtained, and the target data of caching is updated according to the more new data.
In an implementation, if above-mentioned interval duration is greater than the buffer update period, show that currently stored target data needs
It is updated, at this point, first server can obtain the more new data of target data from database, and according to the update number
It is updated according to the target data to caching, concrete processing procedure may refer to above-mentioned related content, and details are not described herein.
It is held it should be noted that above-mentioned steps S520~step S526 processing can be in updating target data failure
Row can also execute, i.e., when third server fails to the buffer update notification message that first server sends target data
If it is determined that above-mentioned buffer update notification message sends failure, then first server is in the buffer update period for reaching target data
When, the recent renewal time of target data is obtained, and then determine recent renewal time and the interval at current time of target data
Duration, if above-mentioned interval duration is less than the buffer update period, cancellation is updated the target data of caching, if above-mentioned
It is spaced duration and is greater than the buffer update period, then obtain the more new data of target data from database, and according to the more new data
The target data of caching is updated.
This specification embodiment provides a kind of update method of data, by obtaining the buffer update event of target data,
It include then the mark of target data obtains target data from buffer update subscription database in the buffer update event
Corresponding device identification is identified, finally, the buffer update for sending target data to the corresponding first server of the device identification is logical
Message is known, so that first server is updated the target data of caching, in this way, can become in the target data of caching
When change, by the mark of target data in buffer update subscription database and the corresponding relationship of device identification, determination needs to update
The first server of the target data of caching, and notice first server is updated the target data that it is cached in time, from
And the server for being cached with target data is allowed to update cache contents in first time, it realizes to data cached variation
Quick sensing improves the update efficiency of the data in caching.
Embodiment three
The above are the update methods for the data that this specification embodiment provides, and are based on same thinking, and this specification is implemented
Example also provides a kind of third server, as shown in Figure 6.
The third server includes: that update event obtains module 601, identifier acquisition module 602 and notice sending module
603, in which:
Update event obtains module 601, for obtaining the buffer update event of target data, in the buffer update event
Mark including the target data;
Identifier acquisition module 602, the mark for obtaining the target data from buffer update subscription database are corresponding
Device identification;
Sending module 603 is notified, for sending the target data to the corresponding first server of the device identification
Buffer update notification message, so that the first server is updated the target data of caching.
In this specification embodiment, the third server further include:
Request receiving module is subscribed to, the buffer update for receiving the target data that the first server is sent is ordered
Request is read, it includes the mark of the target data and the equipment mark of the first server in request that the buffer update, which is subscribed to,
Know;
Memory module, for arriving the device identification of first server storage corresponding with the mark of the target data
In the buffer update subscription database.
In this specification embodiment, the target data is that the adjacent interval duration cached twice is more than scheduled duration threshold value
Data.
In this specification embodiment, the update event obtains module 601, for receiving described in second server transmission
The buffer update event of target data, the first server and the second server belong to the same business cluster.
Pair in this specification embodiment, in the buffer update subscription database between the mark and device identification of data
Should be related to it is by DRM mechanism or Apache Kafka mechanism construction.
This specification embodiment provides a kind of third server, and by obtaining the buffer update event of target data, this is slow
The mark in update event including target data is deposited, then, the mark of target data is obtained from buffer update subscription database
Corresponding device identification, finally, the buffer update notice for sending target data to the corresponding first server of the device identification disappear
Breath, so that first server is updated the target data of caching, in this way, can change in the target data of caching
When, by the mark of target data in buffer update subscription database and the corresponding relationship of device identification, determines to need to update and delay
The first server for the target data deposited, and notice first server is updated the target data that it is cached in time, thus
Allow the server for being cached with target data to update cache contents in first time, realizes to the fast of data cached variation
Speed perception, improves the update efficiency of the data in caching.
Example IV
Based on same thinking, this specification embodiment also provides a kind of first server, as shown in Figure 7.
The first server includes: notice receiving module 701, updates data acquisition module 702 and update module 703,
In:
Notify receiving module 701, the buffer update notification message of the target data for receiving the transmission of third server;
Data acquisition module 702 is updated, for obtaining the more new data of the target data from database;
Update module 703, for being updated according to the more new data to the target data of caching.
In this specification embodiment, the first server further include:
Nearest time-obtaining module, if failed for the updating target data, in the caching for reaching target data
When the update cycle, the recent renewal time of the target data is obtained;
It is spaced duration determining module, when for determining recent renewal time and the interval at current time of the target data
It is long;
Cancel module, if being less than the buffer update period for the interval duration, cancels to described in caching
Target data is updated;
The update module 703, if being also used to the interval duration greater than the buffer update period, from database
The middle more new data for obtaining the target data, and be updated according to the target data of the more new data to caching.
This specification embodiment provides a kind of first server, by obtaining the caching of target data in third server more
New events include then the mark of target data obtains target from buffer update subscription database in the buffer update event
The corresponding device identification of the mark of data finally sends the caching of target data to the corresponding first server of the device identification
Update notification message, so that first server is updated the target data of caching, in this way, can be in the target data of caching
When changing, by the mark of target data in buffer update subscription database and the corresponding relationship of device identification, determining is needed
The first server of the target data of caching is updated, and the target data that notice first server caches it in time carries out more
Newly, it so that cache contents can be updated in first time by being cached with the server of target data, realizes to data cached
The quick sensing of variation improves the update efficiency of the data in caching.
Embodiment five
Based on same thinking, this specification embodiment also provides a kind of second server, as shown in Figure 8.
The second server includes: data acquisition module 801, processing module 802 and update event sending module 803,
In:
Data acquisition module 801 includes the update number of target data for obtaining business datum, in the business datum
According to;
Processing module 802, for storing the business datum into database, and according to the more new data to caching
The target data be updated;
Update event sending module 803, for sending the buffer update event of the target data to third server.
This specification embodiment provides a kind of second server, and the buffer update of target data is obtained by third server
Event includes then the mark of target data obtains number of targets from buffer update subscription database in the buffer update event
According to the corresponding device identification of mark finally send the caching of target data more to the corresponding first server of the device identification
New notification message, so that first server is updated the target data of caching, in this way, can send out in the target data of caching
When changing, by the mark of target data in buffer update subscription database and the corresponding relationship of device identification, determines and need
The first server of the target data of caching is updated, and the target data that notice first server caches it in time carries out more
Newly, it so that cache contents can be updated in first time by being cached with the server of target data, realizes to data cached
The quick sensing of variation improves the update efficiency of the data in caching.
Embodiment six
The above are the second servers that this specification embodiment provides, and are based on same thinking, this specification embodiment is also
A kind of server is provided, as shown in Figure 9.
The server can be first server provided by the above embodiment, second server or third server.
Server can generate bigger difference because configuration or performance are different, may include one or more place
Device 901 and memory 902 are managed, can store one or more storage application programs or data in memory 902.Its
In, memory 902 can be of short duration storage or persistent storage.Be stored in memory 902 application program may include one or
More than one module (diagram is not shown), each module may include to the series of computation machine executable instruction in server.
Further, processor 901 can be set to communicate with memory 902, execute the system in memory 902 on the server
Column count machine executable instruction.Server can also include one or more power supplys 903, one or more it is wired or
Radio network interface 904, one or more input/output interfaces 905, one or more keyboards 906.
Specifically in the present embodiment, server includes memory and one or more program, one of them
Perhaps more than one program is stored in memory and one or more than one program may include one or more moulds
Block, and each module may include to the series of computation machine executable instruction in server, and be configured to by one or
It includes for carrying out following computer executable instructions that more than one processor, which executes this or more than one program:
The buffer update event of target data is obtained, includes the mark of the target data in the buffer update event;
The corresponding device identification of mark of the target data is obtained from buffer update subscription database;
The buffer update notification message of the target data is sent to the corresponding first server of the device identification, so that
The first server is updated the target data of caching.
In this specification embodiment, before the buffer update event for obtaining target data, further includes:
The buffer update for receiving the target data that the first server is sent subscribes to request, and the buffer update is ordered
Read the device identification of the mark and the first server in request including the target data;
The buffer update is arrived into the device identification of first server storage corresponding with the mark of the target data
In subscription database.
In this specification embodiment, the target data is that the adjacent interval duration cached twice is more than scheduled duration threshold value
Data.
In this specification embodiment, the buffer update event for obtaining target data, comprising:
Receive the buffer update event for the target data that second server is sent, the first server and described the
Two servers belong to the same business cluster.
Pair in this specification embodiment, in the buffer update subscription database between the mark and device identification of data
Should be related to it is by DRM mechanism or Apache Kafka mechanism construction.
Specifically in the present embodiment, server includes memory and one or more program, one of them
Perhaps more than one program is stored in memory and one or more than one program may include one or more moulds
Block, and each module may include to the series of computation machine executable instruction in server, and be configured to by one or
It includes for carrying out following computer executable instructions that more than one processor, which executes this or more than one program:
Receive the buffer update notification message for the target data that third server is sent;
The more new data of the target data is obtained from database;
It is updated according to the target data of the more new data to caching.
In this specification embodiment, further includes:
If the updating target data failure obtains the mesh when reaching the buffer update period of target data
Mark the recent renewal time of data;
Determine the recent renewal time of the target data and the interval duration at current time;
If the interval duration is less than the buffer update period, cancels and the target data of caching is carried out more
Newly;
If the interval duration is greater than the buffer update period, the target data is obtained from database more
New data, and be updated according to the target data of the more new data to caching.
Specifically in the present embodiment, server includes memory and one or more program, one of them
Perhaps more than one program is stored in memory and one or more than one program may include one or more moulds
Block, and each module may include to the series of computation machine executable instruction in server, and be configured to by one or
It includes for carrying out following computer executable instructions that more than one processor, which executes this or more than one program:
Business datum is obtained, includes the more new data of target data in the business datum;
By business datum storage into database, and according to the more new data to the target data of caching into
Row updates;
The buffer update event of the target data is sent to third server.
This specification embodiment provides a kind of server, and the buffer update thing of target data is obtained by third server
Part includes then the mark of target data obtains target data from buffer update subscription database in the buffer update event
The corresponding device identification of mark the buffer update of target data is finally sent to the corresponding first server of the device identification
Notification message, so that first server is updated the target data of caching, in this way, can occur in the target data of caching
When variation, by the mark of target data in buffer update subscription database and the corresponding relationship of device identification, determines and need more
The first server of the target data newly cached, and notice first server is updated the target data that it is cached in time,
So that cache contents can be updated in first time by being cached with the server of target data, realize to data cached variation
Quick sensing, improve caching in data update efficiency.
Embodiment seven
Based on same thinking, this specification embodiment also provides a kind of more new system of data, as shown in Figure 2.
The more new system of the data includes third server, first server and second server, in which:
The first server and the second server belong to the same business cluster.
The third server includes in the buffer update event for obtaining the buffer update event of target data
The mark of the target data;The corresponding equipment mark of mark of the target data is obtained from buffer update subscription database
Know;The buffer update notification message that the target data is sent to the corresponding first server of the device identification, so that described
First server is updated the target data of caching.
In addition, the third server, is also used to receive the caching for the target data that the first server is sent
It updates and subscribes to request, it includes the mark of the target data and setting for the first server that the buffer update, which is subscribed in request,
Standby mark;The device identification of first server storage corresponding with the mark of the target data is ordered to the buffer update
It reads in database.
Wherein, the target data is the data that the adjacent interval duration cached twice is more than scheduled duration threshold value.
In addition, the third server, is also used to receive the buffer update of the target data of second server transmission
Event.
Wherein, the corresponding relationship in the buffer update subscription database between the mark and device identification of data is to pass through
DRM mechanism or Apache Kafka mechanism construction.
In addition, the first server, disappears for receiving the buffer update notice of target data of third server transmission
Breath;The more new data of the target data is obtained from database;According to the more new data to the target data of caching
It is updated.
In addition, the first server reaches target data if being also used to the updating target data failure
When the buffer update period, the recent renewal time of the target data is obtained;Determine the recent renewal time of the target data
With the interval duration at current time;If the interval duration is less than the buffer update period, cancel to described in caching
Target data is updated;If the interval duration is greater than the buffer update period, the mesh is obtained from database
The more new data of data is marked, and is updated according to the target data of the more new data to caching.
In addition, the second server, includes the update of target data for obtaining business datum, in the business datum
Data;By business datum storage into database, and carried out according to the target data of the more new data to caching
It updates;The buffer update event of the target data is sent to third server.
This specification embodiment provides a kind of more new system of data, and the caching of target data is obtained by third server
Update event includes then the mark of target data obtains mesh from buffer update subscription database in the buffer update event
The corresponding device identification of mark of data is marked, finally, sends the slow of target data to the corresponding first server of the device identification
Update notification message is deposited, so that first server is updated the target data of caching, in this way, can be in the number of targets of caching
When according to changing, by the mark of target data in buffer update subscription database and the corresponding relationship of device identification, determine
Need to update the first server of the target data of caching, and the target data that notice first server caches it in time carries out
It updates, so that cache contents can be updated in first time by being cached with the server of target data, realizes to caching number
According to the quick sensing of variation, the update efficiency of the data in caching is improved.
It is above-mentioned that this specification specific embodiment is described.Other embodiments are in the scope of the appended claims
It is interior.In some cases, the movement recorded in detail in the claims or step can be come according to the sequence being different from embodiment
It executes and desired result still may be implemented.In addition, process depicted in the drawing not necessarily require show it is specific suitable
Sequence or consecutive order are just able to achieve desired result.In some embodiments, multitasking and parallel processing be also can
With or may be advantageous.
In the 1990s, the improvement of a technology can be distinguished clearly be on hardware improvement (for example,
Improvement to circuit structures such as diode, transistor, switches) or software on improvement (improvement for method flow).So
And with the development of technology, the improvement of current many method flows can be considered as directly improving for hardware circuit.
Designer nearly all obtains corresponding hardware circuit by the way that improved method flow to be programmed into hardware circuit.Cause
This, it cannot be said that the improvement of a method flow cannot be realized with hardware entities module.For example, programmable logic device
(Programmable Logic Device, PLD) (such as field programmable gate array (Field Programmable Gate
Array, FPGA)) it is exactly such a integrated circuit, logic function determines device programming by user.By designer
Voluntarily programming comes a digital display circuit " integrated " on a piece of PLD, designs and makes without asking chip maker
Dedicated IC chip.Moreover, nowadays, substitution manually makes IC chip, this programming is also used instead mostly " is patrolled
Volume compiler (logic compiler) " software realizes that software compiler used is similar when it writes with program development,
And the source code before compiling also write by handy specific programming language, this is referred to as hardware description language
(Hardware Description Language, HDL), and HDL is also not only a kind of, but there are many kind, such as ABEL
(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description
Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL
(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby
Hardware Description Language) etc., VHDL (Very-High-Speed is most generally used at present
Integrated Circuit Hardware Description Language) and Verilog.Those skilled in the art also answer
This understands, it is only necessary to method flow slightly programming in logic and is programmed into integrated circuit with above-mentioned several hardware description languages,
The hardware circuit for realizing the logical method process can be readily available.
Controller can be implemented in any suitable manner, for example, controller can take such as microprocessor or processing
The computer for the computer readable program code (such as software or firmware) that device and storage can be executed by (micro-) processor can
Read medium, logic gate, switch, specific integrated circuit (Application Specific Integrated Circuit,
ASIC), the form of programmable logic controller (PLC) and insertion microcontroller, the example of controller includes but is not limited to following microcontroller
Device: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320 are deposited
Memory controller is also implemented as a part of the control logic of memory.It is also known in the art that in addition to
Pure computer readable program code mode is realized other than controller, can be made completely by the way that method and step is carried out programming in logic
Controller is obtained to come in fact in the form of logic gate, switch, specific integrated circuit, programmable logic controller (PLC) and insertion microcontroller etc.
Existing identical function.Therefore this controller is considered a kind of hardware component, and to including for realizing various in it
The device of function can also be considered as the structure in hardware component.Or even, it can will be regarded for realizing the device of various functions
For either the software module of implementation method can be the structure in hardware component again.
System, device, module or the unit that above-described embodiment illustrates can specifically realize by computer chip or entity,
Or it is realized by the product with certain function.It is a kind of typically to realize that equipment is computer.Specifically, computer for example may be used
Think personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media play
It is any in device, navigation equipment, electronic mail equipment, game console, tablet computer, wearable device or these equipment
The combination of equipment.
For convenience of description, it is divided into various units when description apparatus above with function to describe respectively.Certainly, implementing this
The function of each unit can be realized in the same or multiple software and or hardware when specification one or more embodiment.
It should be understood by those skilled in the art that, the embodiment of this specification can provide as method, system or computer journey
Sequence product.Therefore, complete hardware embodiment, complete software embodiment or knot can be used in this specification one or more embodiment
The form of embodiment in terms of conjunction software and hardware.Moreover, this specification one or more embodiment can be used at one or more
A wherein includes computer-usable storage medium (the including but not limited to magnetic disk storage, CD- of computer usable program code
ROM, optical memory etc.) on the form of computer program product implemented.
The embodiment of this specification is referring to the method, equipment (system) and computer journey according to this specification embodiment
The flowchart and/or the block diagram of sequence product describes.It should be understood that flow chart and/or box can be realized by computer program instructions
The combination of the process and/or box in each flow and/or block and flowchart and/or the block diagram in figure.It can provide this
A little computer program instructions are to general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices
Processor to generate a machine so that the finger executed by the processor of computer or other programmable data processing devices
It enables and generates to specify in one or more flows of the flowchart and/or one or more blocks of the block diagram
The device of function.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates,
Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or
The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting
Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or
The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one
The step of function of being specified in a box or multiple boxes.
In a typical configuration, calculating equipment includes one or more processors (CPU), input/output interface, net
Network interface and memory.
Memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/or
The forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM).Memory is computer-readable medium
Example.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM),
Digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape magnetic disk storage or other magnetic storage devices
Or any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, it calculates
Machine readable medium does not include temporary computer readable media (transitory media), such as the data-signal and carrier wave of modulation.
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludability
It include so that the process, method, commodity or the equipment that include a series of elements not only include those elements, but also to wrap
Include other elements that are not explicitly listed, or further include for this process, method, commodity or equipment intrinsic want
Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including described want
There is also other identical elements in the process, method of element, commodity or equipment.
It will be understood by those skilled in the art that the embodiment of this specification can provide as the production of method, system or computer program
Product.Therefore, this specification one or more embodiment can be used complete hardware embodiment, complete software embodiment or combine software
With the form of the embodiment of hardware aspect.Moreover, this specification one or more embodiment can be used it is one or more wherein
It include computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, the light of computer usable program code
Learn memory etc.) on the form of computer program product implemented.
This specification one or more embodiment can computer executable instructions it is general on
It hereinafter describes, such as program module.Generally, program module includes executing particular task or realization particular abstract data type
Routine, programs, objects, component, data structure etc..Can also practice in a distributed computing environment this specification one or
Multiple embodiments, in these distributed computing environments, by being executed by the connected remote processing devices of communication network
Task.In a distributed computing environment, the local and remote computer that program module can be located at including storage equipment is deposited
In storage media.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for system reality
For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method
Part explanation.
The foregoing is merely the embodiments of this specification, are not limited to this specification.For art technology
For personnel, this specification can have various modifications and variations.It is all made any within the spirit and principle of this specification
Modification, equivalent replacement, improvement etc., should be included within the scope of the claims of this specification.