CN113420051B - Data query method and device, electronic equipment and storage medium - Google Patents
Data query method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113420051B CN113420051B CN202110739088.9A CN202110739088A CN113420051B CN 113420051 B CN113420051 B CN 113420051B CN 202110739088 A CN202110739088 A CN 202110739088A CN 113420051 B CN113420051 B CN 113420051B
- Authority
- CN
- China
- Prior art keywords
- data query
- service
- target
- data
- cache
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
- G06F16/24552—Database cache management
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the invention discloses a data query method, a data query device, electronic equipment and a storage medium; the embodiment of the invention can receive a service data query request, wherein the service data query request comprises a target service identifier, determines target service data query information corresponding to the target service identifier based on the target service identifier in the service data query request and the corresponding relation between the preset service identifier and service data query information, acquires data storage information from the target service data query information, and acquires target service data from a storage position indicated by the data storage information based on the data storage information; therefore, when the related information of the data query is required to be modified, the data query information can be modified at any time under the condition that the normal connection of front-end software and back-end software is not affected.
Description
Technical Field
The present invention relates to the field of data query technologies, and in particular, to a data query method, a data query device, an electronic device, and a storage medium.
Background
Big data evolves well, the underlying offline data may be on the beat-to-byte level, and the actual presentation to the user may be just a small amount of summary data obtained from the underlying offline data, which is often referred to repeatedly by the same user or users. The special summarized data are cached, so that the consumption of the same amount of computing resources during each data query can be avoided, and the time consumption for searching the data in the massive data is greatly reduced.
At present, when the front-end software and the back-end software are coordinated to work together, the front-end software and the back-end software are often connected by using a service connection module, and once the capacity of a data storage is required to be expanded or a data storage strategy such as a cache position is required to be changed, the data storage strategy is required to be modified after the position of the data storage strategy is positioned in the service connection module, and the data service of the service connection module is required to be restarted to apply a new cache strategy.
Disclosure of Invention
The embodiment of the invention provides a data query method, a data query device, electronic equipment and a storage medium, which can modify data query information at any time under the condition that normal connection of front-end software and back-end software is not affected.
The embodiment of the invention provides a data query method, which comprises the following steps:
receiving a service data query request, wherein the service data query request comprises a target service identifier;
determining target service data query information corresponding to the target service identification based on the target service identification in the service data query request and a corresponding relation between a preset service identification and service data query information;
acquiring data storage information from the target service data query information, wherein the data storage information indicates a storage position of target service data corresponding to the target service identifier;
And acquiring the target service data from a storage position indicated by the data storage information based on the data storage information.
Correspondingly, the embodiment of the invention also provides a data query device, which is suitable for a service connection module of a data query system, wherein the data query system also comprises service data query information corresponding to the service connection module, and the device comprises:
a request receiving unit, configured to receive a service data query request, where the service data query request includes a target service identifier;
the query information determining unit is used for determining target service data query information corresponding to the target service identifier based on the target service identifier in the service data query request and a corresponding relation between a preset service identifier and service data query information;
a storage information obtaining unit, configured to obtain data storage information from the target service data query information, where the data storage information indicates a storage location of target service data corresponding to the target service identifier;
and the data acquisition unit is used for acquiring the target service data from the storage position indicated by the data storage information based on the data storage information.
In an optional example, the target service data query information includes target cache data query information, the target cache data query information indicating a cache address of the target service data;
the storage information acquisition unit is used for acquiring the target cache data query information from the target service data query information;
the data acquisition unit is configured to access, based on the target cache data query information, a cache address of target service data indicated by the target cache data query information, to obtain the target service data corresponding to the service data query request.
In an optional example, the target service data query information further includes a service source data query statement, the service source data query statement indicating a source database storing the target service data;
the data query device further comprises a source data acquisition unit, a target data query unit and a data query unit, wherein the source data acquisition unit is used for acquiring the service source data query statement from the target service data query information if the acquisition of the target service data based on the target cache data query information fails;
and calling the service source data query statement to acquire the target service data from the source database.
In an optional example, the source data obtaining unit further includes a data caching unit, configured to store, based on the target cache data query information, the target service data to a cache address of the target service data indicated by the target cache data query information.
In an optional example, the data query device further includes a data update unit, configured to invoke a service source data query statement corresponding to each service when a cached data update time arrives, and acquire first service data of each service from a source database of each service;
based on the cache data query information of each service, accessing a cache address indicated by the cache data query information, and acquiring second service data of each service from the cache address;
and comparing the first service data and the second service data of the same service, and if the first service data and the second service data are inconsistent, updating the second service data of the same service based on the first service data.
In an optional example, the data obtaining unit is configured to determine, based on the target cache data query information, a cache address of the target service data, where the cache address caches service data corresponding to at least one service;
And accessing the cache address of the target service data, and inquiring the service data corresponding to the target service identifier in the data stored in the cache address according to the corresponding relation between the preset service identifier and the service data to serve as the target service data.
In an optional example, the target cache data query information includes a cache address identifier;
the data acquisition unit is used for acquiring the cache address identification from the target cache data query information;
determining the cache address of the target service data according to the corresponding relation between the preset cache address identifier and the cache address;
accessing the cache address, and acquiring the target service data corresponding to the service data query request from the data stored in the cache address.
In an optional example, the target cache data query information further includes a cache validity duration;
the data acquisition unit is used for acquiring the cache effective duration of the service data indicated by the target cache data query information from the target cache data query information;
determining the storage time length of the business data in the cache address based on the cache address indicated by the target cache data query information;
And if the storage duration is not longer than the cache effective duration, accessing a cache address indicated by the target cache data query information to obtain the target service data corresponding to the target service data query request.
Correspondingly, the embodiment of the invention also provides electronic equipment, which comprises a memory and a processor; the memory stores an application program, and the processor is configured to run the application program in the memory, so as to execute steps in any one of the data query methods provided by the embodiments of the present invention.
In addition, the embodiment of the invention also provides a storage medium, which stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor to execute the steps in any one of the data query methods provided by the embodiment of the invention.
By adopting the scheme of the embodiment of the invention, the service data query request can be received, the service data query request comprises a target service identifier, the target service data query information corresponding to the target service identifier is determined based on the target service identifier in the service data query request and the corresponding relation between the preset service identifier and the service data query information, the data storage information is obtained from the target service data query information, the data storage information indicates the storage position of the target service data corresponding to the target service identifier, and the target service data is obtained from the storage position indicated by the data storage information based on the data storage information; the embodiment of the invention does not directly store the data query information in the service connection module of the front-end software and the back-end software, so that when the related information example of the data query is required to be modified, only the information in the data query information is required to be correspondingly modified, and the data query information can be modified at any time by an developer under the condition that the normal connection of the front-end software and the back-end software is not influenced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic view of a scenario of a data query method provided by an embodiment of the present invention;
FIG. 2 is a flowchart of a data query method provided by an embodiment of the present invention;
fig. 3 is a schematic flow chart of acquiring target service data from a cache address by using middleware according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a process of obtaining target business data from a source database by middleware according to an embodiment of the present invention;
fig. 5 is a schematic flow chart of storing target service data to a cache address of target service data indicated by target cache data query information by middleware according to an embodiment of the present invention;
FIG. 6 is another flow chart of a data query method according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a data query device according to an embodiment of the present invention;
FIG. 8 is another schematic diagram of a data query device according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to fall within the scope of the invention.
The embodiment of the invention provides a data query method, a data query device, electronic equipment and a storage medium. Specifically, the embodiment of the invention provides a data query method suitable for a data query device, and the data query device can be integrated in electronic equipment.
The electronic device may be a terminal or the like, including but not limited to a mobile terminal and a fixed terminal, for example, a mobile terminal including but not limited to a smart phone, a smart watch, a tablet computer, a notebook computer, a smart car, etc., wherein the fixed terminal includes but not limited to a desktop computer, a smart television, etc.
The electronic device may be a server, which may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligence platforms, but is not limited thereto.
The data query method of the embodiment of the invention can be realized by a server or a terminal and the server together.
The method for querying data is described below by taking a method that a terminal and a server jointly implement the method for querying data as an example.
As shown in fig. 1, the data query system provided in the embodiment of the present invention includes a terminal 10, a server 20, and the like; the terminal 10 and the server 20 are connected through a network, for example, a wired or wireless network connection, wherein the terminal 10 may exist as a terminal for a user to send a service data query request to the server 20.
The service connection module may be disposed on the server 20, where the server 20 may be configured to receive a service data query request, the service data query request includes a target service identifier, determine target service data query information corresponding to the target service identifier based on the target service identifier in the service data query request and a corresponding relationship between a preset service identifier and service data query information, obtain data storage information from the target service data query information, where the data storage information indicates a storage location of target service data corresponding to the target service identifier, and obtain the target service data from the storage location indicated by the data storage information based on the data storage information.
The following will describe in detail. The following description of the embodiments is not intended to limit the preferred embodiments.
The embodiments of the present invention will be described in terms of a data querying device, which may be integrated in a server or terminal in particular.
The service connection module can realize the connection function of service and data, namely, data is provided for specific service according to the service data query request.
As shown in fig. 2, the specific flow of the data query method in this embodiment may be as follows:
201. and receiving a service data query request, wherein the service data query request comprises the target service identifier.
The data query method of the embodiment of the invention can be applied to a service connection module of a data query system, and the data query system can also comprise service data query information corresponding to the service connection module.
Wherein, the business refers to a certain service provided by a service provider for a service user through information exchange according to a certain common service target.
Wherein the service data refers to information exchanged between the service provider and the service user.
For example, in the case of providing financial services, the business may be payment, deposit, etc., and the business data may be some or all of the data that needs to be provided to the service user during the payment, deposit, etc. For another example, in providing the game data analysis service, the service may be analysis of data of different games, etc., and the service data may be a user pay rate, a user's next day retention rate, etc.
In some examples, the business data query request may be a user request for a different business initiated query for a certain set of data, e.g., the user may choose to query: service data such as the number of active users (Daily Active User, DAU), average simultaneous online player count (Average concurrent users, ACU), and related data of a certain user.
In other examples, the business data query request may not be initiated by the user, but rather automatically initiated by a technician pre-set according to different business scenarios. For example, in a game scenario, a technician may set up to update relevant data of a user at intervals for an online user, e.g., the user is online for 3 minutes, automatically triggering a terminal to generate a service query request for the relevant data of the user. Or, the user may automatically send a service query request of the user related data each time the user logs in the account, etc.
The service data query request may carry a service identifier, where the service identifier may indicate which data, which type, or which range of data the service data request is for querying, for example, may indicate that the DAU data of a certain day is queried, or that the click data of a certain user or users is queried, etc.
In some alternative examples, the service identifier may be a specific service name, such as a DAU query, an ACU query, or the like, or may be a service identifier corresponding to a different service, where the service identifier may indicate a different service, such as a service identifier that may be set to 1 as the DAU query service, or the like. The form and content of the service identifier are not limited, and the invention is not limited thereto.
202. And determining target service data query information corresponding to the target service identifier based on the target service identifier in the service data query request and the corresponding relation between the preset service identifier and the service data query information.
The service data query information may include relevant information of service data query such as data storage information of a corresponding specific service, for example, the service data query information may indicate a preferential query position of service data, a number of attempts to query a certain group of service data, and so on.
The target service data query information is service data query information corresponding to a service identifier in the service data query request.
In some examples, as shown in fig. 3, the business connection module may be middleware that connects application software that generates business data query requests with software components that provide targeted business data. In one example of some examples, a correspondence between the preset service identifier and the service data query information is set in the middleware.
Middleware is a type of computer software that connects software components to applications, or, alternatively, can be thought of as being interposed between an application system and system software. The system uses basic services (functions) provided by system software to connect various parts of an application system or different applications on a network, so that a plurality of software running on one or more machines can interact through the network, and the purposes of resource sharing and function sharing can be achieved.
In some alternative examples, one service may correspond to only one service connection module, or multiple services may correspond to only one service connection module, or different data query requests for one service may be rooted to multiple service connection modules, and so on. The technician can set the corresponding relation between the service and the service connection module according to the actual use condition, and the embodiment of the invention is not limited to the setting.
For example, when the service is the next-day retention rate data of the user providing the certain application program, the service data is the next-day retention rate data of the user of the certain application program, the service may correspond to one middleware (service connection module), or the service may send a data query request for obtaining the first-day new user data and a data query request for obtaining the second-day login data of the new user to two different middleware respectively, and so on.
203. And acquiring data storage information from the target service data query information, wherein the data storage information indicates the storage position of the target service data corresponding to the target service identifier.
The target service data is service data obtained by inquiring in the service data based on the service data inquiring request. It will be appreciated that the target service data may not be the service data actually requested by the service data query request in some cases, due to the stored service data not being updated in time, etc.
It can be understood that the service connection module may receive many service data query requests at the same time, and in a high concurrency situation, if a database is used for data query, the query speed is slower, and the query speed is generally faster when directly querying the data in the cache, so that the service data can be stored in the cache, and the query speed is improved. Thus, the target service data query information may include target cache data query information, which may indicate a cache address of the target service data, and the step of "obtaining data storage information from the target service data query information" may include:
And acquiring target cache data query information from the target service data query information.
Accordingly, step 204 may include: based on the target cache data query information, accessing the cache address of the target service data indicated by the target cache data query information to obtain target service data corresponding to the service data query request.
The target cache data query information is cache data query information corresponding to the service data query request. The cache data query information may include information capable of indicating a cache location of the service data, such as a specific storage address of the service data or an identifier corresponding to the storage address of the service data.
In some examples, the service data query information may be in the form of a file, the cache data query information may be a sub-file of the service data query information, or the cache data query information may be directly used as the service data query information.
In other examples, the business data query information may be in the form of program code, and the cache data query information may be a part of the code, or may be information written in the business data query information in the form of comments.
For example, the business data query information may be in the form of a static structured query language (Structured Query Language, SQL) file, in which statements for querying, managing, etc. the database may be included, and in which cached data query information written in the static SQL file in the form of annotations may be included.
Where static SQL statements are typically used in embedded SQL applications, the SQL statements must be deterministic prior to program execution, e.g., column names and table names involved in the SQL statements must be present.
In some examples, the business data query information may also be in the form of a dynamic SQL file, which is not limited by embodiments of the invention.
In the practical application process, identification information or keywords can be set for the cache data query information, and when the cache data query information needs to be obtained from the target service data query information, the service connection module can determine that the read information is the cache data query information according to the identification and/or keywords of the cache data query information.
For example, when the cache data query information is a subfile of the service data query information (cache data query file), a specific symbol may be set in the name of the cache data query file as an identification, for example, the name of the cache data query file may be set to "cache_mysql" including the identifier "cache", or the like.
For another example, when the cached data query information is written in the form of comments in the program code representing the service data query information, the cached data query information may be "// cache: mysql", where "//" indicates that the content after double-slash is the comment information, "cache" is an identifier of the cached data query information, and "mysql" represents that the database in which the target service data is cached is mysql.
It will be appreciated that the annotation itself is a common part of the programming statement, typically used to describe a part of the programming file that is not executed, adding additional reading information. The function of the cache policy to write among annotations is not inconsistent with the function provided by annotations in a general sense. Other notes in general may be kept for other functions such as indicating the time the file was written, the author of the file, or what a technician wants to keep in a static SQL file (business data query information), etc.
For example, the following 3 rows are all beginning with the annotation symbol #:
#cache:mysql
# the document was written in month 4 of 2021
#author:xxx
Because the first line has a cache identifier, the second line and the third line have no cache identifier, when the middleware (service connection module) reads the three lines of contents, the middleware can confirm that the contents of the first line are cache data query information based on the identifiers, and the second line and the third line are common annotation contents.
It will be appreciated that the above examples are illustrative of cached data query information and should not be construed as limiting the cached data query information. The embodiment of the invention does not limit the content and the form of the cached data query information, and a technician can set the identifier, the format and the like of the cached data query information according to actual use.
When the service connection module reads the cache data query information, the service connection module can determine the actual value of the variable according to the storage address of the target service data indicated by the cache data query information, thereby realizing access to the storage address of the target service data.
Alternatively, the cache data query information may be in the form of program code, and after the service connection module determines the cache data query information, the code of the cache data query information may be run to access the storage address of the target service data indicated by the cache data query information. That is, the step of "accessing, based on the cached data query information, the cached address of the service data indicated by the cached data query information to obtain the target service data corresponding to the service data query request" may include:
acquiring the target service data query information;
based on a preset cache data query code identifier, obtaining a cache data query code from the target service data query information;
Running the cache data query code, and accessing a cache address of service data indicated by the cache data query information;
and acquiring the target service data corresponding to the service data query request from the cache address of the service data indicated by the cache data query information.
For example, the corresponding annotation extraction tool may be selected according to the code language to obtain the cached data query annotated in the target service data query. For example, if the code language is java, the comments in the java code may be extracted by the java doc tool.
It can be understood that, in order to improve the utilization ratio of the storage space, multiple groups of service data corresponding to different services may be stored in the same cache address, so that the corresponding relationship between the service identifier and the service data may be preset, and when the cache address is accessed, the service data to be actually acquired may be determined according to the corresponding relationship between the service identifier and the service data. That is, the step of accessing the cache address of the target service data indicated by the target cache data query information based on the target cache data query information to obtain the target service data corresponding to the service data query request may include:
Determining a cache address of target service data based on target cache data query information, wherein the cache address caches service data corresponding to at least one service;
accessing a cache address of target service data, and inquiring service data corresponding to the target service identification in the data stored in the cache address according to the corresponding relation between the preset service identification and the service data to serve as the target service data.
The preset corresponding relation between the service identifier and the service data can be set in the service connection module or written in the service data query information.
In some embodiments, the cache address of the target service data may be written directly in the cache data query information, for example, the cache data query information may be #cache: redis { "ip": "10.Xxx. Yyy", port:1111}, where# is a comment symbol in the program code, the cache is an identifier of the cache data query information, "ip": "10.Xxx. Yy" indicates the cache address of the target service data, and port:1111 is a specific communication port.
In other embodiments, the corresponding relationship between the cache address identifier and the cache address may be preset in the service connection module, and when the cache address identifier in the cache data query information is read, the corresponding cache address may be determined. Namely, the target cache data query information comprises a cache address identifier;
Correspondingly, the step of accessing the cache address of the target service data indicated by the target cache data query information based on the target cache data query information to obtain the target service data corresponding to the service data query request may include:
obtaining a cache address identifier from target cache data query information;
determining a cache address of target service data according to a corresponding relation between a preset cache address identifier and the cache address;
accessing the cache address, and acquiring target service data corresponding to the service data query request from the data stored in the cache address.
For example, the correspondence between the cache address identification and the cache address may be stored in the service connection module in the form of a dictionary, e.g., there is a dictionary in the service connection module,
{“mysql”:{“ip”:”10.xxx.xxx.xxx”,port:3306},
“redis”:{“ip”:”10.xxx.xxx.yyy”,port:1111},}
wherein mysql and redis are cache address identifiers, "mysql" { "ip": "10. Xxx", port:3306} is the correspondence between the cache address identifier of mysql and the cache address.
204. Based on the data storage information, target service data is acquired from a storage location indicated by the data storage information.
In some embodiments, the target service data may not be successfully obtained from the cache address due to a communication connection failure, non-cached service data in the cache address, and the like, at this time, the target service data may be obtained from an original storage location (source database) of the target service data. That is, as shown in fig. 4, the target service data query information further includes a service source data query statement indicating a source database in which the target service data is stored.
The data query method of the embodiment of the invention further comprises the following steps:
if the acquisition of the target service data based on the target cache data query information fails, acquiring a service source data query statement from the target service data query information;
and calling a service source data query statement to acquire target service data from a source database.
The source database may be an Oracle database (Oracle database is also called Oracle RDBMS, or Oracle for short, is a relational database management system of Oracle corporation), mySQL (MySQL is a small-sized relational database management system of open source code) database, postgreSQL (PostgreSQL is a free object-relational database server) database, or a database set by a technician at his own. These databases are used for storing, analyzing, processing, etc. data in the present embodiment.
For example, the traffic source data query statement may be "Select id, name from tableUser," where "from tab user" may indicate the source database in which the traffic data is stored.
In some alternative examples, the target cache data query information and the business source data query statement may be in one file, e.g., the target business data query information may be a static SQL file, the business source data query statement is an SQL statement of the static SQL file, and the target cache data query information is an annotation statement of the static SQL file.
In other examples, the target-cache-data query information and the business-source-data query statement may each be stored as two separate files, e.g., the business-source-data query statement may be an SQL statement of one static SQL file, and the target-cache-data query information may be stored in another static SQL file. The corresponding relation between the target cache data query information and the service source data query statement can be established through a service identifier and the like.
As shown in fig. 5, in order to facilitate obtaining data from a cache location in a subsequent use process, after obtaining data from a source database, the data may be stored in a cache space where a cache address is located, that is, after step "call a service source data query statement, obtain target service data from the source database", the method may further include:
and storing the target business data to a cache address of the target business data indicated by the target cache data query information based on the target cache data query information.
In some optional examples, the obtained target service data may be cached to any address, and after the data is stored, the target cache data query information is updated, that is, the step of "calling a service source data query statement, and obtaining the target service data from the source database" may further include:
Caching the target business data to a target cache address;
and modifying the cache address of the target business data indicated by the target cache data query information into a target cache address based on the target cache address.
In some examples, caching policies for data may also be included in the cached data query information, which may include, for example, a first-in first-out policy (First in First out, FIFO), a most recently used policy (Least Frequently Used, LFU), a least recently used policy (Least Recently Used, LRU), and so on caching algorithms.
For example, a data caching policy may be written in the cached data query information, and when the cached data needs to be modified or deleted, the service connection module may perform management operation on the cached data according to the caching policy.
It may be appreciated that, in order to ensure the validity of the data in the cache, the data in the cache may be updated periodically or non-periodically according to the needs of the practical application, that is, the embodiment of the present invention may further include:
when the updating moment of the cache data is reached, calling a service source data query statement corresponding to each service, and acquiring first service data of each service from a source database of each service;
Based on the cache data query information of each service, accessing a cache address indicated by the cache data query information, and acquiring second service data of each service from the cache address;
and comparing the first service data and the second service data of the same service, and if the first service data and the second service data are inconsistent, updating the second service data of the same service based on the first service data.
In some alternative examples, each service may be provided with an independent corresponding source database, or multiple services may correspond to one source database, and so on. When updating the data in the cache, only the service data of which part of the source database data is changed can be updated, or the service data of which part is provided with the single cache data updating time can be updated, or after the cache data updating time is reached, all the data in the cache can be updated, and the like.
Specifically, the technician may preset a data update policy, which may be to update the data in the cache address at a fixed time, for example, 2:00 updates the data, or updates the data every 8 hours, etc. Alternatively, the source data update policy may be to update the data in the cache address immediately when the data in the source database changes, and so on. The specific data update policy may be set by a technician according to the actual use situation, which is not limited by the embodiment of the present invention.
The cache data update time may be a time point determined according to a data update policy, for example, when the data update policy updates data in a cache address when the number of service data query requests is less than a preset value N, the cache data update time may be a time when the number of service data query requests is less than the preset value N, and so on.
In some embodiments, in order to enhance the reliability of the data in the cache, the effective time length of the data stored in the cache may be preset, and in the case that the stored time length of the data in the cache does not exceed the effective time length, the data in the cache is considered to be effective. That is, the target cache data query information may further include a cache valid duration;
accordingly, the step of accessing the cache address of the target service data indicated by the target cache data query information based on the target cache data query information to obtain the target service data corresponding to the service data query request may include:
acquiring the cache effective duration of the service data indicated by the target cache data query information from the target cache data query information;
determining the storage time length of the business data in the cache address based on the cache address indicated by the target cache data query information;
And if the storage time length is not greater than the effective time length of the cache, accessing the cache address indicated by the target cache data query information to obtain target service data corresponding to the target service data query request.
In some embodiments, if the storage time period is longer than the effective time period of the cache data, the method may be executed to obtain a service source data query statement from the target service data query information;
and calling a service source data query statement to acquire target service data from the source database.
For example, the target cache data query information may be #cache: redis:1d, where 1d may indicate that the valid time of the data in the cache is one day, and so on.
In some examples, the service connection module (middleware) may not need to obtain the target cache data query information when receiving the service data query request, but may obtain, periodically or aperiodically, a cache valid duration of the service data indicated by the target cache data query information from the target cache data query information, determine a storage duration of the service data in the cache address based on the cache address indicated by the target cache data query information, manage the data in the cache address if the storage duration is longer than the cache valid duration, and so on.
As can be seen from the above, the embodiment of the present invention may be applied to a service connection module of a data query system, where the data query system further includes service data query information corresponding to the service connection module, the service connection module receives a service data query request, the service data query request includes a target service identifier, determines target service data query information corresponding to the target service identifier based on the target service identifier in the service data query request and a corresponding relationship between a preset service identifier and service data query information, acquires data storage information from the target service data query information, the data storage information indicates a storage location of target service data corresponding to the target service identifier, and acquires target service data from the storage location indicated by the data storage information based on the data storage information; the embodiment of the invention does not directly store the data query information in the service connection module, but correspondingly stores the data query information and the service connection module, so that when the related information example of the data query is required to be modified, only the information in the data query information is required to be correspondingly modified, and the data query information can be modified at any time by an developer under the condition that the normal use of the service connection module is not influenced.
The method described in the previous examples is described in further detail below by way of example.
In this embodiment, description will be made in connection with the data query system of fig. 1.
As shown in fig. 6, the specific flow of the data query method in this embodiment may be as follows:
601. the terminal receives a service data query request submitted by a user and sends the service data query request to the electronic equipment where the service connection module is located.
The electronic device where the service connection module is located may be a terminal that submits a service data query request to a user, or may be an independent server or the like.
In some embodiments, the service connection module may be disposed on different electronic devices with corresponding service data query information. It can be understood that, in order to increase the access speed to the data, the service connection module and the corresponding service data query information may also be disposed in the same electronic device.
602. The electronic device receives a service data query request, the service data query request including a target service identification.
For example, the user triggers and generates a service data query request at the terminal, a target service identifier is added in the service data query request according to the operation of the user, and the terminal sends the service data query request to the electronic device, so that the electronic device receives the service data query request.
For example, the operation of the user may be an operation of adding friends to a certain user, when the user clicks a control of adding users, the terminal generates a service data query request, and adds a target service identifier for obtaining target user information according to the operation of adding friends of the user in the service data query request.
603. The electronic equipment determines target service data query information corresponding to the target service identification based on the target service identification in the service data query request and the corresponding relation between the preset service identification and the service data query information.
For example, the electronic device queries whether the target service identifier exists in the service data query request, and when the target service identifier exists in the service data query request, obtains the target service identifier, and one or more target service identifiers may be included in the service data query request. And when the target service identifier does not exist in the service data query request, a prompt message of data acquisition failure is returned to the terminal.
In some embodiments, after the data acquisition fails, the electronic device may send the service data query request as failure information to the detection platform of the service data query request, and a technician may modify, according to the failure information received by the detection platform, a corresponding relationship between the preset service identifier and the service data query information.
604. The electronic equipment acquires target cache data query information from the target service data query information, wherein the target cache data query information indicates a cache address of target service data corresponding to the target service identifier.
For example, middleware in the electronic device may read target service data query information, that is, a static SQL file, where target cache data query information is written in the static SQL file in the form of comments, for example, the target cache data query information may be "#cache: mysql", where "#" indicates that content after double-slash is comment information, "cache" is an identifier of the cache data query information, and "mysql" indicates that a database in which the target service data is cached is mysql, and "mysql" may indicate a cache address of the target service data corresponding to the target service identifier.
When the middleware reads the cache identifier, the target cache data query information is acquired.
605. Based on the target cache data query information, accessing the cache address of the target service data indicated by the target cache data query information to obtain target service data corresponding to the service data query request.
In some embodiments, the cache address of the target service data may be written directly in the target cache data query information, for example, the target cache data query information may be #cache: redis { "ip": "10.Xxx. Yyy", port:1111}, where# is a comment symbol in the program code, cache is an identifier of the cache data query information, "ip": "10.Xxx. Yy" indicates the cache address of the target service data, and port:1111 is a specific communication port.
The middleware in the electronic device can access the address according to the ip 10.Xxx. Yyy and port 1111 in the target cache data query information, and read the data in the cache space of the address.
606. If the acquisition of the target service data based on the target cache data query information fails, the electronic equipment acquires a service source data query statement from the target service data query information, invokes the service source data query statement and acquires the target service data from the source database.
For example, the traffic source data query statement may be "SELECT LastName, firstName FROM personas," which may indicate a source database that stores traffic data. The middleware may call the statement SELECT LastName, firstName FROM Persons, access the Persons database, and retrieve LastName, firstName the two columns of data FROM it.
607. And the electronic equipment sends the target service data to the terminal.
In some embodiments, after receiving the target service data, the terminal may directly display the target service data and present the target service data to the user.
In other embodiments, after receiving the target service data, the terminal may further process the target service data and display the processed target service data to the user. For example, the data desired by the user is a user rate, and the target service data obtained from the cache or the source database may be the total number of users, the total amount of users paid, the total number of paid users, etc., at which time the terminal may further calculate based on the target service data and display the data desired by the user to the user.
608. And the electronic equipment stores the target service data to the cache address of the target service data indicated by the target cache data query information based on the target cache data query information.
For example, the middleware on the electronic device may return to step 603 and step 604 after obtaining the target service data from the source database, and determine the cache address of the target service data. And the middleware stores the acquired target service data into a cache address of the target service data.
When in storage, if no data exists in the cache address, the target service data can be directly stored. If the service data is stored in the cache address, the middleware can delete the original service data and then store the target service data, or the middleware can also query a caching algorithm in the information according to the target cache data, for example, a first-in first-out algorithm, manage the original service data and then store the target service data, and the like.
As can be seen from the above, the embodiment of the present invention may store the data query information corresponding to the service connection module instead of directly storing the data query information in the service connection module, so that when the related information instance of the data query needs to be modified, only the corresponding modification needs to be performed on the information in the data query information, and thus, the developer can modify the data query information at any time without affecting the normal use of the service connection module.
In order to better implement the above method, correspondingly, the embodiment of the invention also provides a data query device.
Referring to fig. 7, the data query device is adapted to a service connection module of a data query system, the data query system further includes service data query information corresponding to the service connection module, and the device includes:
a request receiving unit 701, configured to receive a service data query request, where the service data query request includes a target service identifier;
a query information determining unit 702, configured to determine target service data query information corresponding to the target service identifier based on the target service identifier in the service data query request and a preset correspondence between the service identifier and the service data query information;
a storage information acquiring unit 703, configured to acquire data storage information from the target service data query information, where the data storage information indicates a storage location of target service data corresponding to the target service identifier;
and a data acquisition unit 704, configured to acquire the target service data from the storage location indicated by the data storage information based on the data storage information.
In an alternative example, the target service data query information includes target cache data query information, the target cache data query information indicating a cache address of the target service data;
A storage information acquiring unit 703, configured to acquire target cache data query information from target service data query information;
the data obtaining unit 704 is configured to access, based on the target cache data query information, a cache address of the target service data indicated by the target cache data query information, to obtain target service data corresponding to the service data query request.
In an alternative example, the target service data query information may further include a service source data query statement indicating a source database storing target service data;
as shown in fig. 8, the data query device provided in the embodiment of the present invention may further include a source data obtaining unit 705, configured to obtain a service source data query statement from the target service data query information if the obtaining of the target service data based on the target cache data query information fails;
and calling a service source data query statement to acquire target service data from a source database.
In an optional example, the source data obtaining unit 705 further includes a data caching unit 706, configured to store the target service data to a cache address of the target service data indicated by the target cache data query information based on the target cache data query information.
In an optional example, the data query device may further include a data update unit 707, configured to call a service source data query statement corresponding to each service when the cached data update time arrives, and acquire first service data of each service from a source database of each service;
based on the cache data query information of each service, accessing a cache address indicated by the cache data query information, and acquiring second service data of each service from the cache address;
and comparing the first service data and the second service data of the same service, and if the first service data and the second service data are inconsistent, updating the second service data of the same service based on the first service data.
In an optional example, the data obtaining unit 704 may be configured to determine, based on the target cache data query information, a cache address of the target service data, where the cache address caches service data corresponding to at least one service;
accessing a cache address of target service data, and inquiring service data corresponding to the target service identification in the data stored in the cache address according to the corresponding relation between the preset service identification and the service data to serve as the target service data.
In an optional example, the target cache data query information includes a cache address identifier;
A data obtaining unit 704, configured to obtain a cache address identifier from the target cache data query information;
determining a cache address of target service data according to a corresponding relation between a preset cache address identifier and the cache address;
accessing the cache address, and acquiring target service data corresponding to the service data query request from the data stored in the cache address.
In an optional example, the target cache data query information further includes a cache validity duration;
the data acquisition unit is used for acquiring the cache effective duration of the service data indicated by the target cache data query information from the target cache data query information;
determining the storage time length of the business data in the cache address based on the cache address indicated by the target cache data query information;
and if the storage time length is not greater than the effective time length of the cache, accessing the cache address indicated by the target cache data query information to obtain target service data corresponding to the target service data query request.
In the implementation, each unit may be implemented as an independent entity, or may be implemented as the same entity or several entities in any combination, and the implementation of each unit may be referred to the foregoing method embodiment, which is not described herein again.
As can be seen from the above, through the data query device, the embodiment of the invention can store the data query information corresponding to the service connection module instead of directly storing the data query information in the service connection module, so that when the related information example of the data query needs to be modified, only the corresponding modification is needed to be performed on the information in the data query information, and the developer can modify the data query information at any time without affecting the normal use of the service connection module.
In addition, the embodiment of the present invention further provides an electronic device, which may be a terminal or a server, as shown in fig. 9, and shows a schematic structural diagram of the electronic device according to the embodiment of the present invention, specifically:
the electronic device may include Radio Frequency (RF) circuitry 901, memory 902 including one or more computer-readable storage media, input unit 903, display unit 904, sensor 905, audio circuitry 906, wireless fidelity (WiFi, wireless Fidelity) module 907, processor 908 including one or more processing cores, and power supply 909. It will be appreciated by those skilled in the art that the electronic device structure shown in fig. 9 is not limiting of the electronic device and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components. Wherein:
The RF circuit 901 may be used for receiving and transmitting signals during the process of receiving and transmitting information or communication, in particular, after receiving downlink information of a base station, the downlink information is processed by one or more processors 908; in addition, data relating to uplink is transmitted to the base station. Typically, RF circuitry 901 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a subscriber identity module (SIM, subscriber Identity Module) card, a transceiver, a coupler, a low noise amplifier (LNA, low Noise Amplifier), a duplexer, and the like. In addition, RF circuitry 901 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol including, but not limited to, global system for mobile communications (GSM, global System of Mobile communication), general packet radio service (GPRS, general Packet Radio Service), code division multiple access (CDMA, code Division Multiple Access), wideband code division multiple access (WCDMA, wideband Code Division Multiple Access), long term evolution (LTE, long Term Evolution), email, short message service (SMS, short Messaging Service), and the like.
The memory 902 may be used to store software programs and modules that the processor 908 performs various functional applications and data processing by executing the software programs and modules stored in the memory 902. The memory 902 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data created according to the use of the electronic device (such as audio data, phonebooks, etc.), and the like. In addition, the memory 902 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 902 may also include a memory controller to provide access to the memory 902 by the processor 908 and the input unit 903.
The input unit 903 may be used to receive input numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. In particular, in one particular embodiment, the input unit 903 may include a touch sensitive surface as well as other input devices. The touch-sensitive surface, also referred to as a touch display screen or a touch pad, may collect touch operations thereon or thereabout by a user (e.g., operations thereon or thereabout by a user using any suitable object or accessory such as a finger, stylus, etc.), and actuate the corresponding connection means according to a predetermined program. Alternatively, the touch-sensitive surface may comprise two parts, a touch detection device and a touch controller. The touch detection device detects the touch azimuth of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device and converts it into touch point coordinates, which are then sent to the processor 908 and can receive commands from the processor 908 and execute them. In addition, touch sensitive surfaces may be implemented in a variety of types, such as resistive, capacitive, infrared, and surface acoustic waves. The input unit 903 may comprise other input devices besides a touch sensitive surface. In particular, other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, mouse, joystick, etc.
The display unit 904 may be used to display information entered by a user or provided to a user as well as various graphical user interfaces of the electronic device, which may be composed of graphics, text, icons, video, and any combination thereof. The display unit 904 may include a display panel, which may alternatively be configured in the form of a liquid crystal display (LCD, liquid Crystal Display), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch-sensitive surface may overlay a display panel, upon detection of a touch operation thereon or thereabout by the touch-sensitive surface, being communicated to the processor 908 to determine the type of touch event, and the processor 908 then provides a corresponding visual output on the display panel based on the type of touch event. Although in fig. 9 the touch sensitive surface and the display panel are implemented as two separate components for input and output functions, in some embodiments the touch sensitive surface may be integrated with the display panel to implement the input and output functions.
The electronic device may also include at least one sensor 905, such as a light sensor, a motion sensor, and other sensors. In particular, the light sensor may include an ambient light sensor that may adjust the brightness of the display panel according to the brightness of ambient light, and a proximity sensor that may turn off the display panel and/or backlight when the electronic device is moved to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the acceleration in all directions (generally three axes), and can detect the gravity and the direction when the mobile phone is stationary, and can be used for applications of recognizing the gesture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometer and knocking), and the like; other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. that may also be configured with the electronic device are not described in detail herein.
Audio circuitry 906, speakers, and a microphone may provide an audio interface between the user and the electronic device. The audio circuit 906 may transmit the received electrical signal after audio data conversion to a speaker, which converts the electrical signal to a sound signal for output; on the other hand, the microphone converts the collected sound signals into electrical signals, which are received by the audio circuit 906 and converted into audio data, which are processed by the audio data output processor 908 for transmission to, for example, another electronic device via the RF circuit 901, or which are output to the memory 902 for further processing. The audio circuitry 906 may also include an ear bud jack to provide communication of the peripheral headphones with the electronic device.
WiFi belongs to a short-distance wireless transmission technology, and the electronic equipment can help a user to send and receive emails, browse webpages, access streaming media and the like through a WiFi module 907, so that wireless broadband Internet access is provided for the user. Although fig. 9 shows a WiFi module 907, it is to be understood that it does not belong to the necessary constitution of the electronic device, and can be omitted entirely as required within a range that does not change the essence of the invention.
The processor 908 is a control center of the electronic device, connects various parts of the entire handset using various interfaces and lines, and performs various functions of the electronic device and processes data by running or executing software programs and/or modules stored in the memory 902, and invoking data stored in the memory 902, thereby performing overall monitoring of the handset. Optionally, the processor 908 may include one or more processing cores; preferably, the processor 908 may integrate an application processor that primarily handles operating systems, user interfaces, applications, etc., with a modem processor that primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 908.
The electronic device also includes a power supply 909 (e.g., a battery) that provides power to the various components, preferably in logical communication with the processor 908 via a power management system, to enable management of charge, discharge, and power consumption by the power management system. The power supply 909 may also include one or more of any of a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
Although not shown, the electronic device may further include a camera, a bluetooth module, etc., which will not be described herein. In particular, in this embodiment, the processor 908 in the electronic device loads executable files corresponding to the processes of one or more application programs into the memory 902 according to the following instructions, and the processor 908 executes the application programs stored in the memory 902, so as to implement various functions as follows:
receiving a service data query request, wherein the service data query request comprises a target service identifier;
determining target service data query information corresponding to the target service identifier based on the target service identifier in the service data query request and the corresponding relation between the preset service identifier and the service data query information;
Acquiring data storage information from target service data query information, wherein the data storage information indicates a storage position of target service data corresponding to a target service identifier;
based on the data storage information, target service data is acquired from a storage location indicated by the data storage information.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of the various methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a computer-readable storage medium and loaded and executed by a processor.
To this end, an embodiment of the present invention provides a storage medium having stored therein a plurality of instructions capable of being loaded by a processor to perform the steps of any of the data query methods provided by the embodiments of the present invention. For example, the instructions may perform the steps of:
receiving a service data query request, wherein the service data query request comprises a target service identifier;
determining target service data query information corresponding to the target service identifier based on the target service identifier in the service data query request and the corresponding relation between the preset service identifier and the service data query information;
Acquiring data storage information from target service data query information, wherein the data storage information indicates a storage position of target service data corresponding to a target service identifier;
based on the data storage information, target service data is acquired from a storage location indicated by the data storage information.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
Wherein the storage medium may include: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like.
The instructions stored in the storage medium can execute the steps in any data query method provided by the embodiment of the present application, so that the beneficial effects that any data query method provided by the embodiment of the present application can be achieved, and detailed descriptions of the foregoing embodiments are omitted herein.
According to one aspect of the present application, there is also provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions to cause the electronic device to perform the methods provided in the various alternative implementations of the embodiments described above.
The foregoing describes in detail a data query method, apparatus, electronic device and storage medium provided by the embodiments of the present invention, and specific examples are applied to illustrate the principles and embodiments of the present invention, where the foregoing examples are only used to help understand the method and core idea of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in light of the ideas of the present invention, the present description should not be construed as limiting the present invention.
Claims (10)
1. The data query method is characterized by being applied to a service connection module of a data query system, wherein the data query system stores service data query information corresponding to the service connection module, the service data query information and the service connection module are respectively and independently configured, the service data query information comprises a static SQL file, and the static SQL file contains a storage address of service data, and the method comprises the following steps:
receiving a service data query request, wherein the service data query request comprises a target service identifier;
determining target service data query information corresponding to the target service identifier from the static SQL file based on the target service identifier in the service data query request and the corresponding relation between the service identifier preset in the service connection module and the service data query information;
Obtaining a cache identifier from the annotation of the target service data query information;
determining target cache data query information according to the cache identifier, wherein the target cache data query information indicates a cache address of the target service data, the target cache data query information can be updated, and the cache address is synchronously updated after the updating is responded;
and accessing the cache address to obtain target service data corresponding to the service data query request.
2. The data query method of claim 1, wherein the target business data query information further comprises a business source data query statement indicating a source database storing the target business data;
the method further comprises the steps of:
if the acquisition of the target service data based on the target cache data query information fails, acquiring the service source data query statement from the target service data query information;
and calling the service source data query statement to acquire the target service data from the source database.
3. The data query method of claim 2, wherein the invoking the service source data query statement, after obtaining the target service data from the source database, further comprises:
And storing the target business data to a cache address of the target business data indicated by the target cache data query information based on the target cache data query information.
4. The data query method of claim 2, wherein the method further comprises:
when the updating moment of the cache data is reached, calling a service source data query statement corresponding to each service, and acquiring first service data of each service from a source database of each service;
based on the cache data query information of each service, accessing a cache address indicated by the cache data query information, and acquiring second service data of each service from the cache address;
and comparing the first service data and the second service data of the same service, and if the first service data and the second service data are inconsistent, updating the second service data of the same service based on the first service data.
5. The data query method according to claim 1, wherein the accessing the cache address to obtain the target service data corresponding to the service data query request includes:
determining a cache address of the target service data based on the target cache data query information, wherein the cache address caches service data corresponding to at least one service;
And accessing the cache address of the target service data, and inquiring the service data corresponding to the target service identifier in the data stored in the cache address according to the corresponding relation between the preset service identifier and the service data to serve as the target service data.
6. The data query method of claim 1, wherein the target cache data query information includes a cache address identifier;
the accessing the cache address to obtain the target service data corresponding to the service data query request comprises the following steps:
acquiring the cache address identification from the target cache data query information;
determining the cache address of the target service data according to the corresponding relation between the preset cache address identifier and the cache address;
accessing the cache address, and acquiring the target service data corresponding to the service data query request from the data stored in the cache address.
7. The data query method according to any one of claims 1 to 6, wherein the target cache data query information further includes a cache validity duration;
the accessing the cache address to obtain the target service data corresponding to the service data query request comprises the following steps:
Acquiring the cache effective duration of the service data indicated by the target cache data query information from the target cache data query information;
determining the storage time length of the business data in the cache address based on the cache address indicated by the target cache data query information;
and if the storage duration is not longer than the cache effective duration, accessing a cache address indicated by the target cache data query information to obtain the target service data corresponding to the target service data query request.
8. The data query device is characterized by being applied to a service connection module of a data query system, wherein the data query system stores service data query information corresponding to the service connection module, the service data query information and the service connection module are respectively and independently configured, the service data query information comprises a static SQL file, the static SQL file comprises a storage address of service data, and the data query device comprises:
a request receiving unit, configured to receive a service data query request, where the service data query request includes a target service identifier;
the query information determining unit is used for determining target service data query information corresponding to the target service identifier from the static SQL file based on the target service identifier in the service data query request and the corresponding relation between the service identifier preset in the service connection module and the service data query information;
A storage information acquisition unit for acquiring a cache identifier from the annotation of the target service data query information;
determining target cache data query information according to the cache identifier, wherein the target cache data query information indicates a cache address of the target service data, the target cache data query information can be updated, and the cache address is synchronously updated after the updating is responded;
the data acquisition unit is used for accessing the cache address to obtain target service data corresponding to the service data query request.
9. An electronic device comprising a memory and a processor; the memory stores an application program, and the processor is configured to execute the application program in the memory to perform the steps in the data query method as claimed in any one of claims 1 to 7.
10. A storage medium storing a plurality of instructions adapted to be loaded by a processor to perform the steps of the data querying method according to any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110739088.9A CN113420051B (en) | 2021-06-30 | 2021-06-30 | Data query method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110739088.9A CN113420051B (en) | 2021-06-30 | 2021-06-30 | Data query method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113420051A CN113420051A (en) | 2021-09-21 |
CN113420051B true CN113420051B (en) | 2023-08-29 |
Family
ID=77717914
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110739088.9A Active CN113420051B (en) | 2021-06-30 | 2021-06-30 | Data query method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113420051B (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114116817A (en) * | 2021-11-22 | 2022-03-01 | 北京达佳互联信息技术有限公司 | Processing information storage method, processing information query device and server |
CN114238286B (en) * | 2022-02-28 | 2022-08-05 | 连连(杭州)信息技术有限公司 | Data warehouse data processing method and device, electronic equipment and storage medium |
CN114817151A (en) * | 2022-04-13 | 2022-07-29 | 北京字节跳动网络技术有限公司 | Data processing method and device, computer equipment and storage medium |
CN114780145B (en) * | 2022-06-17 | 2022-10-28 | 北京智芯半导体科技有限公司 | Data processing method, data processing apparatus, and computer-readable storage medium |
JP7365469B1 (en) * | 2022-08-05 | 2023-10-19 | 株式会社Cygames | System, cache server, method, and program for performing RDB-related processing |
CN116089483B (en) * | 2023-03-16 | 2023-07-18 | 深圳市思为软件技术有限公司 | Event query method and related device based on real estate management system |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6457020B1 (en) * | 2000-03-20 | 2002-09-24 | International Business Machines Corporation | Query optimization using a multi-layered object cache |
CN105824958A (en) * | 2016-03-31 | 2016-08-03 | 广州华多网络科技有限公司 | Method, device and system for inquiring log |
CN109766354A (en) * | 2018-12-04 | 2019-05-17 | 北京辰森世纪科技股份有限公司 | Optimization method, device and the equipment of business datum inquiry |
CN110019350A (en) * | 2017-07-28 | 2019-07-16 | 北京京东尚科信息技术有限公司 | Data query method and apparatus based on configuration information |
CN110134705A (en) * | 2018-02-09 | 2019-08-16 | 中国移动通信集团有限公司 | A kind of data query method, cache server and terminal |
CN110516142A (en) * | 2019-08-29 | 2019-11-29 | 深圳前海微众银行股份有限公司 | Data query method, apparatus, equipment and medium |
CN111125175A (en) * | 2019-12-20 | 2020-05-08 | 北京奇艺世纪科技有限公司 | Service data query method and device, storage medium and electronic device |
CN112000692A (en) * | 2020-09-02 | 2020-11-27 | 平安养老保险股份有限公司 | Page query feedback method and device, computer equipment and readable storage medium |
CN112015752A (en) * | 2020-08-31 | 2020-12-01 | 杭州小电科技股份有限公司 | Method and device for dynamically querying data, electronic equipment and storage medium |
-
2021
- 2021-06-30 CN CN202110739088.9A patent/CN113420051B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6457020B1 (en) * | 2000-03-20 | 2002-09-24 | International Business Machines Corporation | Query optimization using a multi-layered object cache |
CN105824958A (en) * | 2016-03-31 | 2016-08-03 | 广州华多网络科技有限公司 | Method, device and system for inquiring log |
CN110019350A (en) * | 2017-07-28 | 2019-07-16 | 北京京东尚科信息技术有限公司 | Data query method and apparatus based on configuration information |
CN110134705A (en) * | 2018-02-09 | 2019-08-16 | 中国移动通信集团有限公司 | A kind of data query method, cache server and terminal |
CN109766354A (en) * | 2018-12-04 | 2019-05-17 | 北京辰森世纪科技股份有限公司 | Optimization method, device and the equipment of business datum inquiry |
CN110516142A (en) * | 2019-08-29 | 2019-11-29 | 深圳前海微众银行股份有限公司 | Data query method, apparatus, equipment and medium |
CN111125175A (en) * | 2019-12-20 | 2020-05-08 | 北京奇艺世纪科技有限公司 | Service data query method and device, storage medium and electronic device |
CN112015752A (en) * | 2020-08-31 | 2020-12-01 | 杭州小电科技股份有限公司 | Method and device for dynamically querying data, electronic equipment and storage medium |
CN112000692A (en) * | 2020-09-02 | 2020-11-27 | 平安养老保险股份有限公司 | Page query feedback method and device, computer equipment and readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN113420051A (en) | 2021-09-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113420051B (en) | Data query method and device, electronic equipment and storage medium | |
EP3499786B1 (en) | Data synchronization method, apparatus, storage medium and electronic device | |
CN109948090B (en) | Webpage loading method and device | |
WO2015043476A1 (en) | Devices and methods for webpage display | |
CN103699595A (en) | Method and device for webpage caching of terminal browser and terminal | |
CN107800767A (en) | A kind of access response management method, server and computer-readable recording medium | |
US20220232287A1 (en) | Method and device for acquiring virtual resource and storage medium | |
US20180253450A1 (en) | Method and apparatus for processing timedly-published data | |
US20140324892A1 (en) | Method, apparatus and system for filtering data of web page | |
CN104281610A (en) | Method and device for filtering microblogs | |
CN114115895A (en) | Code query method and device, electronic equipment and storage medium | |
CN111367996B (en) | KV index-based thermal data increment synchronization method and device | |
CN115167764B (en) | Data read-write processing method and device, electronic equipment and storage medium | |
US20230394008A1 (en) | Distributed file access method and related device | |
CN112965756B (en) | Page resource loading amount monitoring method and device, electronic equipment and storage medium | |
US9357027B2 (en) | Data processing method and system | |
WO2015062514A1 (en) | Web content extracting method, device, and system | |
CN117407610A (en) | Page preloading method and device, electronic equipment and storage medium | |
US20140289269A1 (en) | Method, Device and System for Data Searching | |
CN116383224A (en) | Data storage method, device, medium and equipment | |
CN116069455A (en) | Bypass data storage method and device, electronic equipment and storage medium | |
CN116431664A (en) | Business report display method and device, electronic equipment and storage medium | |
CN116302148A (en) | Application starting method and device, electronic equipment and storage medium | |
CN117349503A (en) | Hierarchical data processing method, system, device and storage medium | |
CN117041038A (en) | Method, device and storage medium for writing server site configuration information |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |