CN114327603A - Data caching method and device and computer readable storage medium - Google Patents

Data caching method and device and computer readable storage medium Download PDF

Info

Publication number
CN114327603A
CN114327603A CN202111679984.7A CN202111679984A CN114327603A CN 114327603 A CN114327603 A CN 114327603A CN 202111679984 A CN202111679984 A CN 202111679984A CN 114327603 A CN114327603 A CN 114327603A
Authority
CN
China
Prior art keywords
version number
data
cache
caching
target
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
Application number
CN202111679984.7A
Other languages
Chinese (zh)
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.)
Postal Savings Bank of China Ltd
Original Assignee
Postal Savings Bank of China 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 Postal Savings Bank of China Ltd filed Critical Postal Savings Bank of China Ltd
Priority to CN202111679984.7A priority Critical patent/CN114327603A/en
Publication of CN114327603A publication Critical patent/CN114327603A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a data caching method and device and a computer readable storage medium. Wherein, the method comprises the following steps: monitoring the main version number of the target data storage medium to obtain a monitoring result; when the monitoring result shows that the major version number changes, comparing the major version number with the current version number of the target data cache center to obtain a version number comparison result; when the comparison result of the version numbers is determined to show that the major version number is larger than the current version number, obtaining updated data in the target data storage medium based on the major version number; and caching the updated data to a target data caching center. The invention solves the technical problems of low data updating automation degree and large workload of operation and maintenance personnel caused by poor compatibility of the cache data updating component in the related technology.

Description

Data caching method and device and computer readable storage medium
Technical Field
The present invention relates to the field of data processing, and in particular, to a data caching method and apparatus, and a computer-readable storage medium.
Background
In the current local cache solution, cache components such as spring cache, google gauva, ehance and the like which are commonly used are used for managing cache data, and the data cache of the solutions needs developers to write additional codes for management, so that the application intrusiveness is large.
Although the local cache can also meet the requirement of fast data access by the application, the cache data management logic is not universal, manual refreshing is needed during data updating, and extra workload is needed to meet the cache requirement.
In addition, by adopting the centralized cache management of the middleware, the system maintenance and operation and maintenance cost is additionally increased by introducing the cache middleware system, and the burden of development and operation and maintenance personnel is increased.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a data caching method, a data caching device and a computer readable storage medium, which are used for at least solving the technical problems of low data updating automation degree and large workload of operation and maintenance personnel caused by poor compatibility of a cache data updating component in the related technology.
According to an aspect of an embodiment of the present invention, there is provided a data caching method, including: monitoring the main version number of the target data storage medium to obtain a monitoring result; when the monitoring result shows that the major version number changes, comparing the major version number with the current version number of a target data cache center to obtain a version number comparison result; when the comparison result of the version numbers is determined to indicate that the main version number is larger than the current version number, acquiring updating data in the target data storage medium based on the main version number; and caching the updated data to the target data caching center.
Optionally, the target data storage medium includes a plurality of data tables, each of the plurality of data tables is provided with a slave version number, and when data in each of the data tables changes, the corresponding slave version number is automatically updated; when the slave version number is updated, the master version number is automatically updated, and the update information of the slave version number is recorded in the master version number.
Optionally, comparing the main version number with the current version number of the target data cache center to obtain a comparison result of the version numbers, including: acquiring the main version number and the current version number; and comparing the information of the main version number with the information of the current version number to obtain a comparison result of the version number.
Optionally, obtaining the update data in the target data storage medium based on the master version number includes: determining a target slave version number based on the master version number; and when the target is determined to have data update from the target data table corresponding to the version number, acquiring the update data from the target data table.
Optionally, the method further comprises: and when it is determined that no data update exists in the target data table corresponding to the target slave version number, replacing the cache slave version number in the data cache center with the target slave version number.
Optionally, the method further comprises: and updating the main cache version number of the data cache center.
Optionally, caching the update data to the data caching center, including: determining the cache slave version number based on the target slave version number; searching a cache data table corresponding to the cache slave version number, wherein the cache data table is a data table contained in the data cache center; and caching the updated data into the cache data table.
Optionally, after caching the update data to the target data caching center, the method further includes: and deleting the historical cache data in the cache data table.
According to another aspect of the embodiments of the present invention, there is provided a data caching apparatus, including: the monitoring module is used for monitoring the main version number of the target data storage medium to obtain a monitoring result; the comparison module is used for comparing the main version number with the current version number of the target data cache center when the monitoring result shows that the main version number changes, so as to obtain a version number comparison result; an obtaining module, configured to obtain, when it is determined that the version number comparison result indicates that the major version number is greater than the current version number, update data in the target data storage medium based on the major version number; and the cache module is used for caching the updated data to the target data cache center.
Optionally, the target data storage medium includes a plurality of data tables, each of the plurality of data tables is provided with a slave version number, and when data in each of the data tables changes, the corresponding slave version number is automatically updated; when the slave version number is updated, the master version number is automatically updated, and the update information of the slave version number is recorded in the master version number.
Optionally, the alignment module includes: a first obtaining unit, configured to obtain the major version number and the current version number; and the comparison unit is used for comparing the information of the main version number with the information of the current version number to obtain a comparison result of the version number.
Optionally, the obtaining module includes: a first determining unit configured to determine a target slave version number based on the master version number; and the second acquisition unit is used for acquiring the update data from the target data table when the target is determined to have data update from the target data table corresponding to the version number.
Optionally, the apparatus further comprises: and the replacing module is used for replacing the cache slave version number in the data cache center by using the target slave version number when the target data table corresponding to the target slave version number does not have data updating.
Optionally, the apparatus further comprises: and the updating module is used for updating the main cache version number of the data cache center.
Optionally, the cache module includes: a second determining unit configured to determine the cache slave version number based on the target slave version number; the searching unit is used for searching a cache data table corresponding to the cache slave version number, wherein the cache data table is a data table contained in the data cache center; and the cache unit is used for caching the updated data into the cache data table.
Optionally, the apparatus further comprises: and the deleting unit is used for deleting the historical cache data in the cache data table after the updated data is cached to the target data cache center.
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is executed by a processor, the computer-readable storage medium is controlled by a device to execute any one of the above data caching methods.
According to another aspect of the embodiments of the present invention, there is also provided a processor, configured to execute a computer program, where the computer program executes to perform the data caching method described in any one of the above.
In the embodiment of the invention, the main version number of the target data storage medium is monitored to obtain a monitoring result; when the monitoring result shows that the major version number changes, comparing the major version number with the current version number of the target data cache center to obtain a version number comparison result; when the comparison result of the version numbers is determined to show that the major version number is larger than the current version number, obtaining updated data in the target data storage medium based on the major version number; and caching the updated data to a target data caching center. By the data caching method provided by the embodiment of the invention, the purpose of updating and caching data by monitoring the major version number of the target data storage medium is achieved, so that the technical effect of improving the system throughput is realized, and the technical problems of low data updating automation degree and large workload of operation and maintenance personnel caused by poor compatibility of a cache data updating component in the related technology are solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow chart of a data caching method according to an embodiment of the present invention;
FIG. 2 is a flow diagram of a request query cache response according to an embodiment of the invention;
FIG. 3 is a flow diagram of caching SDK parameter version updates according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of cache component collaboration according to an embodiment of the invention;
FIG. 5 is a diagram of a data caching apparatus according to an embodiment of the invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
In accordance with an embodiment of the present invention, there is provided a method embodiment of a data caching method, it is noted that the steps illustrated in the flowchart of the figure may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be performed in an order different than that presented herein.
Fig. 1 is a flowchart of a data caching method according to an embodiment of the present invention, and as shown in fig. 1, the method includes the following steps:
step S102, monitoring the main version number of the target data storage medium to obtain a monitoring result.
Optionally, in the above steps, the target data storage medium includes but is not limited to: local cache, server cache.
And step S104, comparing the main version number with the current version number of the target data cache center when the monitoring result shows that the main version number changes, and obtaining a comparison result of the version numbers.
Optionally, in the foregoing step, in the monitoring process, when the major version number changes, the current major version number is compared with the current version number of the target data cache center, and a comparison result is obtained.
And step S106, when the comparison result of the version numbers is determined to indicate that the major version number is larger than the current version number, acquiring the updated data in the target data storage medium based on the major version number.
And step S108, caching the updated data to a target data caching center.
As can be seen from the above, in the embodiment of the present invention, the master version number of the target data storage medium may be monitored first, and a monitoring result is obtained; then, when the monitoring result shows that the major version number changes, comparing the major version number with the current version number of the target data cache center to obtain a version number comparison result; then, when the comparison result of the version numbers is determined to indicate that the major version number is larger than the current version number, obtaining the updated data in the target data storage medium based on the major version number; and finally, the updated data can be cached to the target data caching center. By the data caching method provided by the embodiment of the invention, the purpose of updating and caching data by monitoring the major version number of the target data storage medium is achieved, so that the technical effect of improving the system throughput is realized, and the technical problems of low data updating automation degree and large workload of operation and maintenance personnel caused by poor compatibility of a cache data updating component in the related technology are solved.
As an alternative embodiment, the target data storage medium contains a plurality of data tables, each of the plurality of data tables is provided with a slave version number, wherein when data in each data table changes, the corresponding slave version number is automatically updated; when the slave version number is updated, the master version number is automatically updated, and the update information of the slave version number is recorded in the master version number.
In the above optional embodiment, in order to record the update history of the parameter table data of the database, the cache parameter data is managed, and the parameter update version is used as a data dimension, so that a parameter table version zipper method is designed and implemented. The parameter table version zipper method records each change of data in the parameter table by updating a large version number change table A and a small version change table B. The design is the basis for caching component management parameters. The method comprises the following specific steps:
step 1), supposing that there is a parameter table T1,T1Each record in (1) has a version number VtWhen data is changed, a new record is added in the A table, and the contents are as follows: (AV)1,AV0VFlag, UpdateTime), in which AV1Representing the current A table version number; AV (Audio video)0Represents a version number on the A table; VFlag represents the synchronous state of the A table version; the UpdateTime represents the updating time, then the maximum value of the record version number of the A table is set to be C, the updating information of the specific table is recorded in the B table, and the contents are as follows: (T)1,PVt,AV1C, UpdateTime) where, T1Representing parametersA table name; PV (photovoltaic)tIndicating a parameter table record version number; AV (Audio video)1Representing the current A table version number; c represents the maximum value of the record version number of the A table; the UpdateTime indicates an update time.
Step 2) when T is reached1When the table has data updated again, T1The version number of the write record in the table is Vt+1,The newly added entries in table a are as follows: (AV)2,AV1VFlag, UpdateTime); the new entries in table B are as follows: (T)1,PVt+1,AV2C, UpdateTime), while modifying the record (T) in the B table1,PVt,AV1C, UpdateTime) is (T)1,PVt,AV1,AV2,UpdateTime)。
Step 3) when T is present1When the table data is updated again, upgrading the corresponding version number, repeating the steps of the step 1) and the step 2), caching the parameter table data cached in the Cache SDK (namely the target data storage medium) according to the version number of the A table, wherein the version number is (AV, Cache) initially, the AV is the current version number of the A table, and the Cache is a data object cached in the parameter table of the version; in order to ensure that the cache data is available, two versions of cache data are stored in the cache SDK and used for ensuring that the available versions of cache data exist when a new version is replaced. When the version of the table A is newly added, the cache SDK module is triggered to configure the center to pull the current latest version number of the table A, and the version number is uploaded to the parameter query service module to pull corresponding version data.
As an optional embodiment, comparing the main version number with the current version number of the target data cache center to obtain a comparison result of the version numbers, includes: acquiring a main version number and a current version number; and comparing the main version number with the current version number to obtain a version number comparison result.
In the above optional embodiment, the main version number and the current version number are first obtained, and then compared, so as to obtain a comparison result indicating whether the main version number is consistent with the current version number.
As an alternative embodiment, obtaining the update data in the target data storage medium based on the major version number includes: determining a target slave version number based on the master version number; and when the target is determined to have data update from the target data table corresponding to the version number, acquiring the update data from the target data table.
In the above optional embodiment, the buffer SDK loading parameter table is divided into an active loading mode and a lazy loading mode. The active loading mode is to load data in the configured parameter table into the memory when the application is started (namely, the active main version number and the current version number in the embodiment of the invention are obtained and then compared to obtain a comparison result); the lazy loading mode is that the parameter table data is not loaded first when the application is started, and caching is performed when a query request queries the parameter table data (namely, when a determined target has data update from a target data table corresponding to the version number, update data is obtained from the target data table in the embodiment of the invention). The data comprises hot data and cold data, the table is used as a data set and has cold and hot differences, the two cache modes have the advantages that the cache mode can be determined according to the cold and hot dimensions of the table, the active loading mode can respond to the quick response of the full amount of hot data, the lazy loading mode can screen out the hot data in the cold table for caching, the memory space is saved, and the data accelerated access is pertinently performed.
As an optional embodiment, the data caching method further includes: and when the target slave version number does not exist in the target data table corresponding to the target slave version number, replacing the cache slave version number in the data cache center with the target slave version number.
As an optional embodiment, the data caching method further includes: and updating the main cache version number of the data cache center.
The following describes the specific steps of the data caching method in detail:
step a, loading mode of parameter table. The buffer SDK loading parameter table is divided into an active loading mode and a lazy loading mode. The active loading mode is to load the data in the configured parameter table into the memory when the application is started. The lazy loading mode is that the data of the parameter table is not loaded firstly when the application is started, and the caching is carried out when the data of the parameter table is inquired by a query request. The data comprises hot data and cold data, the table is used as a data set and has cold and hot differences, the two cache modes have the advantages that the cache mode can be determined according to the cold and hot dimensions of the table, the active loading mode can respond to the quick response of the full amount of hot data, the lazy loading mode can screen out the hot data in the cold table for caching, the memory space is saved, and the data accelerated access is pertinently performed.
And b, initializing the cache. The cache SDK determines how to load data and create a memory index object according to a table loading mode, an index field, a primary key field, a cache enabling mark and the like specified by the configuration file, and supports the creation of a cache data index according to the primary key and the configuration field. Through the SPI interface that provides, the compound mode of buffer memory data still can be expanded.
And c, accessing the parameter table data. Fig. 2 is a flowchart of requesting query cache response according to an embodiment of the present invention, as shown in fig. 2, for parameter table data access in an active loading mode, when querying parameter table data, setting an sql statement operation mapping interface section in a DaoSupport, and for all query requests requiring access to parameter table data, weaving an access cache address (@ Around (dopointselectelist ())) to a join specified by point (@ pointlist (@ public &. selectlist ()) & args (java. lang. string.)) to achieve the purpose of obtaining data from a cache statement.
In addition, for parameter table data access in the lazy loading mode, by intercepting a query method in an Executor of MyBatis, an sql statement and an sql identifier in the query method are analyzed, a parameter query service is called, lazy loading parameter table data query is realized, and data is cached after being returned.
It should be noted that Mybatis is a data access layer framework, and provides an extensible interceptor; SQL is a structured query language, a language used to operate relational databases; the interceptor is a programming mode and is used for intercepting method parameters before method calling, and executing operations such as verification, assignment and the like; the parameter table is a database table managed by a parameter cache component which needs to be accessed by the application; the parameter table version is used for recording the data updating history of the parameter table; a join point (a connection point) represents a point which is clearly defined in a program, typically comprises a method call, an access to a class member, an execution of an exception handler block and the like, and can also nest other join points; point represents a group of join points, which are combined through a logical relationship or integrated through a wildcard, a regular expression and the like, and defines the place where the corresponding Advice will occur; advice defines the operations that a program point defined inside Pointcut specifically needs to do, and distinguishes whether the code is executed before, after or instead of each join point by before, after and around.
As an alternative embodiment, caching the update data to the data caching center includes: determining a cache slave version number based on the target slave version number; searching a cache data table corresponding to the cache slave version number, wherein the cache data table is a data table contained in a data cache center; and caching the updated data into a cache data table.
Fig. 3 is a flowchart of updating the version of the cached SDK parameter according to an embodiment of the present invention, and as shown in fig. 3, after the cached SDK node monitors that the primary version number has changed, the data pull of the latest parameter table version is performed, and the following describes in detail the step of updating the cached SDK parameter version.
Step 1), acquiring a main version number, comparing the main version number with the version number in the current cache, if the latest version number is greater than the version number in the memory, executing step 2), and if not, ending.
And step 2), acquiring the version number of the updated parameter table according to the major version number.
And 3) judging whether the table is updated, if so, pulling the version number data, and deleting the previous version data. If not, the cache version number is replaced.
As an optional embodiment, after caching the updated data in the target data caching center, the data caching method further includes: and deleting the historical cache data in the cache data table.
Fig. 4 is a schematic diagram of cache component cooperation according to an embodiment of the present invention, and as shown in fig. 4, a cache component is composed of three parts: the system comprises a cache SDK, a cache query service module and a data synchronization module. The cache SDK provides common parameter cache service for the application, and the component loads cache data when the application is started by configuring the name of the parameter table to be cached. The cache query service module solves the problem of connection number sudden increase caused by the concurrent access of multiple nodes to the database and is used for obtaining cache data. The data synchronization module is used for synchronizing data in the database parameter table, so as to achieve consistency between node cache and database data, and the specific steps of cache component cooperation are described below.
Step a, when the parameter table has data updating, the data synchronization module synchronizes the version information to the master library and the version number queue, and data synchronization is carried out between the master library and the slave library.
B, the data synchronization module monitors whether the queue version is updated or not at regular time, and if a new record is added, the information is pushed to a configuration center.
And c, monitoring the updating change of the data of the configuration center by the cache SDK module, and acquiring the latest version number after the data change and calling the cache query service to query the latest data.
As can be seen from the above, in the embodiment of the present invention, although the data cache has many cache middleware capable of accelerating data access, often the service logic code and the cache data code are coupled together, and a developer needs to pay attention to the data cache logic, if the cache logic has a problem, the principle of the cache middleware needs to be known, and the management of the cache data needs to be maintained by the developer, including data consistency, cache expiration replacement policy, and the like.
Example 2
According to another aspect of the embodiment of the present invention, there is further provided a data caching apparatus, and fig. 5 is a schematic diagram of the data caching apparatus according to the embodiment of the present invention, as shown in fig. 5, including: a monitoring module 51, a comparing module 53, an obtaining module 55 and a caching module 57. The following describes the data buffering device.
The monitoring module 51 is configured to monitor the major version number of the target data storage medium to obtain a monitoring result;
a comparison module 53, configured to compare the major version number with the current version number of the target data cache center when the monitored result indicates that the major version number changes, so as to obtain a comparison result of the version numbers;
an obtaining module 55, configured to obtain, when it is determined that the version number comparison result indicates that the major version number is greater than the current version number, update data in the target data storage medium based on the major version number;
and the caching module 57 is configured to cache the updated data in the target data caching center.
It should be noted that the above monitoring module 51, the comparing module 53, the obtaining module 55 and the caching module 57 correspond to steps S102 to S108 in embodiment 1, and the above modules are the same as the corresponding steps in the implementation example and application scenarios, but are not limited to the disclosure in embodiment 1. It should be noted that the modules described above as part of an apparatus may be implemented in a computer system such as a set of computer-executable instructions.
As can be seen from the above, in the embodiment of the present invention, the monitoring module 51 may first monitor the major version number of the target data storage medium to obtain a monitoring result; then, when the monitoring result shows that the major version number changes, the comparison module 53 may compare the major version number with the current version number of the target data cache center to obtain a comparison result of the version numbers; then, when it is determined that the version number comparison result indicates that the major version number is greater than the current version number, the obtaining module 55 may obtain the update data in the target data storage medium based on the major version number; finally, the updated data can be cached to the target data caching center by means of the caching module 57. By the data caching device provided by the embodiment of the invention, the purpose of updating and caching data by monitoring the major version number of the target data storage medium is achieved, so that the technical effect of improving the system throughput is realized, and the technical problems of low data updating automation degree and large workload of operation and maintenance personnel caused by poor compatibility of a cache data updating component in the related technology are solved.
Optionally, the target data storage medium includes a plurality of data tables, each of the plurality of data tables is provided with a slave version number, and when data in each data table changes, the corresponding slave version number is automatically updated; when the slave version number is updated, the master version number is automatically updated, and the update information of the slave version number is recorded in the master version number.
Optionally, the alignment module comprises: a first obtaining unit, configured to obtain a major version number and a current version number; and the comparison unit is used for comparing the main version number with the current version number to obtain a version number comparison result.
Optionally, the obtaining module includes: a first determining unit configured to determine a target slave version number based on the master version number; and the second acquisition unit is used for acquiring the update data from the target data table when the target is determined to have data update from the target data table corresponding to the version number.
Optionally, the data caching apparatus further includes: and the replacing module is used for replacing the cache slave version number in the data cache center by using the target slave version number when the target data table corresponding to the target slave version number does not have data updating.
Optionally, the data caching apparatus further includes: and the updating module is used for updating the main cache version number of the data cache center.
Optionally, the cache module includes: a second determining unit for determining the cache slave version number based on the target slave version number; the searching unit is used for searching a cache data table corresponding to the cache slave version number, wherein the cache data table is a data table contained in a data cache center; and the cache unit is used for caching the updated data into a cache data table.
Optionally, the data caching apparatus further includes: and the deleting unit is used for deleting the historical cache data in the cache data table after the updated data is cached to the target data cache center.
Example 3
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium including a stored computer program, wherein when the computer program is executed by a processor, the apparatus where the computer-readable storage medium is located is controlled to execute the data caching method of any one of the above.
Example 4
According to another aspect of the embodiments of the present invention, there is also provided a processor, configured to execute a computer program, where the computer program executes to perform the data caching method of any one of the above.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (11)

1. A method for caching data, comprising:
monitoring the main version number of the target data storage medium to obtain a monitoring result;
when the monitoring result shows that the major version number changes, comparing the major version number with the current version number of a target data cache center to obtain a version number comparison result;
when the comparison result of the version numbers is determined to indicate that the main version number is larger than the current version number, acquiring updating data in the target data storage medium based on the main version number;
and caching the updated data to the target data caching center.
2. The method according to claim 1, wherein the target data storage medium contains a plurality of data tables, each of the plurality of data tables is provided with a slave version number, and when data in each data table changes, the corresponding slave version number is automatically updated; when the slave version number is updated, the master version number is automatically updated, and the update information of the slave version number is recorded in the master version number.
3. The method of claim 1, wherein comparing the major version number with a current version number of a target data cache center to obtain a comparison result of version numbers comprises:
acquiring the main version number and the current version number;
and comparing the information of the main version number with the information of the current version number to obtain a comparison result of the version number.
4. The method of claim 2, wherein obtaining update data in the target data storage medium based on the master version number comprises:
determining a target slave version number based on the master version number;
and when the target is determined to have data update from the target data table corresponding to the version number, acquiring the update data from the target data table.
5. The method of claim 4, further comprising:
and when it is determined that no data update exists in the target data table corresponding to the target slave version number, replacing the cache slave version number in the data cache center with the target slave version number.
6. The method of claim 5, further comprising: and updating the main cache version number of the data cache center.
7. The method of claim 5, wherein caching the updated data to the data caching center comprises:
determining the cache slave version number based on the target slave version number;
searching a cache data table corresponding to the cache slave version number, wherein the cache data table is a data table contained in the data cache center;
and caching the updated data into the cache data table.
8. The method of claim 7, wherein after caching the updated data to the target data caching center, the method further comprises:
and deleting the historical cache data in the cache data table.
9. A data caching apparatus, comprising:
the monitoring module is used for monitoring the main version number of the target data storage medium to obtain a monitoring result;
the comparison module is used for comparing the main version number with the current version number of the target data cache center when the monitoring result shows that the main version number changes, so as to obtain a version number comparison result;
an obtaining module, configured to obtain, when it is determined that the version number comparison result indicates that the major version number is greater than the current version number, update data in the target data storage medium based on the major version number;
and the cache module is used for caching the updated data to the target data cache center.
10. A computer-readable storage medium, comprising a stored computer program, wherein the computer program, when executed by a processor, controls an apparatus in which the computer-readable storage medium is located to perform the data caching method of any one of claims 1 to 8.
11. A processor for executing a computer program, wherein the computer program executes to perform the data caching method of any one of the preceding claims 1 to 8.
CN202111679984.7A 2021-12-31 2021-12-31 Data caching method and device and computer readable storage medium Pending CN114327603A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111679984.7A CN114327603A (en) 2021-12-31 2021-12-31 Data caching method and device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111679984.7A CN114327603A (en) 2021-12-31 2021-12-31 Data caching method and device and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN114327603A true CN114327603A (en) 2022-04-12

Family

ID=81023595

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111679984.7A Pending CN114327603A (en) 2021-12-31 2021-12-31 Data caching method and device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN114327603A (en)

Similar Documents

Publication Publication Date Title
US9239767B2 (en) Selective database replication
US10656935B2 (en) Maintaining and updating software versions via hierarchy
US8386540B1 (en) Scalable relational database service
US8392482B1 (en) Versioning of database partition maps
US7958210B2 (en) Update management method and update management unit
US7310653B2 (en) Method, system, and product for maintaining software objects during database upgrade
CN111092933A (en) Business process management method, system, medium and electronic device for micro-service architecture
US20060136437A1 (en) System, method and program for distributed policy integration
US20150127609A1 (en) Plural architecture master data management
CN106874281B (en) Method and device for realizing database read-write separation
US8549129B2 (en) Live migration method for large-scale IT management systems
CN106648679B (en) Version management method for structured data
CN106657167A (en) Management server, server cluster and management method
CN110633322A (en) Resource information synchronization method and device, electronic equipment and storage medium
CN101414295A (en) Method for upgrading database
US20090100082A1 (en) Replication and mapping mechanism for recreating memory durations
CN114610509A (en) Calling parameter processing method, system, device, storage medium and product
CN114327603A (en) Data caching method and device and computer readable storage medium
US11681682B2 (en) Data processing system and cache update control method
CN104969217A (en) Predictive cache apparatus and method of cache prediction
US8630976B2 (en) Fast search replication synchronization processes
JP2012256103A (en) Team-design support system
KR101063577B1 (en) Schema and stored procedure real-time management system and method of large database
CN112817989B (en) Data processing method, data processing device, storage medium and electronic equipment
CN112632294B (en) Method and system for synchronizing Neo4j data to search server

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