CN105574158A - Refreshing method and system of database caching data - Google Patents

Refreshing method and system of database caching data Download PDF

Info

Publication number
CN105574158A
CN105574158A CN201510944487.3A CN201510944487A CN105574158A CN 105574158 A CN105574158 A CN 105574158A CN 201510944487 A CN201510944487 A CN 201510944487A CN 105574158 A CN105574158 A CN 105574158A
Authority
CN
China
Prior art keywords
message
described message
data
time
update time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201510944487.3A
Other languages
Chinese (zh)
Other versions
CN105574158B (en
Inventor
刘嘉扬
程彦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Vipshop Guangzhou Software Co Ltd
Original Assignee
Guangzhou Pinwei Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Pinwei Software Co Ltd filed Critical Guangzhou Pinwei Software Co Ltd
Priority to CN201510944487.3A priority Critical patent/CN105574158B/en
Publication of CN105574158A publication Critical patent/CN105574158A/en
Application granted granted Critical
Publication of CN105574158B publication Critical patent/CN105574158B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a refreshing method and system of database caching data. The refreshing method comprises the following steps: receiving a primary library update message which contains primary library update time which is updated at the time and an updated data object, obtaining the auxiliary library update time of a corresponding data object in an auxiliary library, then, comparing the primary library update time and the auxiliary library update time, and executing a caching data refreshing operation if the auxiliary library update time is longer than the primary library update time. Therefore, the refreshing of the caching data can be realized without a situation that development personnel increase development codes of timing task inspection so as to lower the development cost of the refreshing of the database caching data.

Description

The method for refreshing of database caches data and system thereof
Technical field
The present invention relates to database field, particularly a kind of method for refreshing of database caches data and system thereof.
Background technology
Under the scene that data base read-write is separated, copies from database data and have certain time delay, and the Data Source of buffer memory is from storehouse, when data have amendment, need flush buffers time, need to wait for longer time.
In current existing scheme, normally the information of amendment is recorded in master library, then check from the data storehouse whether have renewal by the mode of timed task inspection, upgrade with regard to flush buffers if find that there is, otherwise continue wait task inspection, therefore, need developer to spend larger energy, increase the exploitation code of timed task inspection to realize data cached refreshing, thus improve the cost of development of database caches Refresh Data.
Summary of the invention
For the problem that the cost of development of the database caches Refresh Data existed in above-mentioned prior art is higher, the object of the present invention is to provide a kind of method for refreshing and system thereof of database caches data, the cost of development of database caches Refresh Data can be reduced.
The method for refreshing of database caches data, comprising:
Receive the message of master library Data Update, described message comprises the data object of this time upgraded and renewal, remembers that the described time is master library update time;
Obtain recent renewal time of respective data object from storehouse, be designated as from storehouse update time, relatively more described from storehouse update time and described master library update time;
To be more than or equal to described master library update time if described from storehouse update time, to perform data cached refresh operation according to described message.
The updating system of database caches data, comprising:
Message reception module, for receiving the message of master library Data Update, described message comprises the data object of this time upgraded and renewal, remembers that the described time is master library update time;
Message comparison module, for obtaining the recent renewal time of respective data object from storehouse, is designated as from storehouse update time, relatively more described from storehouse update time and described master library update time;
Refresh Data module, if to be more than or equal to described master library update time update time from storehouse for described, performs data cached refresh operation according to described message.
The method for refreshing of database caches data of the present invention and system thereof, the master library Data Update message of the data object of this master library update time upgraded and renewal is contained by receiving package, obtain from storehouse respective data object from storehouse update time, then compare from storehouse update time and described master library update time, to be more than or equal to described master library update time if described from storehouse update time, then to perform data cached refresh operation according to described message.Therefore, the exploitation code increasing timed task inspection without the need to developer just can realize data cached refreshing, thus reduces the cost of development of database caches Refresh Data.
Accompanying drawing explanation
Fig. 1 is the schematic flow sheet of the method for refreshing of the database caches data of an embodiment;
Fig. 2 is an instance graph of the method for refreshing of database caches data;
Fig. 3 is the structural representation of the updating system of the database caches data of an embodiment.
Embodiment
In order to make the object, technical solutions and advantages of the present invention clearly, below in conjunction with accompanying drawing, the present invention is described in further detail.
Refer to the schematic flow sheet of the method for refreshing of the database caches data of an embodiment in Fig. 1.
A method for refreshing for database caches data, comprising:
S102, receives the message of master library Data Update, and described message comprises the data object of this time upgraded and renewal, remembers that the described time is master library update time.
By receiving the message of master library Data Update, determining the update time of master library and the data object of renewal, relatively providing benchmark for follow-up update time.
S104, obtains the recent renewal time of respective data object from storehouse, is designated as from storehouse update time, relatively more described from storehouse update time and described master library update time.
By obtaining the recent renewal time of respective data object from storehouse, determine the update time from storehouse, and make comparisons update time to from storehouse update time and master library, judge the update status of respective data object from storehouse, thus improve the convenience judging to upgrade from database data.
S106, to be more than or equal to described master library update time update time, to perform data cached refresh operation according to described message from storehouse if described.
To be more than or equal to described master library update time update time from storehouse if described, illustrate that corresponding data object upgrades in this renewal from storehouse, then perform data cached refresh operation, therefore, by initiatively performing data cached refresh operation, thus shorten data cached wait refresh time, improve data cached refreshing efficiency.
In the present embodiment, the master library Data Update message of the data object of this master library update time upgraded and renewal is contained by receiving package, obtain from storehouse respective data object from storehouse update time, then compare from storehouse update time and described master library update time, to be more than or equal to described master library update time if described from storehouse update time, then to perform data cached refresh operation according to described message.Therefore, the exploitation code increasing timed task inspection without the need to developer just can realize data cached refreshing, thus reduces the cost of development of database caches Refresh Data.
Wherein in an embodiment, described relatively described from storehouse update time and described master library update time, comprise afterwards:
Described master library update time is less than update time from storehouse, by the mark of described message stored in the service queue preset if described.
Wherein, the label being designated the message of this master library Data Update of described message, only need store the mark of described message, thus saves system resource; Described service queue for storing the mark of described message, and is monitored the mark of described message.
Wherein in an embodiment, described by the mark of described message stored in preset service queue, comprise afterwards:
Whether the mark detecting described message reaches setting duration stored in the time of described service queue, if so, returns the response of described message sink failure, again to receive described message.
By detecting, if the mark of described message reaches setting duration stored in the time of described service queue, then return the response of described message sink failure, again to receive described message, and after again receiving described message, again the Data Update situation from storehouse is judged, improve the judgement efficiency upgraded from database data.
Wherein in an embodiment, the message of described reception master library Data Update, comprising:
Receive the message of the master library Data Update of the message queue transmission preset, the message of described message queue Real-time Obtaining master library Data Update, thus the efficiency improving the message obtaining Data Update;
Describedly perform data cached refresh operation according to described message, also comprise afterwards,
Return described message sink to described message queue successfully to respond, in release message queue corresponding message take resource, thus improve the operational efficiency of message queue;
The described response returning described message sink failure, again to receive described message, comprises,
Return the response of described message sink failure to described message queue, and receive the described message that described message queue resends, thus continue to judge the Data Update situation from storehouse, improve the judgement efficiency upgraded from database data.
Fig. 2 is an instance graph of the method for refreshing of database caches data, shown in composition graphs 2, is further detailed below with the method for refreshing embodiment of an instantiation to database caches data of the present invention.
Particularly, between updated components 202 and processing components 203, a message queue 204 is provided with.When master library 200 data have renewal, updated components 202 sends the notification message of renewal buffer memory to message queue 204, and described message comprises the data object of master library update time and renewal; Processing components 203 receives the updating message that described message queue 204 forwards, obtain the recent renewal time (be designated as from storehouse update time) of respective data object from storehouse 201, and it is relatively described from storehouse update time and described master library update time, to be more than or equal to described master library update time update time from storehouse if described, then processing components 203 performs data cached refresh operation according to described message, and returns described message sink to described message queue 204 and successfully respond; Otherwise, by the mark of described message stored in the service queue 205 preset; Whether the mark detecting described message reaches 120 seconds stored in the time of described service queue 205, if, the response of described message sink failure is returned to described message queue 204, and this message is placed back in message queue 204, processing components 203 will receive described message again, take full advantage of the delayed acknowledgement mechanism of message queue, make cache flush become simple and efficient, be conducive to the scene realizing needing asynchronous refresh buffer memory.
Wherein in an embodiment, described message queue is RabbitMQ queue, and described setting duration is 120 seconds.
Described RabbitMQ queue powerful, be easy to use, for the operability of message queue more can be improved in the present embodiment; The setting duration of 120 seconds, while improving the judgement efficiency upgraded from database data, makes the frequency of judgement too not intensive, thus avoids taking too much system resource.
The present invention also provides a kind of updating system of database caches data, as shown in Figure 3, comprising:
Message reception module 300, for receiving the message of master library Data Update, described message comprises the data object of this time upgraded and renewal, remembers that the described time is master library update time.
Described message reception module 300, by receiving the message of master library Data Update, determines the update time of master library and the data object of renewal, relatively provides benchmark for follow-up update time.
Message comparison module 301, for obtaining the recent renewal time of respective data object from storehouse, is designated as from storehouse update time, relatively more described from storehouse update time and described master library update time.
Described message comparison module 301 is by obtaining the recent renewal time of respective data object from storehouse, determine the update time from storehouse, and make comparisons update time to from storehouse update time and master library, judge the update status of respective data object from storehouse, thus improve the convenience judging to upgrade from database data.
Refresh Data module 302, if to be more than or equal to described master library update time update time from storehouse for described, performs data cached refresh operation according to described message.
To be more than or equal to described master library update time update time from storehouse if described, illustrate that corresponding data object upgrades in this renewal from storehouse, then perform data cached refresh operation, therefore, by initiatively performing data cached refresh operation, thus shorten data cached wait refresh time, improve data cached refreshing efficiency.
In the present embodiment, message reception module 300 receiving package contains the master library Data Update message of the data object of this master library update time upgraded and renewal, message comparison module 301 obtain from storehouse respective data object from storehouse update time, then compare from storehouse update time and described master library update time, if Refresh Data module 302 judges the described described master library update time of being more than or equal to update time from storehouse, then perform data cached refresh operation according to described message.Therefore, the exploitation code increasing timed task inspection without the need to developer just can realize data cached refreshing, thus reduces the cost of development of database caches Refresh Data.
Wherein in an embodiment, described Refresh Data module, if to be also less than described master library update time update time, by the mark of described message stored in the service queue preset for described from storehouse.
Wherein in an embodiment, whether described Refresh Data module, also reach setting duration for the mark that detects described message stored in time of described service queue, if so, return the response of described message sink failure, again to receive described message.
Wherein, the label being designated the message of this master library Data Update of described message, only need store the mark of described message, thus saves system resource; Described service queue is for storing the mark of described message, and the mark of described message is monitored, if the mark of described message reaches setting duration stored in the time of described service queue, then return the response of described message sink failure, again to receive described message, thus continue to judge the Data Update situation from storehouse, improve the judgement efficiency upgraded from database data.
Wherein in an embodiment, the updating system of described database caches data also comprises,
Message forwarding module, for the message of the message queue Real-time Obtaining master library Data Update by presetting, thus improves the efficiency of the message obtaining Data Update;
Described message reception module comprises:
Receive submodule, for receiving the message of the master library Data Update that described Message forwarding module sends;
First response submodule, for after performing data cached refresh operation according to described message, return described message sink to described Message forwarding module successfully to respond, take resource with corresponding message in release message queue, thus improve the operational efficiency of message queue;
Second response submodule, if reach setting duration for the mark of described message stored in time of described service queue, the response of described message sink failure is returned to described Message forwarding module, and receive the described message that described Message forwarding module resends, thus continue to judge the Data Update situation from storehouse, improve the judgement efficiency upgraded from database data.
Wherein in an embodiment, described message queue is RabbitMQ queue, and described setting duration is 120 seconds.
Described RabbitMQ queue powerful, be easy to use, for the operability of message queue more can be improved in the present embodiment; The setting duration of 120 seconds, while improving the judgement efficiency upgraded from database data, makes the frequency of judgement too not intensive, thus avoids taking too much system resource.
Each technical characteristic of the above embodiment can combine arbitrarily, for making description succinct, the all possible combination of each technical characteristic in above-described embodiment is not all described, but, as long as the combination of these technical characteristics does not exist contradiction, be all considered to be the scope that this instructions is recorded.
The above embodiment only have expressed several embodiment of the present invention, and it describes comparatively concrete and detailed, but therefore can not be interpreted as the restriction to the scope of the claims of the present invention.It should be pointed out that for the person of ordinary skill of the art, without departing from the inventive concept of the premise, can also make some distortion and improvement, these all belong to protection scope of the present invention.Therefore, the protection domain of patent of the present invention should be as the criterion with claims.

Claims (10)

1. the method for refreshing of database caches data, is characterized in that, comprising:
Receive the message of master library Data Update, described message comprises the data object of this time upgraded and renewal, remembers that the described time is master library update time;
Obtain recent renewal time of respective data object from storehouse, be designated as from storehouse update time, relatively more described from storehouse update time and described master library update time;
To be more than or equal to described master library update time if described from storehouse update time, to perform data cached refresh operation according to described message.
2. the method for refreshing of database caches data according to claim 1, is characterized in that, described relatively described from storehouse update time and described master library update time, comprises afterwards:
Described master library update time is less than update time from storehouse, by the mark of described message stored in the service queue preset if described.
3. the method for refreshing of database caches data according to claim 2, is characterized in that, described by the mark of described message stored in preset service queue, comprise afterwards:
Whether the mark detecting described message reaches setting duration stored in the time of described service queue, if so, returns the response of described message sink failure, again to receive described message.
4. the method for refreshing of database caches data according to claim 3, is characterized in that, the message of described reception master library Data Update, comprising:
Receive the message of the master library Data Update of the message queue transmission preset, the message of described message queue Real-time Obtaining master library Data Update;
Describedly perform data cached refresh operation according to described message, also comprise afterwards,
Return described message sink to described message queue successfully to respond;
The described response returning described message sink failure, again to receive described message, comprises,
Return the response of described message sink failure to described message queue, and receive the described message that described message queue resends.
5. the method for refreshing of database caches data according to claim 4, is characterized in that, described message queue is RabbitMQ queue, and described setting duration is 120 seconds.
6. the updating system of database caches data, is characterized in that, comprising:
Message reception module, for receiving the message of master library Data Update, described message comprises the data object of this time upgraded and renewal, remembers that the described time is master library update time;
Message comparison module, for obtaining the recent renewal time of respective data object from storehouse, is designated as from storehouse update time, relatively more described from storehouse update time and described master library update time;
Refresh Data module, if to be more than or equal to described master library update time update time from storehouse for described, performs data cached refresh operation according to described message.
7. the updating system of database caches data according to claim 6, is characterized in that,
Described Refresh Data module, if to be also less than described master library update time update time, by the mark of described message stored in the service queue preset for described from storehouse.
8. the updating system of database caches data according to claim 7, is characterized in that,
Whether described message reception module, also reach setting duration for the mark that detects described message stored in time of described service queue, if so, return the response of described message sink failure, again to receive described message.
9. the updating system of database caches data according to claim 8, is characterized in that, also comprise,
Message forwarding module, for the message of the message queue Real-time Obtaining master library Data Update by presetting;
Described message reception module comprises:
Receive submodule, for receiving the message of the master library Data Update that described Message forwarding module sends;
First response submodule, for after performing data cached refresh operation according to described message, returns described message sink to described Message forwarding module and successfully responds;
Second response submodule, if reach setting duration for the mark of described message stored in time of described service queue, returns the response of described message sink failure to described Message forwarding module, and receives the described message that described Message forwarding module resends.
10. the updating system of database caches data according to claim 9, is characterized in that, described message queue is RabbitMQ queue, and described setting duration is 120 seconds.
CN201510944487.3A 2015-12-15 2015-12-15 The method for refreshing and its system of database caches data Active CN105574158B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510944487.3A CN105574158B (en) 2015-12-15 2015-12-15 The method for refreshing and its system of database caches data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510944487.3A CN105574158B (en) 2015-12-15 2015-12-15 The method for refreshing and its system of database caches data

Publications (2)

Publication Number Publication Date
CN105574158A true CN105574158A (en) 2016-05-11
CN105574158B CN105574158B (en) 2019-03-12

Family

ID=55884289

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510944487.3A Active CN105574158B (en) 2015-12-15 2015-12-15 The method for refreshing and its system of database caches data

Country Status (1)

Country Link
CN (1) CN105574158B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106202436A (en) * 2016-07-14 2016-12-07 上海超橙科技有限公司 A kind of information updating method and equipment
CN107943958A (en) * 2017-11-24 2018-04-20 税友软件集团股份有限公司 A kind of Individual Income Tax master data sharing method and system
CN108153794A (en) * 2016-12-02 2018-06-12 阿里巴巴集团控股有限公司 Page cache method for refreshing data, apparatus and system
CN113434525A (en) * 2021-06-24 2021-09-24 青岛海尔科技有限公司 Cache data updating method and device, storage medium and electronic device
CN113688146A (en) * 2021-08-23 2021-11-23 猪八戒股份有限公司 Distributed architecture high-concurrency order search engine data refreshing method and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1520562A (en) * 2001-06-30 2004-08-11 国际商业机器公司 System and method for caching mechanism for central synchronization
CN1677340A (en) * 2004-03-29 2005-10-05 联想(北京)有限公司 Message service device and method for console of machine group mornitoring-controlling system
CN101308513A (en) * 2008-06-27 2008-11-19 福建星网锐捷网络有限公司 Distributed system cache data synchronous configuration method and apparatus
CN102023973A (en) * 2009-09-14 2011-04-20 中国移动通信集团公司 Method, device and system for synchronizing database with application cache server
CN103870977A (en) * 2012-12-18 2014-06-18 风网科技(北京)有限公司 Method and system thereof for data synchronizing of mobile advertising platform

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1520562A (en) * 2001-06-30 2004-08-11 国际商业机器公司 System and method for caching mechanism for central synchronization
CN1677340A (en) * 2004-03-29 2005-10-05 联想(北京)有限公司 Message service device and method for console of machine group mornitoring-controlling system
CN101308513A (en) * 2008-06-27 2008-11-19 福建星网锐捷网络有限公司 Distributed system cache data synchronous configuration method and apparatus
CN102023973A (en) * 2009-09-14 2011-04-20 中国移动通信集团公司 Method, device and system for synchronizing database with application cache server
CN103870977A (en) * 2012-12-18 2014-06-18 风网科技(北京)有限公司 Method and system thereof for data synchronizing of mobile advertising platform

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106202436A (en) * 2016-07-14 2016-12-07 上海超橙科技有限公司 A kind of information updating method and equipment
CN108153794A (en) * 2016-12-02 2018-06-12 阿里巴巴集团控股有限公司 Page cache method for refreshing data, apparatus and system
CN108153794B (en) * 2016-12-02 2022-06-07 阿里巴巴集团控股有限公司 Page cache data refreshing method, device and system
CN107943958A (en) * 2017-11-24 2018-04-20 税友软件集团股份有限公司 A kind of Individual Income Tax master data sharing method and system
CN113434525A (en) * 2021-06-24 2021-09-24 青岛海尔科技有限公司 Cache data updating method and device, storage medium and electronic device
CN113434525B (en) * 2021-06-24 2023-06-09 青岛海尔科技有限公司 Cache data updating method and device, storage medium and electronic device
CN113688146A (en) * 2021-08-23 2021-11-23 猪八戒股份有限公司 Distributed architecture high-concurrency order search engine data refreshing method and system

Also Published As

Publication number Publication date
CN105574158B (en) 2019-03-12

Similar Documents

Publication Publication Date Title
CN105574158A (en) Refreshing method and system of database caching data
US8977681B2 (en) Pre-fetching data
US10083021B2 (en) Method and apparatus for providing firmware over the air service to user equipments
CN103905397B (en) Data synchronization method and system
CN103378919B (en) Frame information (FI) message transmission method and apparatus
CN110289993B (en) Connection pool management method, device, equipment and switching system
CN103927266A (en) Improved Control Of Pre-fetch Flow
US20110246596A1 (en) Load-aware method of optimizing command execution in a cloud environment
US20210297309A1 (en) Method and apparatus for performing communication in internet of things
CN110913423A (en) Terminal reachability identification method, data transmission method, device and storage medium
CN104410511A (en) Server management method and system
CN110888739B (en) Distributed processing method and device for delayed tasks
US20130102301A1 (en) Control apparatus and method, and node apparatus
CN108306815A (en) A kind of method, apparatus, equipment and computer readable storage medium obtaining message
CN107273047B (en) Cache management method, cache manager and storage management software
CN107357864B (en) File processing method and terminal
US11838392B2 (en) Eventing systems and methods to facilitate robust event processing
CN114003374B (en) Node scheduling method and device based on cloud platform, electronic equipment and storage medium
WO2018001087A1 (en) Data transmission method, apparatus and system
US20160088520A1 (en) Information processing device, communication apparatus, terminal, communication processing method, and non-transitory computer readable medium
CN111314408B (en) Local edge calculation and Internet of things management method based on communication layer multi-data item caching task
CN111026529B (en) Task stopping method and device of distributed task processing system
US9866625B2 (en) Message transmission apparatus, message transmission method, and message transmission program
CN109840156B (en) Data caching method and equipment, storage medium and terminal thereof
US20150137995A1 (en) Communication apparatus, system, and communication method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20220111

Address after: 510000 Room 601, 128 Dingxin Road, Haizhu District, Guangzhou City, Guangdong Province (office only)

Patentee after: Vipshop (Guangzhou) Software Co.,Ltd.

Address before: 510370 self compiled buildings 1-5, No. 20, Huahai street, Fangcun, Liwan District, Guangzhou, Guangdong

Patentee before: GUANGZHOU PINWEI SOFTWARE Co.,Ltd.