CN117033827A - Data thermal updating method, system, computer equipment and storage medium - Google Patents
Data thermal updating method, system, computer equipment and storage medium Download PDFInfo
- Publication number
- CN117033827A CN117033827A CN202310835384.8A CN202310835384A CN117033827A CN 117033827 A CN117033827 A CN 117033827A CN 202310835384 A CN202310835384 A CN 202310835384A CN 117033827 A CN117033827 A CN 117033827A
- Authority
- CN
- China
- Prior art keywords
- data
- unique identifier
- micro
- service
- target data
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 132
- 238000013523 data management Methods 0.000 claims abstract description 109
- 230000008859 change Effects 0.000 claims abstract description 99
- 230000006870 function Effects 0.000 claims description 63
- 238000004590 computer program Methods 0.000 claims description 16
- 230000000007 visual effect Effects 0.000 claims description 6
- 230000009471 action Effects 0.000 claims description 5
- 230000005540 biological transmission Effects 0.000 claims description 3
- 230000008569 process Effects 0.000 description 11
- 238000012545 processing Methods 0.000 description 6
- 238000013461 design Methods 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 4
- 238000012544 monitoring process Methods 0.000 description 4
- 230000008676 import Effects 0.000 description 3
- 238000007726 management method Methods 0.000 description 3
- 238000012795 verification Methods 0.000 description 3
- 230000002159 abnormal effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000008520 organization Effects 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 238000011161 development Methods 0.000 description 1
- 238000005538 encapsulation Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 230000036541 health Effects 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 230000005764 inhibitory process Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 239000011800 void material Substances 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
- G06F16/9574—Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/955—Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Software Systems (AREA)
- Computer Security & Cryptography (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to the field of data updating, and discloses a method, a system, computer equipment and a storage medium for hot updating data, which are used for solving the problem that micro-service data cache cannot be refreshed timely according to requirements. The system includes a data management system and at least one micro-service, the method comprising the steps of: after the target data is acquired, the data management system stores and configures the corresponding relation between the unique identifier of the target data and the micro service using the target data; judging whether the change of the target data is acquired or not; when a change of the target data is acquired, a data change notification carrying a unique identifier is sent to the micro-service. After the micro service acquires the data change notification, inquiring corresponding target data from the system database as update data according to the unique identifier, and updating the data of the micro service cache.
Description
Technical Field
The present invention relates to the field of data update, and in particular, to a method, a system, a computer device, and a storage medium for hot update of data.
Background
As business systems expand, the data volume increases, content information becomes more and more complex, and more systems begin to divide service types according to business modules, each of which is deployed independently of and isolated from each other, and these services are called micro services. The micro-service has good high availability, and in practical application, different micro-services are called through interfaces to realize the integral function of the application program, and the micro-service can be applied to various scenes such as appointment registration, electronic medical records, medical insurance and the like.
However, in the existing technical scheme, data dependence is usually involved between the micro services, and some data needs to be shared between different micro services, but because the data cache exists in the micro services, when the data is changed, the data cache cannot be refreshed in time, so that the micro services cannot sense the data change in time, and therefore, when the data is changed, forced restarting is often needed to update all the micro service caches. Meanwhile, because the data used by different micro services are different, when part of data is changed, only the corresponding data cache needs to be refreshed, and if all the micro service caches are forcedly refreshed in a traditional mode, extra time is consumed, and the restarting service interrupts the use of a user, so that the user experience is reduced.
Disclosure of Invention
The embodiment of the invention provides a method, a system, computer equipment and a storage medium for hot updating data, which are used for solving the problem that micro-service data cache cannot be refreshed timely according to requirements.
In a first aspect, a method for hot update of data is provided, for a data management system, comprising:
after the target data is obtained, storing the target data in a system database, and configuring the corresponding relation between the unique identifier of the target data and the micro-service using the target data;
judging whether the change of the target data is acquired or not;
when the change of the target data is obtained, a data change notification carrying the unique identifier is sent to the micro service, so that the micro service inquires corresponding target data from a system database of the data management system according to the unique identifier as update data, and the cached data of the micro service is updated according to the update data.
In one possible design, before the sending the notification of the data change carrying the unique identifier to the micro-service, the method further includes:
and constructing a notification function method, and transmitting the unique identifier as a transmission parameter to the notification method, so that the notification method inquires out the corresponding micro-service according to the unique identifier, and constructing a data change notification carrying the unique identifier corresponding to the micro-service.
In another possible design, the configuring the correspondence between the unique identifier of the target data and the micro-service using the target data includes:
providing a visual configuration interface, and acquiring a unique identifier of the target data, a name of the micro service and the target data, which are set on the configuration interface by a user;
and acquiring a corresponding relation between the unique identifier and the name of the micro service configured on the configuration interface by the user.
In a second aspect, a method for hot update of data is provided for a micro service, comprising:
acquiring a unique identifier of target data configured by a data management system and a corresponding relation between the identifier and the micro service;
when the target data is changed, after a data change notification carrying a unique identifier and sent by a data management system is obtained, inquiring corresponding target data from a system database of the data management system according to the unique identifier as update data;
and updating the data cached by the micro service according to the updating data. In one possible design, the querying the corresponding target data from the system database of the data management system according to the unique identifier as update data includes:
Constructing a data change function method corresponding to each target data;
inquiring the corresponding data change function method according to the unique identifier;
and executing the data change function method so that the micro service queries the target data corresponding to the unique identifier in a system database of the data management system, and takes the corresponding target data as update data.
In another possible design, the method for querying the corresponding data change function according to the unique identifier includes:
inquiring a data change function method corresponding to the unique identifier;
if the data change function method corresponding to the unique identifier is found, executing the corresponding data change function method;
if the data change function method corresponding to the unique identifier cannot be found, the updating action is terminated.
In another possible design, the updating the data of the micro service cache according to the update data includes:
traversing and searching the data corresponding to the unique identifier in the data cached by the micro service;
if the data corresponding to the unique identifier exists in the data cached by the micro service, updating the data corresponding to the unique identifier in the data cached by the micro service by using the updating data;
And if the data corresponding to the unique identifier does not exist in the data cached by the micro service, adding the updated data into the data cached by the micro service.
In a third aspect, a system for hot updating of data is provided, comprising a data management system and at least one micro-service,
the data management system is used for storing the target data in a system database after acquiring the target data, configuring a unique identifier of the target data and a micro service using the target data, and sending a data change notification carrying the unique identifier to the micro service when acquiring the change of the target data, so that the micro service inquires the corresponding target data from the system database of the data management system as update data according to the unique identifier, and updating the cached data of the micro service according to the update data;
the micro-service is used for acquiring a unique identifier of target data configured by the data management system and a corresponding relation between the identifier and the micro-service; when the target data is changed, after a data change notification carrying a unique identifier and sent by a data management system is obtained, inquiring corresponding target data from a system database of the data management system according to the unique identifier as update data; and updating the data cached by the micro service according to the updating data.
In a fourth aspect, a computer device is provided, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of a data management system or microservice in the method of hot updating data as described above when the computer program is executed by the processor.
In a fifth aspect, a computer readable storage medium is provided, the computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of a data management system or microservice in the method of hot updating data described above.
The method, the device, the computer equipment and the storage medium for the data hot updating are characterized in that after the data management system acquires the target data, the target data is stored in the system database, and the unique identifier of the target data and the micro-service using the target data are configured. The configuration defines the relation between different micro services and target data, so that when the subsequent target data is changed, the corresponding micro service needing to be refreshed can be rapidly found out according to the unique identifier and the configuration relation, and the efficiency of data hot update is effectively improved. And then, when the data management system acquires the change of the target data, sending a data change notification carrying the unique identifier to the micro service so that the micro service updates the data cached by the micro service, so that the micro service does not need to restart in a large area, and the data update can be completed only by acquiring the target data again by the corresponding micro service which receives the notification and carrying out cache refreshing, thereby ensuring the user experience. In addition, in the process of updating data according to the notification, the corresponding micro-service configures the corresponding relation between the micro-service and the target data, so that when the target data is changed, the designated micro-service is queried only through the unique identifier, and then the designated micro-service cache is updated, the process does not need to refresh the cache data of all the micro-services, the updating range is accurately controlled, other micro-services which do not use the target data do not need to be subjected to redundant updating, and the abnormal errors of the micro-services caused by frequent cache refreshing are effectively prevented.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a system for hot update of data in accordance with an embodiment of the present invention;
FIG. 2 is a schematic flow chart of a method for hot update of data in accordance with an embodiment of the present invention;
FIG. 3 is a schematic flow chart of a method for hot update of data in accordance with an embodiment of the present invention;
FIG. 4 is a schematic flow chart of a method for hot update of data in accordance with an embodiment of the present invention;
FIG. 5 is a schematic flow chart of a method for hot update of data in an embodiment of the invention;
FIG. 6 is a schematic flow chart of a method for hot update of data in accordance with one embodiment of the present invention;
FIG. 7 is a schematic diagram of a data management system of a computer device according to an embodiment of the invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The data hot updating method provided by the embodiment of the invention can be applied to a data hot updating system shown in figure 1. Specifically, the data hot updating method is applied to a data hot updating system, the data hot updating system comprises a data management system and a micro service as shown in fig. 1, and the data management system is communicated with the micro service through a network and is used for realizing data processing of an application program and storing relevant configuration information. The micro service refers to a small independent service end which communicates through a well-defined interface, and is easier to expand and faster to develop than a large service end. And the data management system represents the management system of the data shared by the micro-services. The data management system may be implemented as a stand-alone server or as a cluster of servers.
Medical cloud (Medical cloud) refers to the fact that a Medical health service cloud platform is created by combining Medical technology on the basis of new technologies such as cloud computing, mobile technology, multimedia, 4G communication, big data, internet of things and the like, and Medical resources are shared and Medical scope is enlarged. Because the cloud computing technology is applied to combination, the medical cloud improves the efficiency of medical institutions, and residents can conveniently seek medical advice. In the application of the medical cloud, a plurality of small independent service ends, namely the micro service is connected with the medical cloud to realize medical data sharing, and the independence of the micro service is ensured, for example, different appointment registration and electronic medical records of each hospital can be connected with the medical cloud to obtain shared data, and on the other hand, the independence of different systems of each hospital can be ensured. Therefore, in one embodiment, as shown in fig. 2, a data hot update method is provided, and the method is applied to the data hot update system in fig. 1, where the data management system includes the following steps:
S10: after the target data is acquired, the target data is stored in a system database, and the corresponding relation between the unique identifier of the target data and the micro-service using the target data is configured.
After the data management system acquires the target data input by the user, the target data is stored in a system database of the data management system, and a unique identifier of the target data is set according to user input or system automatic configuration. Then, according to the user input or the direct acquisition of the target data used on the micro services, the corresponding relation between the unique identifier and the micro services is set.
The method for acquiring the target data by the data management system comprises the steps of manually inputting the target data on a configuration interface provided by the data management system by a user, directly using a text or a file in a corresponding format by the user to import the target data into a database management system, and the like. The manner in which the unique identifier of the target data is configured includes, but is not limited to, the user customizing the unique identifier of the input target data at the time of configuring the interface or importing the data, being automatically generated by the data management system, etc. The method for configuring the corresponding relation between the unique identifier and the micro-service comprises, but is not limited to, manually designating the relation between the unique identifier and the micro-service on a configuration interface of the data management system by a user, directly acquiring the use relation between the micro-service and the target data by the data management system through interfaces and the like.
The data management system will store the target data, the unique identifier of the target data, and the relationship between the unique identifier and the microservice in a system database. In addition, each tag data may be used by multiple services, i.e., a unique identifier allows configuration of one or more micro-services.
For example, in an application program displayed on a vehicle, configuration data of a main page menu is stored as target data in a system database of a data management system. Generating a data file according to the configuration data of the main page menu and generating a unique identifier of the configuration data of the page menu according to the specified format in the data file. Then the data file is imported into the system database of the data management system from the configuration interface of the data management system, then the data management system displays the configuration data of the page menu stored in the current system database, the unique identifier of the configuration data of the page menu and all micro services using the system database in parallel, the unique identifier and the micro service name are modified on the configuration interface of the data management system according to the requirement by a user, and the unique identifier and the micro services are configured.
S20: and judging whether the change of the target data is acquired or not.
After the storage of the target data and the configuration of the correspondence between the unique identifier of the target data and the micro service are completed, the data management system needs to determine whether the stored target data has been changed. If the target data is changed, the flow advances to step S30.
In step S20 of this embodiment, the method for determining whether the target data is changed includes, but is not limited to, triggering the determination when the data management system monitors that the target data of the system database is changed, and triggering the determination when the user changes the target data from the configuration interface of the data management system.
S30: when the change of the target data is obtained, a data change notification carrying the unique identifier is sent to the micro service, so that the micro service inquires corresponding target data from a system database of the data management system according to the unique identifier as update data, and the cached data of the micro service is updated according to the update data.
When the data management system determines that the target data is changed, it is necessary to send notifications to all corresponding micro services of the target data configured in step S10, where each notification carries a unique identifier of the target data that is currently changed. The manner of sending the data change notification includes, but is not limited to, sending a link containing a unique identifier, invoking a notification method thereof via a micro-service interface, and the like.
For example, an organization structure manages an application, and the data management system originally stores primary department data in each organization in the application, where the primary department data is used on three micro services, and the three micro services are respectively a user service, an authentication service and a user role service, so the structure of storing the target data in the data management system is schematically as follows:
in the above data structure, data represents target data, id represents a unique identifier of the target data, relation represents three micro services corresponding to the first-level department data, userService represents user services, authenticationservice represents authentication service, userRoleService represents user role service. After the data management system acquires the data and changes, according to three micro services stored in a relation field in a system database of the data management system, sending notifications with ids to the three micro services respectively, namely, sending notifications with ids of'd 95e7e11b9cc47d7b33c254150a73a 46' to the user service, the authentication service and the user role service respectively, so that the three services acquire target data, namely, notification of changing the primary department data, and updating data caches of the three services according to the ids.
It should be noted that, in this embodiment, after the data management system acquires the target data, the target data is stored in the system database, and the unique identifier of the target data and the micro service using the target data are configured. The configuration defines the relation between different micro services and target data, so that when the subsequent target data is changed, the corresponding micro service needing to be refreshed can be rapidly found out according to the unique identifier and the configuration relation, and the efficiency of data hot update is effectively improved. And then, when the data management system acquires the change of the target data, sending a data change notification carrying the unique identifier to the micro service so that the micro service updates the data cached by the micro service, so that the micro service does not need to restart in a large area, and the data update can be completed only by acquiring the target data again by the corresponding micro service which receives the notification and carrying out cache refreshing, thereby ensuring the user experience.
In one embodiment, before step S30, immediately before sending the notification of the data change carrying the unique identifier to the micro service, the method for hot updating data further includes the following steps:
S41: and constructing a notification function method, and transmitting the unique identifier as a transmission parameter to the notification method, so that the notification method inquires out the corresponding micro-service according to the unique identifier, and constructing a data change notification carrying the unique identifier corresponding to the micro-service.
Before the data management system sends the data change notification, the data management system needs to construct a notification function method, wherein the notification function method needs a unique identifier of target data as a parameter, and then a micro-service corresponding to the target data is queried in a system database according to the unique identifier, and meanwhile, the data change notification carrying the unique identifier is constructed, so that in a subsequent step, the data change notification carrying the unique identifier is sent to the micro-service corresponding to the target data queried in the system database.
For example, in the example of step S30, a notification with id "d95e7e11b9cc47d7b33c254150a73a46" needs to be sent to the user service, the authentication service and the user role service to notify the three micro-service primary departments that the data has been changed, before this, the data management system needs to construct a notification function method, which is referred to as id, and this method is shown as follows:
public void notice(String id){
String noticeUrl=‘http://xxxx/notice/’+id;
String microservices=findService(id);
…
return sendNotice(noticeUrl,microservices);
}
As shown in the above-mentioned schematic notification function method, after obtaining the parameter unique identifier id, the method constructs a change notification link, where the notify link carries an id, and queries micro services corresponding to the id through the id and a system database query method findService, and according to the query result, the value of the micro services is userService, authorizeService, userRoleService, that is, three micro services are queried: user services, authentication services, and user role services. Finally, the notification function method sequentially sends data change notification notecirl to the three micro services.
In this embodiment, when sending the data change notification, a notification function method is constructed, and the method encapsulates the processing procedure from the unique identifier to sending the data change notification, and encapsulates the processing procedure to form a modularized function method for overall information processing, so that overall program logic is clearer. The encapsulated notification function method is beneficial to code reuse, and in addition, the security of the code is improved due to the encapsulation of the notification sending process.
In one embodiment, in step S10, the correspondence between the unique identifier of the target data and the micro service using the target data is configured, which specifically includes the following steps:
S11: and providing a visual configuration interface, and acquiring a unique identifier of the target data, the name of the micro service and the target data, which are set on the configuration interface by a user.
S12: and acquiring a corresponding relation between the unique identifier and the name of the micro service configured on the configuration interface by the user.
The data management system provides a visual configuration interface, allows a user to input target data on the configuration interface, and the input mode comprises, but is not limited to, the configuration interface provides an input box for the user to input the target data, and the configuration interface provides an import function for the user to import data files. After the data management system acquires the target data, the configuration interface provides an input box for a user to input a unique identifier corresponding to the target data, and all micro services using the data in the system database are listed. The user can modify the name of the micro-service in the configuration interface and change the corresponding relation between the target data and the micro-service.
If the unique identifier acquired by the data management system is empty, the original unique identifier of the target data is reserved, and the unique identifier is not changed. If the unique identifier is not set originally for the target data, when the data management system acquires the empty unique identifier, a random number or character string is designated as the unique identifier of the target data by the data management system. The unique identifier includes, but is not limited to, a random number, a random string, etc.
In addition, when the data management system acquires the target data, the unique identifier and the micro-service name which are input by the user on the configuration management interface, the data management system performs validity verification on the content input by the user. The validity verification includes, but is not limited to, unique verification of a unique identifier, filtering of illegal character strings, inhibition of cross-site scripting attack, and the like.
It should be noted that, the data management system in this embodiment provides a visual configuration interface, which is more beneficial to the user and developer to enter and configure the target data, improves the overall operation experience, and has good visual effect and operability.
In one embodiment, as shown in fig. 3, a data hot update method is provided, and the method is applied to the data hot update system in fig. 1, for example, where the micro service includes the following steps:
s50: and acquiring a unique identifier of target data configured by a data management system and a corresponding relation between the identifier and the micro service.
According to the unique identifier of the target data configured by the data management system and the corresponding relation between the unique identifier and the micro service, the micro service establishes the corresponding relation between the micro service and the target data used by the micro service. In the subsequent steps, the micro-service receives the corresponding data change notification conveniently.
S60: when the target data is changed, after a data change notification carrying a unique identifier sent by a data management system is obtained, inquiring corresponding target data from a system database of the data management system according to the unique identifier to serve as update data.
After receiving the data change notification sent by the data management system, the micro service queries corresponding target data in a system database of the data management system according to the unique identifier carried by the data change notification, and takes the target data as update data. The manner of receiving the data change notification includes, but is not limited to, receiving notification call information of the data management system from an open interface of the micro service, monitoring a notification message sent by the data management system by the micro service, and the like.
S70: and updating the data cached by the micro service according to the updating data.
And the micro service updates the cached data of the micro service according to the updated data after taking the queried target data as the updated data. The method for updating the data of the micro service cache includes, but is not limited to, the method for updating the cache after the micro service performs structure change on the acquired updated data, the method for updating all data of the micro service cache after the micro service receives the data change notification, and the like.
In the process of updating the data by the micro service according to the notification, because the method configures the corresponding relation between the micro service and the target data, when the target data is changed, the designated micro service is queried only through the unique identifier, and then the designated micro service cache is updated, the process does not need to refresh the cache data of all the micro services, the updating range is accurately controlled, other micro services which do not use the target data do not need to be subjected to redundant updating, and the abnormal errors of the micro service caused by frequent cache refreshing are effectively prevented.
In one embodiment, as shown in fig. 4, in step S60, the corresponding target data is queried from the system database of the data management system according to the unique identifier as update data, which specifically includes the following steps:
s61: and constructing a data change function method corresponding to each target data.
S62: and inquiring the corresponding data change function method according to the unique identifier.
S63: and executing the data change function method so that the micro service queries the target data corresponding to the unique identifier in a system database of the data management system, and takes the corresponding target data as update data.
In one embodiment, the microserver declares a snoop function method to the data management system that listens for data change notifications sent by the data management system. When the data management system sends out a data change notification of target data used by the micro service, the monitoring function method learns that the target data is changed through a unique identifier in the data change notification. After the monitoring function method acquires that the target data is changed, the data changing function method of the target data is queried according to the unique identifier. And if the corresponding data changing method is inquired, executing the data changing function method.
The unique identifier is used as an entry and is transferred to a data change function method. The functions of the data change function method include, but are not limited to, querying corresponding target data according to the unique identifier, processing the target data to conform to a data format required by the micro service, performing an action of updating data of the micro service cache with the target data as update data, and the like.
In one embodiment, the data change function method is an open method, allowing the micro-service developer to customize the data change function method.
It should be noted that, in this embodiment, the micro service declares an internal listener, that is, a listening function method, and the listener makes the data management system have a corresponding attribute to store the unique identifier when the unique identifier is imported, so that the subsequent data change function method uses the unique identifier. In addition, in the embodiment, a data change function method is opened to an open person, and the open person is allowed to customize the method, so that the method is more in line with the fact that in the actual development process, the developer needs to perform different processing on target data according to the use and requirement conditions of different micro services, and then the processed data is cached. The whole data hot update process is smoother and more reasonable.
In one embodiment, as shown in fig. 5, in step S62, the method for changing the function according to the data corresponding to the unique identifier query specifically includes the following steps:
s621: and querying the data change function method corresponding to the unique identifier.
S622: and if the data change function method corresponding to the unique identifier is found, executing the corresponding data change function method.
S623: if the data change function method corresponding to the unique identifier cannot be found, the updating action is terminated.
In one embodiment, all the data change function methods are open to the micro-service developer, allowing the developer to customize the data change function methods according to different functional requirements. As such, there are methods of altering the function of data where the developer does not define some unique identifiers. Therefore, in steps S621 to S623, the present embodiment judges and processes the case where the data change function method corresponding to the unique identifier does not exist.
After the monitoring function method of the micro service receives the unique identifier, the data corresponding to the unique identifier is queried for changing the function method, and if the corresponding data changing function method cannot be queried, the updating action is terminated. And if the corresponding data change function method is inquired, executing the inquired data change function method.
It should be noted that, since the data change function mentioned in steps S61-S63 is open to the developer for customization, there may be a case where the open person does not customize the function. Therefore, in this embodiment, fault tolerance is performed on the situation, so that the whole data hot update process has better fault tolerance and security.
In one embodiment, as shown in fig. 6, in step S70, the updating the data of the micro service cache according to the updated data specifically includes the following steps:
S71: and traversing and searching the data corresponding to the unique identifier in the data cached by the micro service.
S72: and if the data corresponding to the unique identifier exists in the data cached by the micro service, updating the data corresponding to the unique identifier in the data cached by the micro service by using the updating data.
S73: and if the data corresponding to the unique identifier does not exist in the data cached by the micro service, adding the updated data into the data cached by the micro service.
In one embodiment, the micro-service caches the target data used by all the micro-services in the data cache pool of the memory. When the micro service receives the data change notification, all cache data in the data cache pool of the micro service need to be traversed and inquired according to the data change notification. If the corresponding cache data exists, the cache data is updated according to the target data, and if the corresponding cache data does not exist, the target data is added in the data cache pool.
It should be noted that, the micro-service builds a data cache pool in the memory to cache the data, so as to advantageously alleviate the problem of communication delay between devices and improve the overall performance and reading speed of the micro-service. For different data, local cache updating is carried out according to the unique identifier, so that the frequency of refreshing the data cache by the micro service can be reduced, and the updating efficiency of the data cache is improved.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present invention.
In an embodiment, a system for hot update of data is provided, and the method for hot update of data in the above embodiment is applied to the system for hot update of data. As shown in fig. 1, the system for hot updating data includes a data management system and at least one micro-service. The data management system and the individual microservices are described in detail as follows:
the data management system is used for storing the target data in a system database after acquiring the target data, configuring a unique identifier of the target data and a micro service using the target data, and sending a data change notification carrying the unique identifier to the micro service when acquiring the change of the target data, so that the micro service inquires the corresponding target data from the system database of the data management system as update data according to the unique identifier, and updating the cached data of the micro service according to the update data;
The micro-service is used for acquiring a unique identifier of target data configured by the data management system and a corresponding relation between the identifier and the micro-service; when the target data is changed, after a data change notification carrying a unique identifier and sent by a data management system is obtained, inquiring corresponding target data from a system database of the data management system according to the unique identifier as update data; and updating the data cached by the micro service according to the updating data.
For specific limitations of the data management system and the respective micro-services in the system for data hot update, reference may be made to the above limitation of the method for data hot update, and no further description is given here. The data management system and the respective micro-services in the above-described data thermal update system may be implemented in whole or in part by software, hardware, and combinations thereof. The data management system and each micro-service can be embedded in hardware or independent from a processor in the computer equipment, and can also be stored in a memory in the computer equipment in a software mode, so that the processor can call and execute the corresponding operations of each module.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The system database of the computer device is for storing target data, unique identifiers of the target data, and relationships between the identifiers of the target data and micro-services using the target data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of hot updating data.
In one embodiment, a computer device is provided that includes a memory, a processor, and a computer program stored on the memory and executable on the processor, when executing the computer program to implement a data management system, comprising the steps of:
after the target data is obtained, storing the target data in a system database, and configuring the corresponding relation between the unique identifier of the target data and the micro-service using the target data;
judging whether the change of the target data is acquired or not;
when the change of the target data is obtained, a data change notification carrying the unique identifier is sent to the micro service, so that the micro service inquires corresponding target data from a system database of the data management system according to the unique identifier as update data, and the cached data of the micro service is updated according to the update data.
And when the processing executes the computer program to realize the micro-service, the method comprises the following steps:
acquiring a unique identifier of target data configured by a data management system and a corresponding relation between the identifier and the micro service;
when the target data is changed, after a data change notification carrying a unique identifier and sent by a data management system is obtained, inquiring corresponding target data from a system database of the data management system according to the unique identifier as update data;
And updating the data cached by the micro service according to the updating data.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, implements a data management system, comprising the steps of:
after the target data is obtained, storing the target data in a system database, and configuring the corresponding relation between the unique identifier of the target data and the micro-service using the target data;
judging whether the change of the target data is acquired or not;
when the change of the target data is obtained, a data change notification carrying the unique identifier is sent to the micro service, so that the micro service inquires corresponding target data from a system database of the data management system according to the unique identifier as update data, and the cached data of the micro service is updated according to the update data.
And when the computer program is executed by the processor to realize the micro-service, the method comprises the following steps:
acquiring a unique identifier of target data configured by a data management system and a corresponding relation between the identifier and the micro service;
When the target data is changed, after a data change notification carrying a unique identifier and sent by a data management system is obtained, inquiring corresponding target data from a system database of the data management system according to the unique identifier as update data;
and updating the data cached by the micro service according to the updating data.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention.
Claims (10)
1. A method for hot updating of data for a data management system, comprising:
after the target data is obtained, storing the target data in a system database, and configuring the corresponding relation between the unique identifier of the target data and the micro-service using the target data;
Judging whether the change of the target data is acquired or not;
when the change of the target data is obtained, a data change notification carrying the unique identifier is sent to the micro service, so that the micro service inquires corresponding target data from a system database of the data management system according to the unique identifier as update data, and the cached data of the micro service is updated according to the update data.
2. The method of hot updating data of claim 1, wherein before sending the notification of the change of data carrying the unique identifier to the micro-service, the method further comprises:
and constructing a notification function method, and transmitting the unique identifier as a transmission parameter to the notification method, so that the notification method inquires out the corresponding micro-service according to the unique identifier, and constructing a data change notification carrying the unique identifier corresponding to the micro-service.
3. The data hot updating method according to claim 1 or 2, wherein the configuring of the correspondence between the unique identifier of the target data and the micro service using the target data includes:
Providing a visual configuration interface, and acquiring a unique identifier of the target data, a name of the micro service and the target data, which are set on the configuration interface by a user;
and acquiring a corresponding relation between the unique identifier and the name of the micro service configured on the configuration interface by the user.
4. A method of hot update of data for a microservice, comprising:
acquiring a unique identifier of target data configured by a data management system and a corresponding relation between the identifier and the micro service;
when the target data is changed, after a data change notification carrying a unique identifier and sent by a data management system is obtained, inquiring corresponding target data from a system database of the data management system according to the unique identifier as update data;
and updating the data cached by the micro service according to the updating data.
5. The method for hot updating data according to claim 4, wherein said querying corresponding target data from a system database of said data management system by said unique identifier as updated data comprises:
constructing a data change function method;
Inquiring the corresponding data change function method according to the unique identifier;
and executing the data change function method so that the micro service queries the target data corresponding to the unique identifier in a system database of the data management system, and takes the corresponding target data as update data.
6. The method for hot updating data according to claim 5, wherein said querying the corresponding data change function method according to the unique identifier includes:
inquiring a data change function method corresponding to the unique identifier;
if the data change function method corresponding to the unique identifier is found, executing the corresponding data change function method;
if the data change function method corresponding to the unique identifier cannot be found, the updating action is terminated.
7. The method of claim 4, wherein updating the micro-service cached data according to the update data comprises:
traversing and searching the data corresponding to the unique identifier in the data cached by the micro service;
if the data corresponding to the unique identifier exists in the data cached by the micro service, updating the data corresponding to the unique identifier in the data cached by the micro service by using the updating data;
And if the data corresponding to the unique identifier does not exist in the data cached by the micro service, adding the updated data into the data cached by the micro service.
8. A system for hot updating of data, characterized in that it comprises a data management system and at least one micro-service,
the data management system is used for storing the target data in a system database after acquiring the target data, configuring a unique identifier of the target data and a micro service using the target data, and sending a data change notification carrying the unique identifier to the micro service when acquiring the change of the target data, so that the micro service inquires the corresponding target data from the system database of the data management system as update data according to the unique identifier, and updating the cached data of the micro service according to the update data;
the micro-service is used for acquiring a unique identifier of target data configured by the data management system and a corresponding relation between the identifier and the micro-service; when the target data is changed, after a data change notification carrying a unique identifier and sent by a data management system is obtained, inquiring corresponding target data from a system database of the data management system according to the unique identifier as update data; and updating the data cached by the micro service according to the updating data.
9. Computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of a data management system or microservice in a data thermal update method according to any one of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the steps of a data management system or micro-services in a data thermal update method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310835384.8A CN117033827A (en) | 2023-07-07 | 2023-07-07 | Data thermal updating method, system, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310835384.8A CN117033827A (en) | 2023-07-07 | 2023-07-07 | Data thermal updating method, system, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117033827A true CN117033827A (en) | 2023-11-10 |
Family
ID=88621604
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310835384.8A Pending CN117033827A (en) | 2023-07-07 | 2023-07-07 | Data thermal updating method, system, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117033827A (en) |
-
2023
- 2023-07-07 CN CN202310835384.8A patent/CN117033827A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10713034B2 (en) | Updating web resources | |
US9690563B2 (en) | Updating web resources | |
WO2019136800A1 (en) | Service processing method, apparatus and device, and computer-readable storage medium | |
CN110968603B (en) | Data access method and device | |
CN111064626B (en) | Configuration updating method, device, server and readable storage medium | |
US11336588B2 (en) | Metadata driven static determination of controller availability | |
CN112860343B (en) | Configuration changing method, system, device, electronic equipment and storage medium | |
CN108667660B (en) | Method and device for route management and service routing and routing system | |
CN112650804B (en) | Big data access method, device, system and storage medium | |
CN117873597A (en) | Method and system for realizing API arrangement through visual configuration mode | |
CN111338717B (en) | Interface calling method, application program upgrading method, server and client | |
CN117033827A (en) | Data thermal updating method, system, computer equipment and storage medium | |
CN112000618B (en) | File change management method, device, equipment and storage medium for cluster nodes | |
CN112241276B (en) | Equipment upgrading method and device | |
CN111813880A (en) | Method, system and storage medium for managing territorial space planning project | |
CN113452536B (en) | Atomic object management method and device | |
CN108399223A (en) | A kind of data capture method, device and electronic equipment | |
CN113014411B (en) | Method, device and system for managing network device | |
CN115604667B (en) | Message sending method, device, computer equipment and storage medium | |
CN116633774A (en) | Platform address configuration method, device, computer equipment and storage medium | |
CN118210679A (en) | Resource acquisition method, equipment and medium applied to sample tube storage equipment cluster | |
CN116701520A (en) | Page display method, device, server and storage medium | |
CN116723184A (en) | Endowment service data reporting system, method, equipment and storage medium | |
CN117632297A (en) | Application hot refreshing method, device, equipment and storage medium | |
CN118519627A (en) | Application zero code development method, device, storage medium and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |