Data query processing method and device, electronic equipment and storage medium
By retrieving and utilizing cached query data in the database and combining with the use of third-party data query interfaces, the problem of high data query processing costs is solved, and the effect of reducing data query processing costs while ensuring data query calls is achieved.
Patent Information
- Application Number
- CN202510219935.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-26
- Publication Date
- 2025-05-13
AI Technical Summary
In the current data query technology, frequent external system interface calls have led to significant cost control challenges. How to reduce data query processing costs while ensuring data query calls has become a research hotspot.
By obtaining the data query request, the pre-configured database is called to retrieve the cached query data that matches the request. If the matching data is found, the data is retrieved as the target query data; if it is not found, the third-party data query interface is called to query the required data, and the query results are cached to the database for later use.
It reduces the number of calls to third-party data query interfaces, reduces the costs caused by frequent interface calls, and effectively reduces the cost of data query processing.
Smart Images

Figure CN119988447A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data query technology, and in particular to a data query processing method, device, electronic equipment and storage medium. Background Art
[0002] In the current data query technology field, data query is increasingly dependent on interface calls with external systems. These external system interfaces are usually charged based on the number of calls, that is, each call to the interface will incur a corresponding fee. This billing model brings significant cost control challenges to business operators.
[0003] Therefore, finding a data query processing method that reduces the data query processing cost while effectively ensuring data query calls has become a current research hotspot. Summary of the invention
[0004] The present invention provides a data query processing method, device, electronic equipment and storage medium, which can reduce the data query processing cost under the premise of effectively ensuring data query calling.
[0005] The present invention provides a data query processing method, which comprises: obtaining a data query request, wherein the data query request comprises query information of target queried data; based on the data query request, calling a pre-configured database, and searching the database for target cached query data matching the data query request, wherein the database pre-caches a plurality of cached query data, and the cached query data is obtained by prior query based on a third-party data query interface; in response to searching the database for target cached query data matching the data query request, retrieving the target cached query data, and using the target cached query data as the target queried data; in response to not searching the database for target cached query data matching the data query request, calling a third-party data query interface, and searching the target queried data matching the data query request based on the third-party data query interface.
[0006] According to a data query processing method provided by the present invention, target cached query data matching the data query request is retrieved from the database, and the method is implemented in the following manner: based on the data query request, determining an application scenario corresponding to the data query request; converting the data query request into a target query statement matching the query statement format corresponding to the application scenario, wherein the query statement format corresponding to the application scenario is obtained by presetting; based on the target query statement, querying and retrieving the database in the form of a key-value pair search; in response to retrieving target cached query data matching the target query statement from the database, determining that target cached query data matching the data query request is retrieved from the database, wherein the target cached query data is pre-stored in the database in the form of a cache key in a key-value pair.
[0007] According to a data query processing method provided by the present invention, in response to the database not retrieving target cached query data that matches the data query request, calling a third-party data query interface, and querying the target queried data that matches the data query request based on the third-party data query interface, the method also includes: treating the target queried data as cached query data and caching it in the database, so that when the target queried data is queried again, it can be queried in the form of cached query data pre-cached in the database.
[0008] According to a data query processing method provided by the present invention, the target queried data is taken as cached query data and cached in the database, which is implemented in the following manner: based on a data query request, an application scenario of the target queried data is determined; based on the application scenario, the target queried data is divided into query data under multiple target information dimensions, wherein the target information dimension is used to characterize the application dimension of the target queried data in the application scenario; the query data under multiple target information dimensions is taken as the cached query data; a key-value pair is formed based on the cached query data and the data query request, and the cached query data is cached in the database in the form of a cache key in the key-value pair.
[0009] According to a data query processing method provided by the present invention, the data query request also includes query request initiation time information; the database also includes the cache validity period of the cached query data; in response to retrieving and querying the target cached query data matching the data query request in the database, retrieving the target cached query data, and using the target cached query data as the target queried data, specifically including: in response to retrieving and querying the target cached query data matching the data query request in the database, obtaining the target cache validity period of the target cached query data from the cache validity period of the cached query data; in response to determining that the target cached query data is non-expired data based on the target cache validity period and the query request initiation time information, retrieving the target cached query data, and using the target cached query data as the target queried data.
[0010] According to a data query processing method provided by the present invention, the method also includes: in response to determining that the target cached query data is expired data based on the target cache validity period and the query request initiation time information, according to whether a data refresh indication is received, querying to obtain the target queried data in accordance with a processing method corresponding to whether the data refresh indication is received, wherein the data refresh indication is initiated by a user.
[0011] According to a data query processing method provided by the present invention, the target queried data is queried in accordance with a processing method corresponding to whether the data refresh indication is received, specifically including: in response to receiving the data refresh indication, calling a third-party data query interface, and obtaining the target queried data matching the data query request based on the third-party data query interface; in response to not receiving the data refresh indication, retrieving the target cached query data, and using the target cached query data as the target queried data.
[0012] According to a data query processing method provided by the present invention, whether the data refresh indication is initiated by the user is determined in the following manner: in response to monitoring that an operational failure occurs in a third-party data query interface, determining that the data refresh indication is not initiated by the user; in response to monitoring that no operational failure occurs in the third-party data query interface, determining that the data refresh indication is initiated by the user.
[0013] The present invention also provides a data query processing device, which includes: an acquisition module, used to obtain a data query request, wherein the data query request includes query information of the target queried data; a calling module, used to call a pre-configured database based on the data query request, and retrieve and query the target cached query data matching the data query request in the database, wherein the database pre-caches a plurality of cached query data, and the cached query data is obtained by prior query based on a third-party data query interface; a first query module, used to retrieve the target cached query data in response to retrieving and querying the target cached query data matching the data query request in the database, and use the target cached query data as the target queried data; a second query module, used to call a third-party data query interface in response to not retrieving and querying the target cached query data matching the data query request in the database, and query the target queried data matching the data query request based on the third-party data query interface.
[0014] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, any of the above-mentioned data query processing methods is implemented.
[0015] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the data query processing method described in any one of the above is implemented.
[0016] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned data query processing methods.
[0017] The present invention provides a data query processing method, device, electronic device and storage medium, which obtains a data query request; based on the data query request, calls a pre-configured database, and searches the database for target cached query data that matches the data query request; in response to searching the database for target cached query data that matches the data query request, calls the target cached query data, and uses the target cached query data as target queried data; in response to not searching the database for target cached query data that matches the data query request, calls a third-party data query interface, and queries the target queried data that matches the data query request based on the third-party data query interface. By reducing the number of calls to the third-party data query interface, the data query processing cost can be reduced under the premise of effectively ensuring the data query call. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 It is a flow chart of the data query processing method provided by the present invention.
[0020] Figure 2 It is a flow chart of determining target cached query data matching a data query request found in a database search provided by the present invention.
[0021] Figure 3 It is a flow chart of the present invention for treating target queried data as cached query data and caching it in a database.
[0022] Figure 4 The present invention provides a flow chart of retrieving target cached query data and using the target cached query data as target queried data in response to searching a database for target cached query data that matches a data query request. Figure 5 It is a structural schematic diagram of the data query processing device provided by the present invention.
[0023] Figure 6 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] The data query processing method provided by the present invention can effectively reduce the costs incurred by frequent interface calls by reducing the reliance on external interfaces that are charged by the number of calls, thereby reducing the data query processing costs while effectively ensuring data query calls. It is understandable that the data query processing method provided by the present invention can be applied to the encapsulation service of the application system corresponding to the third-party data query interface.
[0026] Figure 1 It is a flow chart of the data query processing method provided by the present invention.
[0027] The following will be combined Figure 1 The process of the data query processing method provided by the present invention is described.
[0028] In an exemplary embodiment of the present invention, Figure 1 It can be seen that the data query processing method may include steps 110 to 140, and each step will be introduced below.
[0029] In step 110, a data query request is obtained, wherein the data query request includes query information of target queried data.
[0030] In one embodiment, a data query request may be obtained, wherein the data query request includes query information of the target queried data. In the application process, the data query request may be initiated by a user and used to query the target queried data. In one example, the data query request may be a request for querying the bank's three-factor verification result, and the corresponding target queried data may be the bank's three-factor verification result.
[0031] In step 120, based on the data query request, a pre-configured database is called, and the database is retrieved for target cached query data that matches the data query request, wherein the database pre-caches a plurality of cached query data, wherein the cached query data is obtained by a prior query based on a third-party data query interface.
[0032] In one embodiment, the database may be a MongoDB database, wherein the MongoDB database is a product between a relational database and a non-relational database, and is the most feature-rich and relational database among non-relational databases. The data structure it supports is very loose, and is a bson format similar to json, so it can store relatively complex data types. The biggest feature of Mongo is that the query language it supports is very powerful, and its syntax is somewhat similar to an object-oriented query language, which can almost realize most of the functions of a single-table query similar to a relational database, and also supports indexing of data. In this application document, for ease of explanation, the database will be described as a MongoDB database as an example.
[0033] In one embodiment, based on the data query request, a pre-configured MongoDB database may be called, and the target cached query data matching the data query request may be retrieved in the MongoDB database. The MongoDB database may have multiple cached query data pre-cached, wherein the cached query data is query data previously obtained based on a third-party data query interface query.
[0034] It is understandable that if the target cached query data is included in the multiple cached query data pre-cached in the MongoDB database, it means that the target cached query data has been previously queried through the third-party data query interface based on the data query request. In the application process, in order to avoid calling the third-party data query interface for each query, the queried target cached query data or cached query data can be pre-cached in the MongoDB database In step 130 , in response to searching the MongoDB database for target cached query data that matches the data query request, the target cached query data is retrieved and used as target queried data.
[0035] In another embodiment, if the target cached query data matching the data query request is retrieved in the MongoDB database, it means that the target queried data has been previously queried based on the third-party data query interface. In order to reduce the calls to the third-party data query interface, the target queried data is pre-stored in the MongoDB database as cached query data. Therefore, in the aforementioned scenario, the target cached query data can be directly retrieved and used as the target queried data. Through this embodiment, the data query processing cost is reduced by reducing the calls to the third-party data query interface while effectively ensuring the data query call.
[0036] In step 140 , in response to the MongoDB database not retrieving and querying the target cached query data that matches the data query request, a third-party data query interface is called, and the target queried data that matches the data query request is queried based on the third-party data query interface.
[0037] In another embodiment, if the MongoDB database does not retrieve the target cached query data that matches the data query request, it means that the target queried data has not been queried based on the third-party data query interface before, that is, this is the first time to query the target queried data. In this scenario, the MongoDB database does not store the target queried data, so it is necessary to call the third-party data query interface and query the target queried data that matches the data query request based on the third-party data query interface, so as to achieve effective query of the target queried data.
[0038] The present invention provides a data query processing method, which obtains a data query request; based on the data query request, calls a pre-configured database, and searches the database for target cached query data that matches the data query request; in response to searching the database for target cached query data that matches the data query request, calls the target cached query data, and uses the target cached query data as target queried data; in response to not searching the database for target cached query data that matches the data query request, calls a third-party data query interface, and queries the target queried data that matches the data query request based on the third-party data query interface. By reducing the number of calls to the third-party data query interface, the data query processing cost can be reduced under the premise of effectively ensuring the data query call.
[0039] Figure 2 It is a flow chart of determining target cached query data matching a data query request found in a database search provided by the present invention.
[0040] The process of determining target cached query data matching a data query request found in a database search provided by the present invention will be described below in conjunction with the following embodiments.
[0041] In another exemplary embodiment of the present invention, Figure 2 It can be known that determining whether target cached query data matching the data query request is found in a database search may include steps 210 to 240, and each step will be described below.
[0042] In step 210, based on the data query request, an application scenario corresponding to the data query request is determined.
[0043] In step 220, the data query request is converted into a target query statement that matches a query statement format corresponding to the application scenario, wherein the query statement format corresponding to the application scenario is obtained by presetting.
[0044] In step 230, based on the target query statement, a query is performed in the database in a key-value pair search format.
[0045] In step 240, in response to retrieving target cached query data matching the target query statement in the database, it is determined that target cached query data matching the data query request is retrieved in the database, wherein the target cached query data is pre-stored in the database in the form of a cache key in a key-value pair.
[0046] In one embodiment, an application scenario corresponding to the data query request can be determined based on the data query request. Further, the data query request is converted into a target query statement that matches the query statement format corresponding to the application scenario, wherein the query statement format corresponding to the application scenario can be obtained by presetting. It is understandable that different application scenarios corresponding to the data query request have different formats of target query statements. For example, for application scenarios that require user personal information, the format of the corresponding target query statement will be more rigorous, so that the query and retrieval can be accurately performed in the database based on the target query statement in the form of key-value pair search, so that the target cached query data that matches the data query request can be accurately obtained.
[0047] In one example, based on the target query statement, the query and retrieval can be performed quickly and accurately in the database in the form of a key-value pair search. During the application process, if the target cached query data matching the target query statement is retrieved in the database, it can be determined that the target cached query data matching the data query request is retrieved in the database, wherein the target cached query data is pre-stored in the database in the form of a cache key in the key-value pair.
[0048] In another exemplary embodiment of the present invention, continuing with the above Figure 1 Taking the above embodiment as an example, in response to the database not searching for target cached query data matching the data query request, calling a third-party data query interface, and querying the target queried data matching the data query request based on the third-party data query interface (corresponding to step 140), the data query processing method may further include the following steps: The target queried data is taken as cached query data and cached in the database, so that when the target queried data is queried again, it can be queried in the form of cached query data pre-cached in the database.
[0049] In one embodiment, after calling a third-party data query interface and querying the target queried data matching the data query request based on the third-party data query interface, in order to reduce the calls to the third-party data query interface when querying the target queried data again, the target queried data can be used as cached query data and cached in the MongoDB database, so that when the target queried data is queried again, it can be queried in the form of cached query data pre-cached in the MongoDB database. Thereby, the calls to the third-party data query interface can be reduced, and the data query processing cost can be reduced under the premise of effectively ensuring the data query call.
[0050] Figure 3It is a flow chart of the present invention for treating target queried data as cached query data and caching it in a database.
[0051] The following will be combined Figure 3 The process of taking the target queried data as cached query data and caching it in a database provided by the present invention is described.
[0052] In another exemplary embodiment of the present invention, Figure 3 It can be known that taking the target queried data as cached query data and caching it in the database may include steps 310 to 340, and each step will be described below.
[0053] In step 310, based on the data query request, an application scenario of the target queried data is determined.
[0054] In step 320, based on the application scenario, the target queried data is divided into query data under a plurality of target information dimensions, wherein the target information dimension is used to characterize the application dimension of the target queried data under the application scenario.
[0055] In step 330, the query data under the multiple target information dimensions are used as cached query data.
[0056] In step 340 , a key-value pair is formed based on the cached query data and the data query request, and the cached query data is cached to the database in the form of a cache key in the key-value pair.
[0057] In one embodiment, the application scenario of the target queried data can be determined based on the data query request; and based on the application scenario, the target queried data can be divided into query data under multiple target information dimensions, wherein the target information dimension can be used to characterize the application dimension of the target queried data under the application scenario. In one example, the target queried data is the result of the three-factor verification of the bank as an example for explanation. Based on the requirements in the application scenario of the result of the three-factor verification of the bank, that is, the application dimension, the result of the three-factor verification of the bank can be divided into query data under multiple target information dimensions about nkCardNo bank card, certName name, and ssn ID card. Further, the query data under multiple target information dimensions are used as cached query data; a key-value pair is formed based on the cached query data and the data query request, and the cached query data is cached to the MongoDB database in the form of a cache key in the key-value pair. This facilitates users to directly query the query data of the target queried data under multiple target information dimensions according to the application scenario.
[0058] Figure 4The present invention provides a flow chart of retrieving target cached query data and using the target cached query data as target queried data in response to searching a database for target cached query data that matches a data query request.
[0059] The following will be combined Figure 4 The present invention provides a process for retrieving target cached query data and using the target cached query data as target queried data in response to searching the database for target cached query data that matches the data query request. In an exemplary embodiment of the present invention, the data query request may also include query request initiation time information; the database may also include cache validity period of the cached query data; in combination with Figure 4 It can be seen that in response to searching the database for target cached query data that matches the data query request, retrieving the target cached query data and using the target cached query data as the target queried data may include steps 410 to 430, and each step will be introduced below.
[0060] In step 410, in response to finding target cached query data matching the data query request in a database search, a target cache validity period of the target cached query data is obtained from the cache validity period of the cached query data.
[0061] In step 420, in response to determining that the target cached query data is not expired data based on the target cache validity period and the query request initiation time information, the target cached query data is retrieved and used as the target queried data.
[0062] In step 430, in response to determining that the target cached query data is expired data based on the target cache validity period and the query request initiation time information, according to whether a data refresh indication is received, the target queried data is queried in accordance with the processing method corresponding to whether the data refresh indication is received, wherein the data refresh indication is initiated by the user.
[0063] In one embodiment, when the MongoDB database retrieves the target cached query data that matches the data query request, since the target queried data often has timeliness, the target cache validity period of the target cached query data can be further obtained from the cache validity period of the cached query data, and based on the target cache validity period and the query request initiation time information, it is determined whether the target cached query data is expired data. In one example, if the time range covered by the query request initiation time information + the target cache validity period covers the current time, it means that the target cached query data is not expired data. If the time range covered by the query request initiation time information + the target cache validity period does not cover the current time, it means that the target cached query data is expired data.
[0064] In one embodiment, when it is determined that the target cached query data is not expired data based on the target cache validity period and the query request initiation time information, it means that the target cached query data cached in the MongoDB database is available. Then, the target cached query data can be directly called and used as the target queried data.
[0065] In another embodiment, when it is determined that the target cached query data is expired data based on the target cache validity period and the query request initiation time information, it means that the target cached query data cached in the MongoDB database may not be available. Then, according to whether a data refresh indication is received, the target queried data can be queried according to the processing method corresponding to whether the data refresh indication is received, wherein the data refresh indication is initiated by the user.
[0066] In another exemplary embodiment of the present invention, continuing with the above Figure 4 The above embodiment is used as an example for explanation, wherein, according to whether a data refresh indication is received, the target queried data is queried in accordance with a processing method corresponding to whether the data refresh indication is received (corresponding to step 430), which can be implemented in the following manner: In response to receiving the data refresh instruction, calling the third-party data query interface, and querying and obtaining the target queried data matching the data query request based on the third-party data query interface; In response to not receiving the data refresh instruction, the target cached query data is retrieved and the target cached query data is used as the target queried data.
[0067] In one embodiment, when a data refresh indication is received, it indicates that the user indicates to re-acquire the target queried data, so a third-party data query interface can be called, and the target queried data matching the data query request can be obtained based on the third-party data query interface.
[0068] In yet another embodiment, when no data refresh instruction is received, it indicates that the user has not indicated to re-acquire the target queried data, and thus the target cached query data may be directly retrieved and used as the target queried data.
[0069] In another exemplary embodiment of the present invention, the above-mentioned embodiment is continued to be used as an example for description, wherein the data refresh indication can be determined as follows to determine whether it is initiated by the user: In response to monitoring that a third-party data query interface has an operational failure, determining that a data refresh instruction is not initiated by a user; In response to monitoring that no operational failure occurs in the third-party data query interface, it is determined that a data refresh instruction is initiated by a user.
[0070] In one embodiment, when a third-party data query interface is detected to have an operational failure, it indicates that the target queried data obtained based on the query of the third-party data query interface is also inaccurate under the current circumstances. Therefore, it can be determined that the data refresh instruction is not initiated by the user. During the application process, the target cached query data can be retrieved and used as the target queried data. In this scenario, although the target cached query data is expired, it can still be considered to be accurate data.
[0071] In another embodiment, when it is detected that the third-party data query interface has no operational failure, it means that the target queried data obtained based on the query of the third-party data query interface is accurate under the current situation, and therefore, it can be determined that the data refresh instruction is initiated by the user. During the application process, the third-party data query interface can be called, and the target queried data matching the data query request can be obtained based on the query of the third-party data query interface, so that the target queried data that is not expired and accurate can be obtained.
[0072] The data query processing method provided by the present invention effectively reduces the costs incurred by frequent interface calls by reducing the reliance on external interfaces that are charged by the number of calls. By caching the data returned by the external interface, unnecessary repeated requests are avoided, thereby saving costs, and the user is allowed to flexibly configure the cache key and cache time (corresponding to the cache validity period) as needed, so that the cache strategy can be customized for different data and usage scenarios to optimize performance and cost.
[0073] In order to further introduce the data query processing method provided by the present invention, it will be described in conjunction with the following embodiments.
[0074] In one embodiment of the present invention, querying the bank's three-factor verification result is taken as an example for explanation.
[0075] During the application process, the business system can also initiate a three-factor bank card verification request when the user (corresponding to the query request in the previous article), with the parameters of "bankCardNo bank card, certName name, ssn ID card, refresh whether to refresh", and the remoteUser business party is specified in the header. After the corresponding Controller (corresponding to the Controller of the encapsulated service in the previous article) receives the request, it can load the pudao.conf file according to the configKey specified by the controller to obtain a set of configuration information for the interface. The core configurations are: table (storing data returned by third-party queries), conditions (cache condition combinations), resultReform (return data converter), extRequest (configuration of third-party interface request information).
[0076] Furthermore, you can use the table attribute in the interface configuration information loaded above as the query condition tableName to load the corresponding record in the cache configuration table (dc.config.DBCacheConfigEntity) to obtain the cache days (which can correspond to the cache validity period mentioned above). The cache configuration table can be considered as a storage table in MongoDB data that stores the cache validity period of cached query data.
[0077] During the application process, the conditions attribute in the interface configuration information can be used as the cache condition key (ssn|certName|bankCardNo) to convert it into a query condition of MongoDB to query the interface business table, where the interface business table stores cached query data. If there is no data in the query table (the target cached query data that matches the corresponding data query request), the third-party interface is directly called, and the data returned by the third-party interface is saved in a document record in the MongoDB table. The record fields include _id, _class (storage type Map / Bo), result (third-party interface result), code (interface response code), seqNo (request number), bankCardNo, certName, ssn, remoteUser, createTime, updateTime (wherein the bankCardNo, certName, and ssn fields are determined according to the conditions attribute value in the interface configuration information to determine which business fields the mongo business table has), and the business system result data is returned. That is, the target queried data is cached in the MongoDB database, so that the target queried data can be obtained by querying the MongoDB database when it is queried again.
[0078] In another embodiment, if there is data in the query table (the target cached query data that matches the corresponding data query request), the records configured in the DBCacheConfigEntity configuration table can be obtained. The core fields of the records are: remoteUser (business party), days (cache days), and tableName (table name). Add the cache days to the creation time of the data that meets the conditions in the table and compare it with the current time, i.e., updateTime + days < now(). If it has expired, judge the refresh value passed as a parameter. If it is true and needs to be refreshed, request the third-party interface and update the result and updatetime values of the records queried in the Mongo table dc.pudao.BankcardThreeFactorAuthCheck. If it is false and does not need to be refreshed, return the result of the records queried in the table to the business system. In this embodiment, when it is found that the data returned by the third party is incorrect, set it not to be refreshed in a timely manner to prevent a large amount of data from being incorrect and affecting normal operations. Otherwise, it needs to be refreshed.
[0079] In another embodiment, if the data has not expired, the result of the records in the dc.pudao.BankcardThreeFactorAuthCheck table can be directly returned to the business system.
[0080] As can be seen from the foregoing description, a data query processing method provided by the present invention includes: obtaining a data query request; based on the data query request, calling a pre-configured database and retrieving cached query data of a target that matches the data query request in the database; in response to retrieving cached query data of a target that matches the data query request in the database, retrieving the cached query data of the target and using the cached query data of the target as the target query data; in response to not retrieving cached query data of a target that matches the data query request in the database, calling a third-party data query interface and querying target query data that matches the data query request based on the third-party data query interface. By reducing the number of calls to the third-party data query interface, the data query processing cost can be reduced while effectively ensuring data query calls.
[0081] The data query processing device provided by the present invention will be described below. The data query processing device described below can be correspondingly referred to the data query processing method described above.
[0082] Figure 5 It is a schematic structural diagram of the data query processing device provided by the present invention.
[0083] The following will be combined with Figure 5The structure of the data query processing device provided by the present invention is described.
[0084] In an exemplary embodiment of the present invention, Figure 5 It can be known that the data query processing device may include an acquisition module 510, a calling module 520, a first query module 530, and a second query module 540, and each module will be introduced below.
[0085] The acquisition module 510 may be configured to acquire a data query request, wherein the data query request includes query information of target queried data; The calling module 520 may be configured to call a pre-configured database based on the data query request, and retrieve the target cached query data matching the data query request from the database, wherein the database pre-caches a plurality of cached query data, and the cached query data is obtained by previously querying based on a third-party data query interface; The first query module 530 may be configured to retrieve the target cached query data matching the data query request in response to searching the database, and use the target cached query data as the target queried data; The second query module 540 may be configured to call a third-party data query interface in response to failure to retrieve target cached query data matching the data query request in the database, and query the target queried data matching the data query request based on the third-party data query interface.
[0086] In an exemplary embodiment of the present invention, the first query module 530 may implement searching the database for target cached query data that matches the data query request in the following manner: Based on the data query request, determining an application scenario corresponding to the data query request; Converting the data query request into a target query statement that matches a query statement format corresponding to the application scenario, wherein the query statement format corresponding to the application scenario is obtained by presetting; Based on the target query statement, query and retrieve in the database in a key-value pair search form; In response to searching and retrieving target cached query data matching the target query statement in the database, it is determined that target cached query data matching the data query request is searched and retrieved in the database, wherein the target cached query data is pre-stored in the database in the form of a cache key in a key-value pair.
[0087] In an exemplary embodiment of the present invention, the second query module 540 may also be configured to: The target queried data is used as cached query data and cached in the database, so that when the target queried data is queried again, it can be queried in the form of cached query data pre-cached in the database.
[0088] In an exemplary embodiment of the present invention, the second query module 540 may also use the following method to implement the target queried data as cached query data and cache it in the database: Based on the data query request, determining an application scenario of the target queried data; Based on the application scenario, the target queried data is divided into query data under a plurality of target information dimensions, wherein the target information dimensions are used to characterize the application dimensions of the target queried data under the application scenario; Using the query data under the multiple target information dimensions as the cached query data; A key-value pair is formed based on the cached query data and the data query request, and the cached query data is cached in the database in the form of a cache key in the key-value pair.
[0089] In an exemplary embodiment of the present invention, the data query request further includes query request initiation time information; the database further includes a cache validity period of the cached query data; The first query module 530 can be implemented in the following manners to retrieve the target cached query data matching the data query request in the database, retrieve the target cached query data, and use the target cached query data as the target queried data: In response to searching the database for target cached query data matching the data query request, obtaining a target cache validity period of the target cached query data from the cache validity period of the cached query data; In response to determining that the target cached query data is not expired data based on the target cache validity period and the query request initiation time information, the target cached query data is retrieved and used as the target queried data.
[0090] In an exemplary embodiment of the present invention, the first query module 530 may also be configured to: In response to determining that the target cached query data is expired data based on the target cache validity period and the query request initiation time information, according to whether a data refresh indication is received, the target queried data is queried in accordance with a processing method corresponding to whether the data refresh indication is received, wherein the data refresh indication is initiated by a user.
[0091] In an exemplary embodiment of the present invention, the first query module 530 may also adopt the following method to query and obtain the target queried data according to whether a data refresh indication is received and a processing method corresponding to whether the data refresh indication is received: In response to receiving the data refresh instruction, calling a third-party data query interface, and querying based on the third-party data query interface to obtain the target queried data that matches the data query request; In response to not receiving the data refresh indication, the target cached query data is retrieved, and the target cached query data is used as the target queried data.
[0092] In an exemplary embodiment of the present invention, the first query module 530 may also use the following method to determine whether the data refresh instruction is initiated by the user: In response to monitoring that a third-party data query interface has an operational failure, determining that the data refresh instruction is not initiated by a user; In response to monitoring that no operation failure occurs in the third-party data query interface, it is determined that the data refresh instruction is initiated by the user.
[0093] Figure 6 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 6As shown, the electronic device may include: a processor (processor) 610 , a communication interface (Communications Interface) 620 , a memory (memory) 630 and a communication bus 640 , wherein the processor 610 , the communication interface 620 , and the memory 630 communicate with each other through the communication bus 640 . The processor 610 can call the logic instructions in the memory 630 to execute the data query processing method, which includes: obtaining a data query request, wherein the data query request includes query information of the target queried data; based on the data query request, calling a pre-configured database, and retrieving and querying the target cached query data matching the data query request in the database, wherein the database pre-caches a plurality of cached query data, wherein the cached query data is obtained by prior query based on a third-party data query interface; in response to retrieving and querying the target cached query data matching the data query request in the database, retrieving the target cached query data, and using the target cached query data as the target queried data; in response to not retrieving and querying the target cached query data matching the data query request in the database, calling the third-party data query interface, and querying the target queried data matching the data query request based on the third-party data query interface.
[0094] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0095] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the data query processing method provided by the above methods, which method includes: obtaining a data query request, wherein the data query request includes query information of the target queried data; based on the data query request, calling a pre-configured database, and searching the database for target cached query data that matches the data query request, wherein the database pre-caches a plurality of cached query data, wherein the cached query data is obtained by prior query based on a third-party data query interface; in response to searching the database for target cached query data that matches the data query request, retrieving the target cached query data, and using the target cached query data as the target queried data; in response to not searching the database for target cached query data that matches the data query request, calling a third-party data query interface, and searching the third-party data query interface for the target queried data that matches the data query request.
[0096] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the data query processing method provided by the above-mentioned methods, the method comprising: obtaining a data query request, wherein the data query request includes query information of the target queried data; based on the data query request, calling a pre-configured database, and retrieving and querying the database for target cached query data matching the data query request, wherein the database pre-caches a plurality of cached query data, wherein the cached query data is obtained by prior query based on a third-party data query interface; in response to retrieving and querying the database for target cached query data matching the data query request, retrieving the target cached query data, and using the target cached query data as the target queried data; in response to not retrieving and querying the database for target cached query data matching the data query request, calling a third-party data query interface, and querying the target queried data matching the data query request based on the third-party data query interface.
[0097] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0098] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0099] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data query processing method, characterized in that: The method comprises: Obtaining a data query request, wherein the data query request includes query information of target queried data; Based on the data query request, calling a pre-configured database, and searching the database for target cached query data that matches the data query request, wherein the database pre-caches a plurality of cached query data, and the cached query data is obtained by previously querying based on a third-party data query interface; In response to searching the database for target cached query data matching the data query request, retrieving the target cached query data and using the target cached query data as the target queried data; In response to the database not being searched for target cached query data matching the data query request, a third-party data query interface is called, and the target queried data matching the data query request is queried based on the third-party data query interface.
2. The data query processing method according to claim 1, characterized in that: The target cached query data matching the data query request is retrieved from the database, and the query is implemented in the following manner: Based on the data query request, determining an application scenario corresponding to the data query request; Converting the data query request into a target query statement that matches a query statement format corresponding to the application scenario, wherein the query statement format corresponding to the application scenario is obtained by presetting; Based on the target query statement, query and retrieve in the database in a key-value pair search form; In response to searching and retrieving target cached query data matching the target query statement in the database, it is determined that target cached query data matching the data query request is searched and retrieved in the database, wherein the target cached query data is pre-stored in the database in the form of a cache key in a key-value pair.
3. The data query processing method according to claim 1, characterized in that: In response to the database not searching for target cached query data matching the data query request, calling a third-party data query interface, and querying the target queried data matching the data query request based on the third-party data query interface, the method further includes: The target queried data is used as cached query data and cached in the database, so that when the target queried data is queried again, it can be queried in the form of cached query data pre-cached in the database.
4. The data query processing method according to claim 3, characterized in that: The target queried data is used as cached query data and cached in the database, which is implemented in the following manner: Based on the data query request, determining an application scenario of the target queried data; Based on the application scenario, the target queried data is divided into query data under a plurality of target information dimensions, wherein the target information dimensions are used to characterize the application dimensions of the target queried data under the application scenario; Using the query data under the multiple target information dimensions as the cached query data; A key-value pair is formed based on the cached query data and the data query request, and the cached query data is cached in the database in the form of a cache key in the key-value pair.
5. The data query processing method according to claim 1, characterized in that: The data query request also includes query request initiation time information; the database also includes the cache validity period of the cached query data; In response to searching the database for target cached query data matching the data query request, retrieving the target cached query data and using the target cached query data as the target queried data specifically includes: In response to searching the database for target cached query data matching the data query request, obtaining a target cache validity period of the target cached query data from the cache validity period of the cached query data; In response to determining that the target cached query data is not expired data based on the target cache validity period and the query request initiation time information, the target cached query data is retrieved and used as the target queried data.
6. The data query processing method according to claim 5, characterized in that: The method further comprises: In response to determining that the target cached query data is expired data based on the target cache validity period and the query request initiation time information, according to whether a data refresh indication is received, the target queried data is queried in accordance with a processing method corresponding to whether the data refresh indication is received, wherein the data refresh indication is initiated by a user.
7. The data query processing method according to claim 6, characterized in that: The querying and obtaining the target queried data according to whether the data refresh indication is received and the processing method corresponding to whether the data refresh indication is received specifically includes: In response to receiving the data refresh instruction, calling a third-party data query interface, and querying based on the third-party data query interface to obtain the target queried data that matches the data query request; In response to not receiving the data refresh indication, the target cached query data is retrieved and the target cached query data is used as the target queried data.
8. The data query processing method according to claim 6, characterized in that: The data refresh instruction is determined to be initiated by the user in the following manner: In response to monitoring that a third-party data query interface has an operational failure, determining that the data refresh instruction is not initiated by a user; In response to monitoring that no operation failure occurs in the third-party data query interface, it is determined that the data refresh instruction is initiated by the user.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the data query processing method according to any one of claims 1 to 8 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the data query processing method according to any one of claims 1 to 8 is implemented.