CN111414392B - Cache asynchronous refresh method, system and computer readable storage medium - Google Patents

Cache asynchronous refresh method, system and computer readable storage medium Download PDF

Info

Publication number
CN111414392B
CN111414392B CN202010219946.2A CN202010219946A CN111414392B CN 111414392 B CN111414392 B CN 111414392B CN 202010219946 A CN202010219946 A CN 202010219946A CN 111414392 B CN111414392 B CN 111414392B
Authority
CN
China
Prior art keywords
sql
cache
database
data
record
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.)
Active
Application number
CN202010219946.2A
Other languages
Chinese (zh)
Other versions
CN111414392A (en
Inventor
汲洋弘康
林李杰
郭聪明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Whale Cloud Technology Co Ltd
Original Assignee
Whale Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Whale Cloud Technology Co Ltd filed Critical Whale Cloud Technology Co Ltd
Priority to CN202010219946.2A priority Critical patent/CN111414392B/en
Publication of CN111414392A publication Critical patent/CN111414392A/en
Application granted granted Critical
Publication of CN111414392B publication Critical patent/CN111414392B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages

Abstract

A cache asynchronous refresh method, comprising: detecting a refresh log table of a database cache; when the database data is changed, matching the record to be processed with an SQL characteristic table cached in a database cache according to the table name and the index information, wherein the SQL characteristic table at least comprises SQL characteristic information used for maintaining business application; when the record is matched with the SQL feature, setting the SQL feature state corresponding to the record as refreshing; acquiring corresponding data from a database according to the table name and the primary key information in the refresh log table, and flushing the data into a database cache; after the data refreshing is finished, setting the SQL characteristic state corresponding to the record to be effective, and then deleting the corresponding record in the refreshing log table; and when the record is not matched with the SQL characteristic, deleting the corresponding record in the refresh log table. The method has high availability, high performance and avoids the existence of a large amount of redundant data in the cache which is not accessed by the application.

Description

Cache asynchronous refresh method, system and computer readable storage medium
Technical Field
The invention belongs to the technical field of database caches, and particularly relates to a cache asynchronous refreshing method, a cache asynchronous refreshing device, electronic equipment and a computer readable storage medium.
Background
When the data transmission method is used in a big data era, the scale of service application is increased along with exponential increase of user data quantity, and a traditional high-performance single host system gradually evolves into a distributed system. With the change of the business application deployment architecture, the database resources which the application depends on must also adopt a way of being deployed separately from the application host. When a large amount of applications remotely and frequently access the database, the high network delay occupied by remote access can seriously reduce the processing efficiency of the system from the perspective of the application side; from the perspective of the database, with high concurrent operation of the application, a large amount of host system resources, hardware resources and network resources where the database is located are consumed, so that the stability and performance of the whole system are further weakened, and user experience is influenced. In order to improve the system efficiency of the application, a cache system is usually deployed on an application host, and hot spot data is stored in a local memory, so that the high time delay of remote database access is avoided, and meanwhile, the access pressure of the remote database host is effectively released, thereby achieving the purpose of improving the overall performance and stability of the system.
When the application uses the cache, the requirement on the validity of the cache data is higher and higher, namely the cache data is consistent with the database data. To ensure cache data validity, a synchronous or asynchronous refresh is typically used to keep the cache data consistent with the target database data.
For refreshing data in a synchronous manner, the solution in actual production is to lock the cache periodically, and poll all data in the cache to refresh the difference data from the database to the cache. The scheme periodically blocks the access of the application to the cache data, and the application performance is seriously influenced.
For asynchronous data refreshing, the solution in actual production is usually to construct a data change log table, and by recording the transaction log of database operation, the data in the cache is refreshed in a targeted manner. On one hand, the scheme can not ensure that the refreshed data is the data existing in the cache, namely, a large amount of invalid operations exist in the data refreshing; on the other hand, the application cannot quickly check whether the used cache data is being refreshed, that is, the validity of the application accessing the cache cannot be guaranteed.
In the prior art, a cache data change refreshing method generally performs data refreshing by using the dimension of a table, but once part of data in a certain table is frequently changed (the rest of data is kept unchanged), the table cannot actually use a cache, so that the availability of the cache is seriously reduced; in addition, the method avoids a large amount of invalid operations in data refreshing in a mode of loading full table data when the cache is started, but introduces a large amount of redundant data which are not accessed or never accessed by application, thereby effectively wasting a large amount of host memory.
Disclosure of Invention
In view of the above-mentioned deficiencies of the prior art, it is an object of the present invention to provide a method for improved asynchronous refresh of a database cache with a high availability of the cache system and low redundancy of data.
The embodiment of the invention discloses a cache asynchronous refreshing method, which comprises the following steps: detecting a refresh log table of a database cache, wherein the refresh log table at least comprises a table name, primary key information and index information; when the database data is changed, matching the record to be processed with an SQL characteristic table cached in a database cache according to the table name and the index information, wherein the SQL characteristic table at least comprises SQL characteristic information used for maintaining business application; when the record is matched with the SQL feature, setting the SQL feature state corresponding to the record as refreshing; acquiring corresponding data from a database according to the table name and the primary key information in the refresh log table, and flushing the data into a database cache; after the data refreshing is finished, setting the SQL characteristic state corresponding to the record to be effective, and then deleting the corresponding record in the refreshing log table; and when the record is not matched with the SQL characteristic, deleting the corresponding record in the refresh log table.
In one possible embodiment, the detecting the refresh log table of the database cache in real time includes: judging whether a record to be processed exists in a refreshing log table of a database cache; if the record to be processed exists, the table name and the index field are obtained from the refresh log table.
In a possible embodiment, the method further comprises, before initializing the database cache, namely creating a cache table according to a table structure of the database; and when the cache tables are successfully created, creating the SQL characteristic table and the cache refreshing log table.
In one possible embodiment, the structure of the cache table is the same as the structure of the database table.
In one possible embodiment, when a business application accesses data, an SQL query request of the business application is received; performing feature analysis on the request and obtaining at least one SQL feature; matching the SQL characteristics with the SQL characteristic table; when the feature matching is successful and the state is effective, accessing the database cache for data query; and when the characteristics are not successfully matched, accessing the database to perform data query, and recording the SQL characteristics in an SQL characteristic table.
A cache asynchronous refresh system comprises a cache engine, a database and a database cache; the database cache comprises a refreshing log table, an SQL characteristic table and a cache table; the cache engine comprises a cache refreshing module configured to detect a refresh log table, wherein the refresh log table at least comprises a table name, primary key information and index information; the cache engine is also configured to match the record to be processed with an SQL characteristic table according to the table name and the index information when the database data is changed, wherein the SQL characteristic table at least comprises SQL characteristic information used for maintaining business application use; the database cache is configured to set the SQL feature state corresponding to the record to be in refresh when the record is matched with the SQL feature; acquiring corresponding data from a database according to the table name and the primary key information in the refresh log table, and flushing the data into a database cache; after the data refreshing is finished, setting the SQL characteristic state corresponding to the record to be effective, and then deleting the corresponding record in the refreshing log table; the database cache is further configured to delete a corresponding record in the refresh log table when the record does not match the SQL feature.
In one possible embodiment, the cache refreshing module is further configured to determine whether there is a pending record in a refresh log table of the database cache; if the record to be processed exists, the table name and the index field are obtained from the refresh log table.
In one possible embodiment, the database cache is further configured to create a cache table according to a table structure of the database; and when the cache tables are successfully created, creating the SQL characteristic table and the cache refreshing log table.
In one possible embodiment, when the business application accesses the data, the caching engine is further configured to receive an SQL query request for the business application; performing feature analysis on the request and obtaining at least one SQL feature; matching the SQL characteristics with the SQL characteristic table; when the feature matching is successful and the state is effective, accessing the database cache for data query; and when the characteristics are not successfully matched, accessing the database to perform data query, and recording the SQL characteristics in an SQL characteristic table.
A computer storage medium storing a computer program which, when executed, implements the cache asynchronous refresh method according to the preceding.
Compared with the prior art, the invention has the following beneficial effects:
the method realizes high availability of cache asynchronous refreshing, controls the influence range of the cache data asynchronous refreshing process at a record level, solves the problem that the table cannot be accessed in the cache when the table data is changed and refreshed, and improves the availability of a database cache system. Meanwhile, the cache data asynchronous refreshing flow only carries out refreshing change operation on the effective data in the cache, and the performance of cache data asynchronous refreshing is improved.
In addition, when asynchronous refreshing from database data to cache data is carried out, on one hand, the changed data can be matched with SQL characteristics in an SQL characteristic table, whether the changed data is in the cache or not is determined, effective data in the cache is controlled to be refreshed, the fact that the full amount of data is loaded to the cache for refreshing is avoided, the performance of data changing and refreshing is improved, and the redundancy of the cache data is reduced.
Drawings
FIG. 1 is a schematic diagram of a cache asynchronous refresh system according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method according to an embodiment of the present invention;
FIG. 3 is a flow chart of asynchronous refresh of database cache data according to an embodiment of the present invention;
FIG. 4 is a flow diagram of a database cache data access according to an embodiment of the present invention;
FIG. 5 is a flowchart of database cache system initialization, according to an embodiment of the invention.
Detailed Description
In order to facilitate understanding of those skilled in the art, the present invention will be further described with reference to the following examples and drawings, which are not intended to limit the present invention.
Existing methods of cache asynchronous refresh typically implement access to cache data by applications in the dimension of a table. This approach reduces the availability of the cache system while also resulting in data redundancy and memory wastage.
Based on the above-mentioned discovered problems, the embodiment of the present invention discloses a system and a method for asynchronously refreshing a cache based on SQL features, and as shown in fig. 1, the system includes: a cache engine 20, a database cache 30, and a database 40.
The cache engine 20 may include, among other things, an SQL feature parsing module, a feature matching module, and a cache refresh module. The caching engine may receive SQL query requests from the application 10 of the business host/computing device.
The SQL feature parsing module may read information from an SQL feature table in the database cache.
The cache engine 20 receives the request and performs SQL parsing through the SQL feature parsing module, resulting in one or more basic query SQL. Each basic query SQL has a corresponding table name, index field value, and thus constitutes one or more SQL features. The data that the application needs to access is actually the full set of data corresponding to each SQL feature.
The SQL characteristic analysis module is mainly used for splitting complex SQL into general query SQL with indexes, for example, the SQL with or (or) condition is dynamically split into a plurality of SQL for storage; the sub-query is split into a plurality of base queries.
The feature matching module may be used to check the SQL feature table in the database cache whether the corresponding SQL feature may access the cache. When the cache is not allowed to be accessed, automatically switching to access the database to take out data, and recording the SQL characteristics in an SQL characteristic table; when the access to the cache is allowed, the access to the cache table is automatically switched to fetch the data. When the SQL features are multiple, the data are respectively fetched from the database or the cache according to the conditions, and result set combination is carried out.
The cache refreshing module can be used for detecting a refreshing log table in the database cache, controlling the characteristic state according to the detection condition and changing the cache data.
The database cache 30 may include SQL feature tables, flush log tables, and cache tables. The SQL feature table can comprise table names, index information, access time and status fields, and is used for checking and recording SQL used by the application. The SQL feature tables are stored in an in-memory database. The size of the SQL feature table takes the number of indexes as a dimension, and the table size reaches the maximum if and only if the data of each index field is not repeated at all.
The refresh log table may include a table name, primary key information, index information, and an operation type for recording a database change transaction log. Wherein the table name and the index information are the main keys of the SQL characteristic table
The cache table structure is consistent with the database table structure, and the cache table structure is read from the database according to cache configuration after the cache service is started, and tables corresponding to the database one by one are created in the cache.
The database 40 includes tables and is used to write record changes to the refresh record table by record dimension when database data changes.
As shown in fig. 2, the embodiment of the present invention further discloses a cache asynchronous refresh method based on SQL characteristics, which includes the following steps:
s10, a refresh log table of the database cache is detected, wherein the refresh log table includes a table name, primary key information, index information, and may further include an operation type field.
And detecting the refreshed log table in real time through a cache refreshing module, and judging whether the data in the database is changed. When a database transaction occurs in the database, a corresponding transaction log is written into the database cache. Specifically, whether a record to be processed exists in the refresh log table can be judged; if the record to be processed exists, the table name and the index field are obtained from the refresh log table.
And S20, when the database data is changed, matching the record to be processed with the SQL feature table cached in the database according to the table name and the index information, wherein the SQL feature table can comprise SQL features, states, access time, index information and the like used for maintaining application.
When the database data is changed, the database transaction is written into the refresh log table. Specifically, as shown in fig. 3, for a certain database data change operation set, the operated transaction log is written into the cache refresh log table according to the record dimension, and i records are generated. At this time, the cache flush service checks that there are records in the flush log table to be processed, polls to access the i records, and each polling operation is counted as a flush batch.
Referring to steps 101 and 102 in fig. 3, a process of obtaining a foreign key (table name, index information field) in the refresh log table and matching in the SQL feature table is performed. Since the foreign key is the primary key of the SQL feature table, the matching relationship is unique, and the matching performance is high.
S30, when the record is matched with the SQL feature, setting the SQL feature state corresponding to the record as refreshing; acquiring corresponding data from a database according to the table name and the primary key information in the refresh log table, and flushing the data into a database cache according to the operation type in the refresh log table; and when the data refreshing is finished, setting the SQL characteristic state corresponding to the record to be effective.
Specifically, referring to fig. 3, after the matching is completed, it is found that j records in the refresh log table match the SQL feature, and the state corresponding to the matched SQL feature record is set to [ refresh ], and at this time, the data is not allowed to be accessed from the cache by the application. Step 103 is to obtain unique data from the database according to the primary key (table name, primary key information) in the refresh log table to refresh the operation type in the log table and flush the data into the cache.
Wherein the operation types of the insertion and the update are refreshed into the database cache in a combined mode; the operation type for deletion is flushed into the database cache in a deleted manner.
Every time data is refreshed into the cache, whether the data is not refreshed under the corresponding SQL characteristics needs to be checked. Within a refresh batch, the SQL feature state is reset to [ in effect ] if and only if there is no data not refreshed for the SQL feature corresponding to the SQL feature state [ in refresh ].
And when the corresponding refreshing operation is finished, deleting the corresponding record in the refreshing log table. Not deleting records in the refresh log table at this time may result in repeated refreshes, affecting performance.
And S40, when the record is not matched with the SQL characteristic, deleting the corresponding record in the refresh log table.
Specifically, referring to step 104 in fig. 3, the flow processing that i-j records in the refresh log table cannot be matched with the SQL features is performed, and these data applications have not been accessed before. In order to reduce database cache data redundancy, the data is directly deleted from the flush log table and is not asynchronously flushed to the cache.
The method can control the influence range of asynchronous refreshing by recording the dimension, when a certain piece of data is refreshed from a physical library to the cache, the normal access of the rest data in the cache is not influenced, and the high availability of the cache system is greatly improved.
The asynchronous refresh method also includes initializing the cache system prior to performing cache data access and cache data refresh. Initializing the database cache, namely creating a cache table according to the table structure of the database; and when the cache tables are successfully created, creating the SQL characteristic table and the cache refreshing log table.
Specifically, fig. 4 is a flowchart of initialization of the database cache system based on the SQL feature according to the embodiment of the present invention. After the cache service is started, the corresponding table structure is read from the remote database according to the cache configuration and is established in the local cache. And if and only if all the configuration cache tables are successfully established, establishing the SQL characteristic table and the cache refreshing log table. The SQL feature table and the cache refreshing log table are system tables, and table structures do not need to be read from a remote database. Step 201 describes that the preparation work of normal operation of the cache system is applied, the marked cache state is modified, and after the cache refreshing module is started, the system initialization is completed.
The table structure of the cache table is read out from the database according to the cache configuration, and a table corresponding to the database one to one is created in the database cache. It should be noted that the table structure that is built contains the fields, primary keys, and indices that the application needs to access, and does not require the loading of the full amount of data in the database table. Meanwhile, the SQL characteristic table is established in a database cache and used for checking and recording SQL used by the application.
The method also includes the specific steps when the application accesses the data. When the application accesses data, the cache is accessed through the cache engine. The cache engine parses the application SQL request to obtain one or more SQL features, and matches in an SQL feature table. When a certain SQL feature is completely matched with the record in the SQL feature table and the state is effective, the cache can be accessed, and the data meeting the condition is returned to the application; otherwise, the SQL feature is recorded into an SQL feature table, the recording state is [ to be generated ], and the database is switched to access data through the cache drive. It should be appreciated that the cache engine implements the functionality of transparent switching of databases and caches, merging of multiple SQL feature query datasets.
Specifically, fig. 5 is a flowchart of the database cache data access based on the SQL feature according to the present invention. The application uses a complex multi-feature SQL to access data, and the SQL is transmitted to a cache engine to be analyzed, so that N SQL features are obtained. Different SQL characteristics are reflected in the difference of the used index field and index value, and the same table is accessed.
Step 301 is to match the N SQL features in the SQL feature table to obtain N 1 One matches in SQL feature table and state is [ effective]Is characterized by N 2 One is matched in SQL feature table and state is [ in refresh ]]Is characterized by N 3 Each is matched in the SQL feature table and has a state of [ to be validated ]]Is characterized by N 4 Features that are not matched in the SQL feature table.
In the embodiment, one SQL relates to multiple SQL characteristics, and as long as part of characteristics use local cache access, the system is accessedThe performance of (2) also has a boosting effect. N is a radical of 1 、N 2 、N 3 、N 4 The number of data actually accessed at last is not represented, and the representation of different SQL characteristics in the embodiment realizes the control of the system on the record dimension, namely [ effective]Cached data corresponding to SQL characteristics of the state, not subject to not [ effect ]]SQL characteristics of the state affect, thereby achieving high availability of the system. N is a radical of 1 、N 2 、N 3 、N 4 Corresponding to step 302, step 303, step 304, and step 305, respectively.
Step 302 is a scenario where the status of the matched SQL feature is [ valid ], where the data access can be read directly from the database cache.
Steps 303 and 304 are the scenario that the state of the matched SQL feature is not in effect, and at this time, the SQL feature corresponds to the data and the data change is being asynchronously refreshed or refreshed for the first time. As can be seen from FIG. 3, the data refresh process uses the primary key to locate a unique record, so the state changes in a short time. When the state changes to [ valid ] within a short time, the data access can be read directly from the database cache at this time; when the status has not changed to [ valid ] for a brief period of time, the data access can only be read from the remote database at this time.
Step 305 is a scenario where the SQL feature is not matched, and at this time, it needs to determine whether the corresponding SQL feature has a use index. And when the corresponding SQL feature uses the index, inserting the corresponding SQL feature into the SQL feature table, and setting the SQL feature state as [ to be validated ]. Then, the remote database is switched to access the data, and the returned data is gathered into the cache. And if and only after all the data of the query are merged into the cache, setting the SQL characteristic state using the index as effective. When the corresponding SQL features do not use the index, the data is directly switched to the remote database to be accessed, and a result set returned by the remote database is not cached.
Step 306 is a scenario of merging multi-feature SQL query result sets, and when the application access SQL is a single feature, result set merging need not be performed.
The embodiment of the invention is based on SQL characteristics, and can accurately match the data accessed by the application by constructing the SQL characteristic table, realize row-level data control, and refine the access operation of the application from table dimension to record dimension. When the cache data of the database is asynchronously refreshed, on one hand, the cache data which does not participate in refreshing can still be normally accessed by the application, thereby not only ensuring the validity of the data, but also improving the availability of the cache system; on the other hand, asynchronous refreshing is carried out on the data which is accessed by the application, and a large amount of redundant data which is not accessed by the application is avoided in a cache.
It should be appreciated that the above-described methods are all implemented in a computer program capable of running on LINUX, AIX, HP, and WINDOWS operating systems and are not dependent on the software onboard the operating systems.
In the several embodiments provided in the present application, it should be understood that the disclosed system and method may be implemented in other ways. For example, the above-described embodiments are merely illustrative, and for example, a division of a unit is merely a division of a logic function, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed.
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 network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment of the present invention.
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.
While the invention has been described in terms of its preferred embodiments, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention.

Claims (10)

1. A cache asynchronous refresh method is characterized in that,
detecting a refresh log table of a database cache, wherein the refresh log table comprises SQL characteristics, states, access time and index information used for maintaining application use;
when the database data is changed, matching the record to be processed with an SQL characteristic table cached in a database cache according to the table name and the index information, wherein the SQL characteristic table comprises SQL characteristics, a state, access time and index information used for maintaining application; the SQL characteristics comprise one or more basic query SQL obtained by SQL analysis through an SQL characteristic analysis module, and each basic query SQL is provided with a corresponding table name, an index field and an index field value;
when the record is matched with the SQL feature, setting the SQL feature state corresponding to the record as refreshing; acquiring corresponding data from a database according to the table name and the primary key information in the refresh log table, and flushing the data into a database cache; after the data refreshing is finished, setting the SQL characteristic state corresponding to the record to be effective, and then deleting the corresponding record in the refreshing log table;
when the record is not matched with the SQL characteristic, deleting and refreshing the corresponding record in the log table;
switching to a remote database to access data, collecting the returned data into a cache, setting the SQL characteristic state of the index into effective after the inquired data are all merged into the cache, and directly switching to the remote database to access the data when the corresponding SQL characteristic does not use the index, and not caching a result set returned by the remote database; and combining the scenes of the multi-feature SQL query result set, wherein when the application access SQL is a single feature, the result set does not need to be combined.
2. The cache asynchronous refresh method of claim 1, wherein detecting a refresh log table of the database cache in real time comprises: judging whether a record to be processed exists in a refreshing log table of a database cache; if the record to be processed exists, the table name and the index field are obtained from the refresh log table.
3. The cache asynchronous refresh method of claim 1, further comprising, prior to the method, initializing the database cache by creating a cache table according to a table structure of a database; and when the cache tables are successfully created, creating the SQL characteristic table and the cache refreshing log table.
4. The cache asynchronous refresh method of claim 3, wherein the structure of the cache table is the same as the structure of the database table.
5. The cache asynchronous refresh method of claim 1, wherein when a business application accesses data, receiving a SQL feature query request of the business application; performing feature analysis on the request and obtaining at least one SQL feature; matching the SQL characteristics with the SQL characteristic table; when the feature matching is successful and the state is effective, accessing the database cache for data query; and when the characteristics are not successfully matched, accessing the database to perform data query, and recording the SQL characteristics in an SQL characteristic table.
6. A cache asynchronous refresh system, comprising a cache engine, a database, and a database cache; the database cache comprises a refreshing log table, an SQL characteristic table and a cache table;
the cache engine comprises a cache refreshing module configured to detect a refresh log table, wherein the refresh log table at least comprises a table name, primary key information and index information;
the cache engine is further configured to, when database data is changed, match a record to be processed with an SQL feature table according to the table name and the index information, the SQL feature table including SQL features, states, access times, and index information for maintaining application usage; the SQL characteristics comprise one or more basic query SQL obtained by SQL analysis through an SQL characteristic analysis module, and each basic query SQL is provided with a corresponding table name, an index field and an index field value;
the database cache is configured to set the SQL feature state corresponding to the record to be in refresh when the record is matched with the SQL feature; acquiring corresponding data from a database according to the table name and the primary key information in the refreshing log table, and flushing the data into a database cache; after the data refreshing is finished, setting the SQL characteristic state corresponding to the record to be effective, and then deleting the corresponding record in the refreshing log table;
the database cache is further configured to delete a corresponding record in the refresh log table when the record does not match the SQL feature;
switching to a remote database to access data, collecting the returned data into a cache, setting the SQL characteristic state of the index into effective after the inquired data are all merged into the cache, and directly switching to the remote database to access the data when the corresponding SQL characteristic does not use the index, and not caching a result set returned by the remote database;
and combining the scenes of the multi-feature SQL query result set, wherein when the application access SQL is a single feature, the result set does not need to be combined.
7. The cache asynchronous refresh system of claim 6, wherein the cache refresh module is further configured to determine whether there are pending records in a refresh log table of the database cache; if the record to be processed exists, the table name and the index field are obtained from the refresh log table.
8. The cache asynchronous refresh system of claim 6, the database cache further configured to create a cache table according to a table structure of the database; and when the cache tables are successfully created, creating the SQL characteristic table and the cache refreshing log table.
9. The cache asynchronous refresh system of claim 6, the cache engine further configured to, when the business application accesses the data, receive an SQL feature query request for the business application; performing feature analysis on the request and obtaining at least one SQL feature; matching the SQL characteristics with the SQL characteristic table; when the feature matching is successful and the state is effective, accessing the database cache for data query; and when the characteristics are not successfully matched, accessing the database to perform data query, and recording the SQL characteristics in an SQL characteristic table.
10. A computer storage medium storing a computer program, characterized in that the computer program, when executed, implements the cache asynchronous refresh method according to any of claims 1-5.
CN202010219946.2A 2020-03-25 2020-03-25 Cache asynchronous refresh method, system and computer readable storage medium Active CN111414392B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010219946.2A CN111414392B (en) 2020-03-25 2020-03-25 Cache asynchronous refresh method, system and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010219946.2A CN111414392B (en) 2020-03-25 2020-03-25 Cache asynchronous refresh method, system and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN111414392A CN111414392A (en) 2020-07-14
CN111414392B true CN111414392B (en) 2022-08-05

Family

ID=71491485

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010219946.2A Active CN111414392B (en) 2020-03-25 2020-03-25 Cache asynchronous refresh method, system and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN111414392B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111931094A (en) * 2020-07-16 2020-11-13 北京首汽智行科技有限公司 Dynamic synchronization method for cache data
CN113032344B (en) * 2020-08-25 2021-08-27 广州锦行网络科技有限公司 Method for cleaning remote login log records
CN112749197B (en) * 2021-01-12 2024-04-05 中国平安财产保险股份有限公司 Data fragment refreshing method, device, equipment and storage medium
CN113742381B (en) * 2021-08-30 2023-07-25 欧电云信息科技(江苏)有限公司 Cache acquisition method, device and computer readable medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102508854A (en) * 2011-09-29 2012-06-20 畅捷通信息技术股份有限公司 Data access device and method
CN103827865A (en) * 2011-09-23 2014-05-28 国际商业机器公司 Improving database caching utilizing asynchronous log-based replication
CN104572689A (en) * 2013-10-17 2015-04-29 腾讯科技(深圳)有限公司 Data synchronizing method, device and system
CN105324770A (en) * 2013-04-30 2016-02-10 亚马逊科技公司 Efficient read replicas
CN108811271A (en) * 2018-04-28 2018-11-13 上海与德科技有限公司 A kind of light adjusting method, device, intelligent desk lamp and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6598058B2 (en) * 1999-09-22 2003-07-22 International Business Machines Corporation Method and apparatus for cross-node sharing of cached dynamic SQL in a multiple relational database management system environment
US6721765B2 (en) * 2002-07-02 2004-04-13 Sybase, Inc. Database system with improved methods for asynchronous logging of transactions
US9477609B2 (en) * 2013-04-22 2016-10-25 Sap Se Enhanced transactional cache with bulk operation
CN108334505B (en) * 2017-01-19 2022-01-07 阿里巴巴集团控股有限公司 Data processing method and device, server and inventory system
CN110597909B (en) * 2019-09-12 2023-03-14 广州南翼信息科技有限公司 Method for keeping state consistency of client and multi-terminal equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103827865A (en) * 2011-09-23 2014-05-28 国际商业机器公司 Improving database caching utilizing asynchronous log-based replication
CN102508854A (en) * 2011-09-29 2012-06-20 畅捷通信息技术股份有限公司 Data access device and method
CN105324770A (en) * 2013-04-30 2016-02-10 亚马逊科技公司 Efficient read replicas
CN104572689A (en) * 2013-10-17 2015-04-29 腾讯科技(深圳)有限公司 Data synchronizing method, device and system
CN108811271A (en) * 2018-04-28 2018-11-13 上海与德科技有限公司 A kind of light adjusting method, device, intelligent desk lamp and storage medium

Also Published As

Publication number Publication date
CN111414392A (en) 2020-07-14

Similar Documents

Publication Publication Date Title
CN111414392B (en) Cache asynchronous refresh method, system and computer readable storage medium
EP3047397B1 (en) Mirroring, in memory, data from disk to improve query performance
EP3047400B1 (en) Multi-version concurrency control on in-memory snapshot store of oracle in-memory database
US7930274B2 (en) Dual access to concurrent data in a database management system
US20200133800A1 (en) Key-value store on persistent memory
US7774319B2 (en) System and method for an optimistic database access
US9442858B2 (en) Solid state drives as a persistent cache for database systems
JP7101566B2 (en) Multiversion Concurrency Control (MVCC) in non-volatile memory
US20150088811A1 (en) Mechanism to run oltp workload on in-memory database under memory pressure
US8417680B2 (en) System for improving access efficiency in database and method thereof
US20150046413A1 (en) Delta store giving row-level versioning semantics to a non-row-level versioning underlying store
US8793441B2 (en) System, method and computer program product for managing data using a write-back cache unit
US9053153B2 (en) Inter-query parallelization of constraint checking
CN106354732B (en) A kind of off-line data version conflict solution for supporting concurrently to cooperate with
US11099998B2 (en) Method and device for optimization of data caching
KR101806394B1 (en) A data processing method having a structure of the cache index specified to the transaction in a mobile environment dbms
CN113836162A (en) Method and device for service decoupling and automatic updating of multi-level cache
EP2064633B1 (en) System, method and computer program product for managing data
US7240065B2 (en) Providing mappings between logical time values and real time values
CN114207602A (en) Reducing requests using probabilistic data structures
Richardson Disambiguating databases
US7130931B2 (en) Method, system, and article of manufacture for selecting replication volumes
US20200310862A1 (en) Adaptive hardware transactional memory based concurrency control
CN114201551A (en) Data storage method and data storage device
CN115576494A (en) Data storage method and computing device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant