Data processing method and device, electronic equipment and computer readable medium
By generating a cached data processing relationship table and processing the cached data according to the target data processing method, the problems of invalid data occupying space and data inconsistency in the cache are solved, thereby improving data processing efficiency and consistency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
- Filing Date
- 2021-01-20
- Publication Date
- 2026-05-15
AI Technical Summary
Invalid data in the cache occupies space, resulting in low data processing efficiency. Furthermore, the cached data is out of sync with the database data, leading to data processing errors.
Generate a cached data processing relationship table, which includes the application's data processing method identifier and the identifier of the data to be processed in the database. Process the data in the cache according to the target data processing method and delete invalid data in a timely manner.
It improves data processing efficiency, reduces errors caused by invalid data, and ensures consistency between cached data and database data.
Smart Images

Figure CN113760984B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of this disclosure relate to the field of computer technology, and more particularly to data processing methods, apparatus, electronic devices, and computer-readable media. Background Technology
[0002] When processing data, it's common practice to load data from the database into a cache. The application then directly processes this cached data, improving efficiency. However, applications can perform various types of data processing on the cached data. These different processing methods can alter the cached data, potentially leading to the following problems:
[0003] First, invalid data in the cache occupies cache space, reducing data processing efficiency;
[0004] Second, when data changes, the cached data and the database data become out of sync, leading to data processing errors. Summary of the Invention
[0005] The summary portion of this disclosure is intended to provide a brief overview of the concepts, which will be described in detail in the detailed description portion. This summary portion is not intended to identify key or essential features of the claimed technical solutions, nor is it intended to limit the scope of the claimed technical solutions.
[0006] Some embodiments of this disclosure provide data processing methods, apparatuses, electronic devices, and computer-readable media to address the technical problems mentioned in the background section above.
[0007] In a first aspect, some embodiments of this disclosure provide a data processing method, the method comprising: in response to application startup, generating a cached data processing relationship table corresponding to the application in a cache, the cached data processing relationship table including a data processing method identifier of the application and a data identifier to be processed in a database corresponding to the application, the data processing method identifier and the data identifier to be processed having a corresponding relationship; in response to detecting a target data processing method corresponding to the application, performing data processing on the data in the cache corresponding to the application based on the target data processing method and the cached data processing relationship table.
[0008] Secondly, some embodiments of this disclosure provide a data processing apparatus, which includes: a cached data processing relation table generation unit configured to generate a cached data processing relation table corresponding to the application in a cache in response to application startup, the cached data processing relation table including a data processing method identifier of the application and a data identifier to be processed in a database corresponding to the application, the data processing method identifier and the data identifier to be processed having a corresponding relationship; and a data processing unit configured to perform data processing on the data corresponding to the application in the cache based on the target data processing method and the cached data processing relation table in response to detecting a target data processing method corresponding to the application.
[0009] Thirdly, some embodiments of this disclosure provide an electronic device, including: one or more processors; and a storage device having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation of the first aspect above.
[0010] Fourthly, some embodiments of this disclosure provide a computer-readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method described in any of the implementations of the first aspect above.
[0011] The various embodiments of this disclosure have the following beneficial effects: Data processing efficiency is improved by processing application data through the data processing methods of some embodiments of this disclosure. Specifically, the reason for low data processing efficiency is that the application cannot promptly process invalid data in the cache during data processing. Therefore, the data processing methods of some embodiments of this disclosure can perform different processing on the cached data according to the type of data processing method. Because different processing is performed on the cached data according to the type of data processing method, the cached data can change according to the type of data processing method, and invalid data in the cache can be deleted promptly. Thus, data processing efficiency is improved, thereby reducing data processing errors caused by invalid data. Attached Figure Description
[0012] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and elements are not necessarily drawn to scale.
[0013] Figure 1 This is a schematic diagram illustrating application scenarios of data processing methods according to some embodiments of this disclosure;
[0014] Figure 2 It corresponds Figure 1 A schematic diagram of the cache data processing relationship table;
[0015] Figure 3 These are flowcharts of some embodiments of the data processing method according to this disclosure;
[0016] Figure 4 These are flowcharts of other embodiments of the data processing methods according to this disclosure;
[0017] Figure 5 This is a flowchart of yet another embodiment of the data processing method according to this disclosure;
[0018] Figure 6 These are schematic diagrams illustrating the structure of some embodiments of the data processing apparatus according to this disclosure;
[0019] Figure 7 This is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. Detailed Implementation
[0020] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0021] It should also be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings. Unless otherwise specified, the embodiments and features described in this disclosure can be combined with each other.
[0022] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0023] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0024] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0025] This disclosure will now be described in detail with reference to the accompanying drawings and embodiments.
[0026] Figure 1 This is a schematic diagram illustrating an application scenario of a data processing method according to some embodiments of the present disclosure.
[0027] like Figure 1 As shown, when the application on electronic device 101 starts, electronic device 101 can set up automatic caching between the business logic layer and the database layer. Automatic caching can include multiple modules such as cache interceptors, cache configuration, SQL (Structured Query Language) parsing, transaction processing, and cache services. Specifically, the cache interceptor can intercept database SQL, automatically caching data for SQL queries of the same type (e.g., query method) to reduce database pressure; and automatically clearing cached data for SQL queries of the same type (e.g., change method). Cache configuration can store data processing method identifiers and corresponding data identifiers to be processed in SQL statements; through configuration center settings, both local and external configurations are supported. SQL parsing can parse SQL statements to extract information such as data processing method identifiers, keywords, and data identifiers to be processed. Transaction processing can detect the transaction status of related data. The cache service can define cache interfaces and related concurrency control interfaces, and can configure external caching as an in-memory implementation of electronic device 101. After automatic caching, electronic device 101 can obtain a cached data processing relationship table, such as... Figure 2 The diagram shows the relationship table for cached data processing. Figure 2 The cached data processing relationship table can contain data processing method identifiers (such as...). Figure 2 SelectMethod-1, SelectMethod-2) and the identifier of the data to be processed (e.g. Figure 2 Table-1, Table-2, and Table-3 (in the table). The data processing method identifier and the data to be processed identifier can be respectively associated with... Figure 2 The database query methods and database modification methods correspond.
[0028] Subsequently, the electronic device 101 can process the received target data about the application according to the method and Figure 2The cached data processing relationship table in the system processes the data corresponding to the application in the cache. When the target data processing method is a database query method, the data to be processed corresponding to the data identifier remains unchanged. However, when the target data processing method is a database modification method, various modifications are made to the data to be processed corresponding to the data identifier, causing the data to be processed in the cache to differ from the data to be processed in the database. Therefore, when processing data using the database modification method, the electronic device 101 can directly delete the corresponding data to be processed from the cache. This improves data processing efficiency and allows for timely deletion of changed data from the cache, preventing data processing errors.
[0029] It should be understood that Figure 1 The number of electronic devices 101 shown is merely illustrative. Any number of electronic devices 101 may be used depending on the implementation requirements.
[0030] Continue to refer to Figure 3 , Figure 3 A flow 300 of some embodiments of a data processing method according to the present disclosure is shown. The data processing method includes the following steps:
[0031] Step 301: In response to application startup, generate a cache data processing relationship table corresponding to the above application in the cache.
[0032] In some embodiments, the entity executing the data processing method (e.g. Figure 1 The electronic device 101 shown can detect whether an application is launched via a wired or wireless connection. It should be noted that the aforementioned wireless connection methods may include, but are not limited to, 3G / 4G / 5G connections, WiFi connections, Bluetooth connections, WiMAX connections, Zigbee connections, UWB (ultra wideband) connections, and other currently known or future wireless connection methods.
[0033] When an application is detected to be starting, the executing entity can scan and parse the application's various data processing methods on the database, and then generate a cached data processing relationship table in the cache. This cached data processing relationship table contains the data processing method identifiers of the application and the corresponding data identifiers to be processed in the application's database. These data processing method identifiers and data identifiers to be processed have a corresponding relationship, and the generated cached data processing relationship table can be configured as follows: Figure 2 As shown.
[0034] Step 302: In response to detecting the target data processing method corresponding to the above-mentioned application, data processing is performed on the data corresponding to the above-mentioned application in the cache based on the target data processing method and the cache data processing relationship table.
[0035] In some embodiments, based on the aforementioned cached data processing relationship table, the executing entity can receive the target data processing method during the application data processing process, and perform data processing on the data corresponding to the aforementioned application in the cache through the target data processing method and the cached data processing relationship table. As described above, different target data processing methods can obtain or delete corresponding data to be processed through the cached data processing relationship table to avoid data processing errors and improve data processing efficiency.
[0036] The data processing methods disclosed in some embodiments of this disclosure process application data, thereby improving data processing efficiency. Specifically, the reason for low data processing efficiency is that the application cannot promptly process invalid data in the cache during data processing. Therefore, the data processing methods in some embodiments of this disclosure can perform different processing on the cached data according to the type of data processing method. Because different processing is applied to the cached data according to the type of data processing method, the cached data can change according to the type of data processing method, and invalid data can be deleted from the cache in a timely manner. This improves data processing efficiency and reduces data processing errors caused by invalid data.
[0037] Continue to refer to Figure 4 , Figure 4 A flow 400 of some embodiments of a data processing method according to the present disclosure is shown. The data processing method includes the following steps:
[0038] Step 401: In response to application startup, query the data processing method identifier of the data processing method of the above application and the data to be processed identifier of the data to be processed for the corresponding data processing method.
[0039] In some embodiments, the entity executing the data processing method (e.g. Figure 1 When the electronic device 101 shown detects that an application has started, it can query the data processing method identifier of the application's data processing method and the pending data identifier of the corresponding data processing method. Specifically, when the application starts, the executing entity can query the various data processing methods of the application on the database. These various data processing methods are typically used to process specified pending data, and each corresponds to a pending data identifier containing the pending data. The executing entity can query the data processing method identifier of the data processing method and the pending data identifier of the pending data.
[0040] In some optional implementations of certain embodiments, the above data processing method includes a data processing statement, which includes a data processing method identifier, a keyword, and a data identifier to be processed, wherein the keyword and the data identifier to be processed have a corresponding positional relationship; and the querying of the data processing method identifier of the data processing method of the above application and the data identifier to be processed of the corresponding data processing method may include the following steps:
[0041] The first step is to match the data processing method identifier of the above data processing statement with a preset data processing method identifier table.
[0042] Applications typically perform data processing through data processing statements. These statements can include a data processing method identifier, keywords, and an identifier for the data to be processed. For example... Figure 2 As shown, the data processing method identifier can be "SelectMethod-1"; the keyword can be "from"; and the data to be processed identifier can be "Table-1", "Table-2", or "Table-3". Accordingly, the executing entity can first match the data processing method identifier of the above data processing statement using a preset data processing method identifier table. This preset data processing method identifier table can contain all data processing method identifiers of the application.
[0043] The second step is to match the keywords of the above data processing statements using a preset keyword table, and determine the data identifier to be processed based on the positional relationship of the keywords.
[0044] Typically, the keyword is followed by the identifier of the data to be processed. The executing entity can match the keywords of the above data processing statements using a pre-defined keyword table, and then determine the identifier of the data to be processed based on the positional relationship of the keywords. The cached data processing relationship table can be considered to be obtained by parsing the data processing methods when the program starts.
[0045] Step 402: Based on the above data processing method identifier and the identifier of the data to be processed, generate the above cached data processing relationship table in the cache.
[0046] After obtaining the data processing method identifier and the data to be processed identifier, the executing entity can generate the aforementioned cached data processing relationship table in the cache based on the correspondence between the data processing method identifier and the data to be processed identifier.
[0047] Step 403: In response to the above target data processing method being a database change method, the above database change method is matched with the data processing method identifier in the above cached data processing relationship table.
[0048] When the executing entity detects that the target data processing method is a database modification method, it can match the database modification method with the data processing method identifier in the aforementioned cached data processing relationship table. The aforementioned database modification method includes at least one of the following: data insertion, data deletion, and data update. Figure 2 For example, the data processing method identifier corresponding to the database change method can be "DeleteMethod". "DeleteMethod" is used for operations on "Table-2". The executing entity can match "DeleteMethod" with the data processing method identifier in the cached data processing relationship table.
[0049] Step 404: In response to a successful match, delete the first target data to be processed corresponding to the first target data processing method identifier that matches the above database change method from the cache, and perform data processing on the first target data to be processed in the above database according to the above database change method.
[0050] When the cached data processing relationship table contains a first target data processing method identifier corresponding to a database change method, the executing entity can further determine the first target pending data identifier corresponding to the first target data processing method identifier, and thus find the first target pending data in the cache. That is, the first target pending data identifier represents the data processing object of the database change method. As described above, when processing data in the cached data processing relationship table using the database change method, directly processing the data processing object in the cache may lead to inconsistencies between the data in the cache and the data in the database, resulting in data processing errors. Therefore, the executing entity can delete the corresponding first target pending data according to the database change method. Figure 2 For example, the data processing method identifier corresponding to the database change method can be "DeleteMethod". "DeleteMethod" is used for operations on "Table-2". The executing entity can then delete the data corresponding to "Table-2" from the cache. In this way, expired cached data is automatically cleaned up based on the cached data processing relationship table, reducing the tediousness of manual processing and also lowering the possibility of human error.
[0051] In some optional implementations of certain embodiments, before matching the database modification method with the data processing method identifier in the cached data processing relationship table in response to the target data processing method being a database modification method, the following steps may be included:
[0052] The first step is to parse the data processing statements corresponding to the above database change methods to determine the first target data to be processed.
[0053] Before matching with the cached data processing relationship table, the executing entity can first parse the data processing statement corresponding to the database change method to determine the first target data to be processed.
[0054] The second step is to determine the database query method identifier corresponding to the first target data to be processed from the cached data processing relationship table mentioned above.
[0055] After identifying the primary target data to be processed, the corresponding database query method identifier can be determined from the cached data processing relationship table. For example... Figure 2 As shown, "DeleteMethod" is used to operate on "Table-2", and the database query method to be matched for "Table-2" in the cached data processing relationship table is identified as "SelectMethod-1". "SelectMethod-1" operates on both "Table-1" and "Table-2".
[0056] In some optional implementations of certain embodiments, matching the database modification method with the data processing method identifier in the cached data processing relationship table may include the following steps:
[0057] The first step is to query the first status information of the data to be processed corresponding to the database query method identifier mentioned above.
[0058] In practice, there may be multiple data operations on the data to be processed. Therefore, when performing operations on the data to be processed, the first state information of the data can be queried. The first state information is used to characterize the current state of the data to be processed, and this information can include "unprocessed" or "processing". "Unprocessed" indicates that the data to be processed has not changed; "processing" indicates that the data to be processed is undergoing changes.
[0059] The second step is to match the data processing method identifier in the cached data processing relationship table with the database query method identifier mentioned above, in response to the above status information being unprocessed.
[0060] When the status information is "unprocessed," it means that there are no other data processing methods to process the data to be processed. In this case, the executing entity can match the database query method identifier to the data processing method identifier in the cached data processing relationship table, determine the first target data to be processed, and then delete the first target data from the cache. As described above, the database query method identifier to be matched can be "SelectMethod-1," and "SelectMethod-1" operates on both "Table-1" and "Table-2." Therefore, the first target data to be processed can be "Table-1" and "Table-2." When the database change method is "InsertMethod," the executing entity can delete the corresponding data in the cache according to the above steps and directly process the data in the database.
[0061] In some optional implementations of certain embodiments, matching the database modification method with the data processing method identifier in the cached data processing relationship table may include: performing a rollback operation on the database modification method in response to the status information indicating that processing is in progress.
[0062] When the status information is "processing," it indicates that other data processing methods are currently processing the data to be processed. At this time, the executing entity can perform a rollback operation on the database modification method, waiting for the other data processing methods to complete their processing before executing the database modification method. This achieves concurrency control over cached data, preventing erroneous processing of the data to be processed. Simultaneously, it allows for timely removal of data from the cache, preventing the generation of erroneous data and improving data processing efficiency.
[0063] Further reference Figure 5 This illustrates a flow 500 of another embodiment of the data processing method. Flow 500 of the data processing method includes the following steps:
[0064] Step 501: In response to application startup, generate a cache data processing relationship table corresponding to the above application in the cache.
[0065] The content of step 501 is the same as that of step 201, and will not be repeated here.
[0066] Step 502: In response to the above target data processing method being a database query method, the above database query method is matched with the data processing method identifier in the above cached data processing relationship table.
[0067] When the target data processing method is a database query method, the database query method will not modify the data to be processed. The executing entity can first match the database query method with the data processing method identifier in the cached data processing relationship table mentioned above.
[0068] Step 503: In response to a successful match, query the second target data identifier corresponding to the second target data processing method identifier that matches the above database query method.
[0069] A match is successful when the database query method exists in the cached data processing relationship table. The executing entity can then query the second target data identifier corresponding to the second target data processing method identifier that matches the aforementioned database query method.
[0070] Step 504: Obtain the second target data to be processed corresponding to the second target data identifier mentioned above from the cache, and perform data processing on the second target data to be processed according to the database query method mentioned above.
[0071] Once the identifier of the second target data to be processed is determined, the executing entity can search for the corresponding second target data in the cache and process it according to the database query method. This database query method enables automatic data caching, reducing database access pressure.
[0072] In some optional implementations of some embodiments, the above-mentioned response to detecting the target data processing method corresponding to the above-mentioned application, and processing the data corresponding to the above-mentioned application in the cache based on the target data processing method and the cache data processing relationship table, may include: in response to the absence of second target data to be processed corresponding to the second target data to be processed identifier in the cache, querying the second target data to be processed from the database, and saving the second target data to be processed to the cache.
[0073] If the second target data is not present in the cache, it means that the second target data has not yet been loaded into the cache from the database. In this case, the executing entity can query the second target data from the database and save it to the cache. Then, it can perform relevant data processing on the second target data according to the database query method.
[0074] In some optional implementations of certain embodiments, the database includes dynamic data to be processed; and before matching the database query method with the data processing method identifier in the cached data processing relationship table, the following steps may be included:
[0075] The first step is to query the target dynamic data to be processed corresponding to the database query method and process the target dynamic data to be processed in the database. Otherwise, the second status information of the second target data to be processed corresponding to the database query method is queried.
[0076] Data in the database can be static or change over time or with different data processing methods. Data that may change in the database is considered dynamic data to be processed. When a database query method matches this dynamic data to be processed (i.e., the database query method operates on the dynamic data to be processed), even if the dynamic data to be processed is already stored in the cache, the executing entity must still directly query the database for the target dynamic data to be processed corresponding to the database query method and process it, as the dynamic data to be processed may change at any time. When the database query method does not match the dynamic data to be processed, it indicates that the database query method processes other unchanging data in the database. In this case, the executing entity can query the second status information of the second target data to be processed corresponding to the database query method. This second status information includes "unprocessed" or "processing". Here, "unprocessed" and "processing" have the same meaning as "unprocessed" and "processing" included in the first status information.
[0077] The second step is to match the database query method with the data processing method identifier in the cached data processing relationship table if the second state information is unprocessed. Otherwise, the second target data to be processed is queried according to the data acquisition type of the second target data to be processed.
[0078] When the second status information is "unprocessed," it indicates that the second target data to be processed is not occupied by other data processing methods. At this time, the executing entity can return to step 502 and match the aforementioned database query method with the data processing method identifier in the aforementioned cached data processing relationship table. When the second status information is "processing," it indicates that the second target data to be processed is occupied by other data processing methods. The executing entity can further query the second target data to be processed based on the data acquisition type of the second target data to be processed. The aforementioned data acquisition type includes cache query or database query.
[0079] In some optional implementations of some embodiments, before matching the database query method with the data processing method identifier in the cached data processing relationship table, it may include: in response to the data acquisition type being a cache query, matching the database query method with the data processing method identifier in the cached data processing relationship table; otherwise, querying the database for the second target data to be processed corresponding to the database query method.
[0080] When the data retrieval type is a cache query, it means that the second target data to be processed can be directly retrieved from the cache. The execution entity can return to step 502 and match the above database query method with the data processing method identifier in the above cache data processing relationship table. When the data retrieval type is a database query, it means that although the second target data to be processed is currently occupied by other data processing methods, it can still be directly retrieved from the database. Therefore, the execution entity can query the second target data to be processed corresponding to the above database query method from the above database. In this way, concurrent data processing can be achieved, which is beneficial to improving data processing efficiency.
[0081] In some optional implementations of certain embodiments, the above-mentioned response to the absence of second target data corresponding to the second target data identifier in the cache, querying the second target data from the database, may include the following steps:
[0082] The first step is to check again whether the second target data to be processed, corresponding to the database query method described above, exists in the cache.
[0083] When a second target data to be processed needs to be retrieved from the database, other data processing methods may have finished calling the second target data, and the second target data, which is in the cache, can then be retrieved by the database query method. At this point, the executing entity can again check the cache to see if the second target data corresponding to the aforementioned database query method exists.
[0084] The second step is to process the second target data in response to its existence, according to the database query method described above. Otherwise, the second target data is queried from the database and imported into the cache, and then processed.
[0085] When the data exists, the executing entity can directly process the second target data according to the database query method described above. When the data does not exist, the executing entity can query the second target data from the database, import it into the cache, and then process it. This maximizes the use of the cache for data processing, thus improving data processing efficiency.
[0086] Further reference Figure 6 As an implementation of the methods shown in the above figures, this disclosure provides some embodiments of a data processing apparatus, which are similar to... Figure 3 Corresponding to the method embodiments shown, the device can be specifically applied to various electronic devices.
[0087] like Figure 6 As shown, a data processing apparatus 600 in some embodiments includes a cached data processing relation table generation unit 601 and a data processing unit 602. The cached data processing relation table generation unit 601 is configured to generate a cached data processing relation table corresponding to the application in a cache in response to application startup. The cached data processing relation table includes a data processing method identifier of the application and a data identifier to be processed in the database corresponding to the application, and the data processing method identifier and the data identifier to be processed have a corresponding relationship. The data processing unit 602 is configured to perform data processing on the data corresponding to the application in the cache based on the target data processing method and the cached data processing relation table in response to detecting a target data processing method corresponding to the application.
[0088] In some optional implementations of embodiments, the cached data processing relationship table generation unit 601 may include: an identifier query subunit (not shown in the figure) and a cached data processing relationship table generation subunit (not shown in the figure). The identifier query subunit is configured to query the data processing method identifier of the application's data processing method and the data to be processed identifier of the corresponding data processing method; the cached data processing relationship table generation subunit is configured to generate the cached data processing relationship table in the cache based on the data processing method identifier and the data to be processed identifier.
[0089] In some optional implementations of the embodiments, the data processing method includes a data processing statement, which includes a data processing method identifier, a keyword, and a data identifier to be processed. The keyword and the data identifier to be processed have a corresponding positional relationship. The identifier query subunit may include a data processing method identifier matching module (not shown in the figure) and a data identifier to be processed matching module (not shown in the figure). The data processing method identifier matching module is configured to match the data processing method identifier of the data processing statement using a preset data processing method identifier table. The data identifier to be processed matching module is configured to match the keyword of the data processing statement using a preset keyword table and determine the data identifier to be processed based on the positional relationship corresponding to the keyword.
[0090] In some optional implementations of embodiments, the data processing unit 602 may include a first matching subunit (not shown in the figure) and a first data processing subunit (not shown in the figure). The first matching subunit is configured to, in response to the target data processing method being a database modification method, match the database modification method with the data processing method identifier in the cached data processing relationship table. The database modification method includes at least one of the following: data insertion, data deletion, and data update. The first data processing subunit is configured to, in response to a successful match, delete the first target data identifier corresponding to the first target data processing method identifier that matches the database modification method from the cache, and perform data processing on the first target data to be processed in the database according to the database modification method.
[0091] In some optional implementations of the embodiments, the data processing unit 602 may further include: a data processing statement parsing subunit (not shown in the figure) and a database query method identifier determination subunit (not shown in the figure). The data processing statement parsing subunit is configured to parse the data processing statement corresponding to the database change method to determine the first target data to be processed; the database query method identifier determination subunit is configured to determine the database query method identifier corresponding to the first target data to be processed from the cached data processing relationship table.
[0092] In some optional implementations of embodiments, the first matching subunit may include: a first status information query module (not shown in the figure) and a first database query method identifier matching module (not shown in the figure). The first status information query module is configured to query the first status information of the data to be processed corresponding to the database query method identifier to be matched, the first status information including "not processed" or "processing in progress." The first database query method identifier matching module is configured to, in response to the status information being "not processed," match the database query method identifier to be matched with the data processing method identifier in the cached data processing relationship table.
[0093] In some optional implementations of the embodiments, the first matching subunit may include: a second database query method identification matching module (not shown in the figure), configured to perform a rollback operation on the database change method in response to the status information being in processing.
[0094] In some optional implementations of embodiments, the data processing unit 602 may include: a second matching subunit (not shown in the figure), a second target data identifier matching subunit (not shown in the figure), and a second data processing subunit (not shown in the figure). The second matching subunit is configured to, in response to the target data processing method being a database query method, match the database query method with the data processing method identifier in the cached data processing relationship table; the second target data identifier matching subunit is configured to, in response to a successful match, query the second target data identifier corresponding to the second target data processing method identifier that matches the database query method; and the second data processing subunit is configured to retrieve the second target data corresponding to the second target data identifier from the cache and perform data processing on the second target data according to the database query method.
[0095] In some optional implementations of the embodiments, the data processing unit 602 may include: a third data processing subunit (not shown in the figure), configured to query the second target data to be processed from the database and save the second target data to be processed to the cache in response to the absence of second target data to be processed corresponding to the second target data identifier in the cache.
[0096] In some optional implementations of the embodiments, the database includes dynamic pending data; the data processing unit 602 may include a dynamic pending data matching subunit (not shown in the figure) and a third matching subunit (not shown in the figure). The dynamic pending data matching subunit is configured to, in response to the database query method matching the dynamic pending data, query the target dynamic pending data corresponding to the database query method from the database and perform data processing on the target dynamic pending data; otherwise, query the second status information of the second target pending data corresponding to the database query method, the second status information including unprocessed or being processed; the third matching subunit is configured to, in response to the second status information being unprocessed, match the database query method with the data processing method identifier in the cached data processing relationship table; otherwise, query the second target pending data according to the data acquisition type of the second target pending data, the data acquisition type including cache query or database query.
[0097] In some optional implementations of the embodiments, the data processing unit 602 may include: a fourth matching subunit (not shown in the figure), configured to match the database query method with the data processing method identifier in the cached data processing relationship table in response to the data acquisition type being cached query; otherwise, to query the second target data to be processed corresponding to the database query method from the database.
[0098] In some optional implementations of embodiments, the third data processing subunit may include a secondary query module (not shown in the figure) and a data processing module (not shown in the figure). The secondary query module is configured to query the cache again to see if there is second target data to be processed corresponding to the database query method described above. The data processing module is configured to, in response to the existence of the data, process the second target data to be processed according to the database query method; otherwise, query the database for the second target data to be processed, import the second target data to be processed into the cache, and process the second target data to be processed.
[0099] It is understandable that the units described in the device 600 are related to the reference. Figure 3 The steps in the described method correspond accordingly. Therefore, the operations, features, and beneficial effects described above for the method also apply to the device 600 and the units contained therein, and will not be repeated here.
[0100] like Figure 7 As shown, the electronic device 700 may include a processing unit (e.g., a central processing unit, a graphics processor, etc.) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage device 708 into a random access memory (RAM) 703. The RAM 703 also stores various programs and data required for the operation of the electronic device 700. The processing unit 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0101] Typically, the following devices can be connected to I / O interface 705: input devices 706 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 707 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 708 including, for example, magnetic tapes, hard disks, etc.; and communication devices 709. Communication device 709 allows electronic device 700 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 7 An electronic device 700 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively. Figure 7 Each box shown can represent a device or multiple devices as needed.
[0102] In particular, according to some embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, some embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 709, or installed from storage device 708, or installed from ROM 702. When the computer program is executed by processing device 701, it performs the functions defined in the methods of some embodiments of this disclosure.
[0103] It should be noted that, in some embodiments of this disclosure, the computer-readable medium described above may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In some embodiments of this disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In some embodiments of this disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0104] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0105] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device. The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to: in response to application startup, generate a cached data processing relationship table corresponding to the application in a cache, the cached data processing relationship table containing data processing method identifiers of the application and data identifiers to be processed in the database corresponding to the application, wherein the data processing method identifiers and data identifiers to be processed have a corresponding relationship; and in response to detecting a target data processing method corresponding to the application, perform data processing on the data in the cache corresponding to the application based on the target data processing method and the cached data processing relationship table.
[0106] Computer program code for performing operations of some embodiments of this disclosure can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0107] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0108] The units described in some embodiments of this disclosure can be implemented in software or hardware. The described units can also be housed in a processor; for example, a processor may be described as including a cache data processing relation table generation unit and a data processing unit. The names of these units do not necessarily limit the unit itself; for example, the cache data processing relation table generation unit may also be described as "a unit that generates a cache data processing relation table in the cache."
[0109] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0110] The above description is merely a selection of preferred embodiments of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in the embodiments of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described inventive concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions disclosed in the embodiments of this disclosure.
Claims
1. A data processing method, comprising: In response to application startup, a cache data processing relationship table corresponding to the application is generated in the cache. The cache data processing relationship table contains the data processing method identifier of the application and the data identifier to be processed in the database of the application. The data processing method identifier and the data identifier to be processed have a corresponding relationship. In response to detecting a target data processing method corresponding to the application, data processing is performed on the data corresponding to the application in the cache based on the target data processing method and a cached data processing relationship table. This includes: in response to the target data processing method being a database modification method, matching the database modification method with a data processing method identifier in the cached data processing relationship table; when a first target data processing method identifier corresponding to a database modification method exists in the cached data processing relationship table, determining a first target pending data identifier corresponding to the first target data processing method identifier, finding the first target pending data in the cache; deleting the first target pending data in the cache corresponding to the first target data processing method identifier matching the database modification method, and performing data processing on the first target pending data in the database according to the database modification method.
2. The method according to claim 1, wherein, The step of generating a cache data processing relationship table corresponding to the application in the cache includes: Query the data processing method identifier of the application's data processing method and the data to be processed identifier of the corresponding data processing method; Based on the data processing method identifier and the data to be processed identifier, the cached data processing relationship table is generated in the cache.
3. The method according to claim 2, wherein, The data processing method includes data processing statements, each including a data processing method identifier, keywords, and a data identifier to be processed, wherein the keywords and the data identifier to be processed have a corresponding positional relationship; The query of the data processing method identifier of the application's data processing method and the data to be processed identifier of the corresponding data processing method includes: The data processing method identifier of the data processing statement is matched with a preset data processing method identifier table. The keywords of the data processing statement are matched by a preset keyword table, and the identifier of the data to be processed is determined based on the positional relationship of the keywords.
4. The method according to claim 3, wherein, The database modification method includes at least one of the following: data insertion, data deletion, and data update.
5. The method according to claim 4, wherein, Before matching the database change method with the data processing method identifier in the cached data processing relationship table in response to the target data processing method being a database change method, the following steps are included: The data processing statements corresponding to the database change method are parsed to determine the first target data to be processed; The database query method identifier corresponding to the first target data to be processed is determined from the cached data processing relationship table.
6. The method according to claim 5, wherein, The step of matching the database modification method with the data processing method identifier in the cached data processing relationship table includes: Query the first status information of the data to be processed corresponding to the database query method identifier to be matched, wherein the first status information includes unprocessed or being processed; In response to the first status information being unprocessed, the method identifier of the database to be matched is matched with the data processing method identifier in the cached data processing relationship table.
7. The method according to claim 6, wherein, The step of matching the database modification method with the data processing method identifier in the cached data processing relationship table includes: In response to the first status information being "processing", a rollback operation is performed on the database change method.
8. The method according to claim 1, wherein, The method for responding to the detection of a target data processing method corresponding to the application performs data processing on the data corresponding to the application in the cache based on the target data processing method and the cache data processing relationship table, including: In response to the target data processing method being a database query method, the database query method is matched with the data processing method identifier in the cached data processing relationship table; In response to a successful match, query the second target data identifier corresponding to the second target data processing method identifier that matches the database query method; The second target data to be processed is obtained from the cache corresponding to the second target data identifier, and the second target data to be processed is processed according to the database query method.
9. The method according to claim 8, wherein, The method for responding to the detection of a target data processing method corresponding to the application performs data processing on the data corresponding to the application in the cache based on the target data processing method and the cache data processing relationship table, including: In response to the absence of second target data corresponding to the second target data identifier in the cache, the second target data is queried from the database and saved to the cache.
10. The method according to claim 8, wherein, The database includes dynamic data to be processed, and; Before matching the database query method with the data processing method identifier in the cached data processing relationship table, the process includes: In response to a match between the database query method and the dynamic data to be processed, the system queries the database for the target dynamic data to be processed corresponding to the database query method and processes the target dynamic data to be processed. Otherwise, the system queries the second status information of the second target data to be processed corresponding to the database query method. The second status information includes unprocessed or being processed. In response to the second status information being unprocessed, the database query method is matched with the data processing method identifier in the cached data processing relationship table; otherwise, the second target data to be processed is queried according to the data acquisition type of the second target data to be processed, where the data acquisition type includes cache query or database query.
11. The method according to claim 10, wherein, Before matching the database query method with the data processing method identifier in the cached data processing relationship table, the process includes: In response to a data acquisition type of cached query, the database query method is matched with the data processing method identifier in the cached data processing relationship table; otherwise, the second target data to be processed corresponding to the database query method is queried from the database.
12. The method according to claim 10, wherein, The step of responding to the absence of second target data corresponding to the second target data identifier in the cache and querying the second target data from the database includes: Check again in the cache whether there is second target data to be processed corresponding to the database query method described above; In response to existence, the second target data to be processed is processed according to the database query method; otherwise, the second target data to be processed is queried from the database, imported into the cache, and processed.
13. A data processing apparatus, comprising: The cache data processing relationship table generation unit is configured to generate a cache data processing relationship table corresponding to the application in the cache in response to application startup. The cache data processing relationship table includes the data processing method identifier of the application and the data identifier to be processed in the database of the application. The data processing method identifier and the data identifier to be processed have a corresponding relationship. A data processing unit is configured to, in response to detecting a target data processing method corresponding to the application, perform data processing on data in the cache corresponding to the application based on the target data processing method and a cached data processing relationship table, including: in response to the target data processing method being a database modification method, matching the database modification method with a data processing method identifier in the cached data processing relationship table; when a first target data processing method identifier corresponding to a database modification method exists in the cached data processing relationship table, determining a first target pending data identifier corresponding to the first target data processing method identifier, finding the first target pending data in the cache; deleting the first target pending data in the cache corresponding to the first target data processing method identifier matching the database modification method, and performing data processing on the first target pending data in the database according to the database modification method.
14. An electronic device comprising: One or more processors; Storage device, on which one or more programs are stored, When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1 to 12.
15. A computer-readable medium having a computer program stored thereon, wherein, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 12.