CN111984606A - Data query method, device, terminal equipment and storage medium - Google Patents

Data query method, device, terminal equipment and storage medium Download PDF

Info

Publication number
CN111984606A
CN111984606A CN202010685186.4A CN202010685186A CN111984606A CN 111984606 A CN111984606 A CN 111984606A CN 202010685186 A CN202010685186 A CN 202010685186A CN 111984606 A CN111984606 A CN 111984606A
Authority
CN
China
Prior art keywords
data
data file
information
terminal equipment
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010685186.4A
Other languages
Chinese (zh)
Inventor
刘艳云
夏之春
胡闻涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Kingstar Fintech Co Ltd
Original Assignee
Shanghai Kingstar Fintech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Kingstar Fintech Co Ltd filed Critical Shanghai Kingstar Fintech Co Ltd
Priority to CN202010685186.4A priority Critical patent/CN111984606A/en
Publication of CN111984606A publication Critical patent/CN111984606A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation
    • G06F16/24539Query rewriting; Transformation using cached or materialised query results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management

Abstract

The application is applicable to the technical field of information, and provides a data query method, a data query device, terminal equipment and a storage medium. The data query method comprises the following steps: if the terminal equipment detects a data query request, querying a data query result corresponding to the data query request from a data file cached locally; the data file is constructed by data acquired by the data server when the terminal equipment logs in the data server. According to the data query method and device, the data file is locally cached at the terminal, a user can directly obtain the data query result through the locally cached data file without network interaction when querying data, so that the time consumed by data query can be effectively shortened, and the data query efficiency is improved.

Description

Data query method, device, terminal equipment and storage medium
Technical Field
The present application belongs to the field of information technology, and in particular, to a data query method, apparatus, terminal device, and storage medium.
Background
In the process that a user accesses the server through the terminal equipment to perform data query, the terminal equipment interacts with the server on the basis of a network so as to obtain a corresponding data query result. When the query data volume is small, the current network is not easy to be perceived even if the current network is unstable or the network speed is slow; however, if the query data size is large, the query time is long under the condition that the network is normal, and if the network is unstable or the network speed is slow, the query time is greatly increased, which results in low data query efficiency.
Disclosure of Invention
In view of this, embodiments of the present application provide a data query method, an apparatus, a terminal device, and a storage medium, where a data query result corresponding to a data query request is obtained by querying from a locally cached data file, so that dependence on a network during data query is reduced, query time is shortened, and query efficiency is improved.
In a first aspect, an embodiment of the present application provides a data query method, including:
if the terminal equipment detects a data query request, querying a data query result corresponding to the data query request from a data file cached locally;
the data file is constructed by data acquired by the data server when the terminal equipment logs in the data server.
According to the data query method and device, the data file is locally cached in the terminal, a user does not need to perform network interaction when querying data, and the data query result can be directly obtained through the locally cached data file, so that the time consumed by data query can be effectively shortened, and the data query efficiency is improved.
Further, before the terminal device detects a data query request, querying a data query result corresponding to the data query request from a data file cached locally, the method further includes:
the terminal equipment logs in the data server by adopting a user account;
the terminal equipment detects whether the data file is cached locally or not;
and if the data file is not cached locally, the terminal equipment acquires target data of the user account through the data server, constructs the data file according to the target data, and caches the constructed data file locally.
When the terminal device detects the data query request, the terminal device queries and acquires a corresponding data query result from the data file cached locally. Therefore, before detecting the data query request, the data file to be queried needs to be localized. Specifically, the terminal equipment logs in a data server through a user account, and detects whether a local cache data file exists or not after successful login; and if the data file is not detected, the terminal equipment acquires target data of the user account from the server, constructs the data file according to the target data and caches the data file to the local. The method localizes the data information to be retrieved in advance before retrieval, and can effectively reduce the dependence on the network during data query.
Further, after the terminal device detects whether the data file is cached locally, the method further includes:
if the data file is cached locally, the terminal equipment carries out validity check on the data file;
if the validity check is not passed, the terminal device empties the data information in the data file, then the target data is obtained through the data server, and the obtained target data is stored in the data file.
Data may be replaced along with time change, so when the terminal device detects that a data file is cached locally, whether the data file is valid needs to be checked first. If the validity check of the data file is not passed, the data in the data file is invalid, the terminal device empties the data information in the data file, and obtains valid data, namely target data through the data server to store the valid data in the data file for the user to inquire.
Further, the data file records first login response information, where the first login response information is login response information received when the terminal device logs in the data server when the data file is constructed, and after the terminal device logs in the data server by using a user account, the method further includes:
the terminal equipment receives second login response information returned by the data server;
the validity check of the data file by the terminal equipment comprises the following steps:
the terminal equipment checks whether the second login response information is consistent with the first login response information;
if the second login response information is consistent with the first login response information, the terminal equipment judges that the validity check is passed;
and if the second login response information is inconsistent with the first login response information, the terminal equipment judges that the validity check is not passed.
And when the terminal equipment successfully logs in the data server, the data server feeds back login response information to the terminal equipment. When the data file is constructed, the data file stores login response information received when the terminal equipment logs in the data server at that time, namely first login response information; after the terminal device logs in the data server through the user account, login response information, namely second login response information, returned by the data server is received. Then, the terminal equipment carries out validity check on the locally cached data file, namely, the validity of the data file is judged by checking whether the first login response information and the second login response information are consistent, if the two information are consistent, the validity check is judged to be passed, and the data file is valid; if the two information are not consistent, the validity check is judged to be failed, and the data file is invalid. According to the method, the effectiveness of the cached data file is verified, so that the data information in the data file can be updated in different modes in the following process, and the localization efficiency of the data information is improved.
Further, the recording, by the data file, a serial number of each piece of data information of the user account that has been acquired by the data server, and after the validity of the data file is verified by the terminal device, the method further includes:
if the validity check is passed, the terminal equipment reads the maximum value N of the serial numbers recorded by the data file, wherein N is a positive integer;
and the terminal equipment acquires the data information with the serial number of the user account being N +1 or more through the data server, and stores the acquired data information with the serial number being N +1 or more into the data file.
When the terminal device judges that the data file passes the validity check, the data information in the data file is valid, and only the data information which is generated by the data server needs to be cached, but the data file does not have the data information which is cached synchronously. The data file records each piece of data information corresponding to the user account, and also records the serial number of each piece of data information. Therefore, after the validity check of the data file is passed, the terminal device can read the serial number of the last piece of data information in the data file, namely the maximum value N of the recorded serial numbers, acquire the data information with the serial number of the user account number being N +1 or more from the data server according to the maximum value N, and store the data information in the data file to update the data information in the data file.
Further, the acquiring, by the terminal device, the target data through the data server includes:
and the terminal equipment acquires the data information with the serial number of the user account being 0 or more through the data server.
Under the condition that the data file which is not cached locally or the data file cached locally is judged to be invalid, the terminal equipment acquires target data from the data server, so that the data file is constructed and cached to the local or the data information in the local data file is updated, and the target data is the data information with the serial number of the user account being 0 or more.
Further, after the terminal device logs in the data server by using the user account, the method further includes:
and if the terminal equipment receives the updated data information of the user account sent by the data server, updating the data information recorded by the data file by adopting the updated data information of the user account.
In order to ensure the accuracy of the data query result, the data information in the locally cached data file needs to be updated in real time, and the data information recorded in the data file can be updated in real time by receiving the updated data information of the user account sent by the data server by the terminal device.
In a second aspect, an embodiment of the present application provides a data query apparatus, including:
the local query module is used for querying a data query result corresponding to the data query request from a data file cached locally if the data query request is detected;
the data file is constructed by data acquired by the data server when the data inquiry device logs in the data server.
In a third aspect, an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the data query method as set forth in the first aspect of the embodiment of the present application when executing the computer program.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the data query method as set forth in the first aspect of the embodiment of the present application.
Compared with the prior art, the embodiment of the application has the advantages that: the dependence on the network during data query is reduced, the query time consumption is shortened, and the query efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
FIG. 1 is a flowchart of a data query method provided by an embodiment of the present application;
FIG. 2 is a flowchart of an application of a data query method provided in an embodiment of the present application in an actual scenario;
fig. 3 is a block diagram of a data query device according to an embodiment of the present application;
fig. 4 is a schematic diagram of a terminal device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular device structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
The terminology used in the following examples is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of this application and the appended claims, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, such as "one or more", unless the context clearly indicates otherwise. It should also be understood that in the embodiments of the present application, "one or more" means one, two, or more than two; "and/or" describes the association relationship of the associated objects, indicating that three relationships may exist; for example, a and/or B, may represent: a alone, both A and B, and B alone, where A, B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
The data query method provided by the embodiment of the application can be applied to a mobile phone, a tablet personal computer, a medical device, a wearable device, a vehicle-mounted device, an Augmented Reality (AR)/Virtual Reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a Personal Digital Assistant (PDA) and other terminal devices or servers, and the embodiment of the application does not limit the specific types of the terminal devices and the servers.
By way of example and not limitation, when the terminal device is a wearable device, the wearable device may also be a generic term for intelligently designing daily wearing by applying wearable technology, developing wearable devices, such as glasses, gloves, watches, bracelets, clothing, shoes, and the like. A wearable device is a portable device that is worn directly on the body or integrated into the clothing or accessories of the user. The wearable device is not only a hardware device, but also realizes powerful functions through software support, data interaction and cloud interaction. The generalized wearable intelligent device has the advantages that the generalized wearable intelligent device is complete in function and large in size, can realize complete or partial functions without depending on a smart phone, such as a smart watch or smart glasses, and only is concentrated on a certain application function, and needs to be matched with other devices such as the smart phone for use, such as various smart bracelets for monitoring physical signs, smart jewelry and the like.
At present, when a user accesses a server through terminal equipment to perform data query, the user mainly relies on a network to perform the query, and if the query data volume is large, and the network is unstable or the network speed is slow during the query, the query time is greatly increased, so that the data query efficiency is low. This phenomenon is particularly obvious in the financial transaction process, and a user accesses the transaction system through a terminal to perform data query, so that the queried data volume is generally large, and under such a situation, no matter the network state during query is stable and unstable, the query time consumption is greatly increased, so that the query efficiency is low, and the user experience is poor. The data query method provided by the application can solve the problems, and the query result is obtained by querying the data file cached in the local, so that the dependence on the network in the data query process can be reduced, the query time is shortened, and the query efficiency is improved.
In one embodiment, referring to fig. 1, fig. 1 shows a flowchart of a data query method provided by the present application, including:
101. the terminal equipment judges whether a data query request is detected;
the data query request is an instruction of data query initiated to the data server after the user logs in to the data server through the terminal device. For example, if a user wants to inquire about a transaction fee after logging in a financial transaction system on a terminal device, a data inquiry request can be issued by clicking a button for inquiring about the transaction fee on a user interface of the terminal device.
If the terminal device detects the data query request, step 102 is executed, otherwise, step 101 is stopped.
102. And querying a data query result corresponding to the data query request from the locally cached data file.
When a user initiates a data query request through the terminal equipment, the terminal equipment queries the data files cached locally according to the data query request and acquires a data query result corresponding to the data query request. The data file is constructed by data acquired by the data server when the terminal equipment logs in the data server. For example, after a user logs in a data server of a financial transaction system and before sending a data query request, the terminal device may obtain real-time data of the financial transaction system, construct a data file, and buffer the data file locally. Therefore, when a data query request is subsequently initiated, the terminal equipment can directly obtain a data query result from the data file cached locally, and the query efficiency is improved.
Preferably, the data file is cached locally in the terminal device, or cached in an API (application program interface) end used when the terminal device accesses the data server.
In this embodiment, a user queries a localized data file through a terminal device to complete data query, the query process does not need network participation, and even if the queried data volume is large, a data query result corresponding to the data query request can be rapidly queried, so that the query time is greatly shortened, and the data query efficiency is improved.
In one embodiment, before step 101, the method may further include:
201. the terminal equipment logs in the data server by adopting a user account;
202. the terminal equipment detects whether the data file is cached locally or not;
203. and if the data file is not cached locally, the terminal equipment acquires target data of the user account through the data server, constructs the data file according to the target data, and caches the constructed data file locally.
In steps 201 to 203, a user may use his/her own user account to log in a financial transaction system on a terminal device, and at this time, the terminal device may first detect whether a data file is cached locally, where the data file may include real-time data of the user account; and when the detection result shows that the terminal equipment does not cache the data file, subscribing and acquiring real-time data of the user account through a data server of the financial transaction system, and then constructing and acquiring the data file according to the acquired real-time data, and caching the data file in the local.
Preferably, the data server feeds back a login response message each time the terminal device successfully logs in the data server. In step 201, the user logs in the data server on the terminal device through the user account, which may be the first login or may not be the first login; therefore, in order to cache the data information corresponding to the user account locally, after the terminal device successfully logs in the data server, whether the data file is cached locally is detected, and then different methods are adopted to cache the data information according to the detection result.
There are two kinds of detection results. One is that the data file is not cached locally, that is, the terminal device in step 201 logs in the data server through the user account for the first time; at this time, a data file needs to be constructed first, and then the data file needs to be cached locally. Specifically, in one embodiment, the terminal device first obtains target data of the user account through the data server, and then constructs a data file according to the target data and caches the data file to the local for query. Wherein, the data information in the data server is generated in sequence from sequence number 0, and therefore, the step of the terminal device acquiring the target data through the data server includes: and the terminal equipment acquires the data information with the serial number of the user account being 0 or more through the data server. For convenience of understanding, for example, since a user logs in the transaction system by using a user account of the user through the terminal device for the first time, the corresponding local cache data file is not available, after the terminal device determines that the local cache data file is not available through detection, the terminal device may subscribe the target data from number 0 to the transaction system, and after receiving the subscription message, the transaction system may send corresponding data information to the terminal device for caching according to the subscription message.
Preferably, in an embodiment, while constructing the data file, the terminal device stores first login response information received after the terminal device successfully logs in the data server, where the first login response information may include a user name, a login date, and other relevant data characteristic information, and takes login response information in financial transactions as an example: the data characteristic information can be information of transaction date, transaction system and the like.
Another detection result is that a data file is locally cached, that is, the terminal device in step 201 logs in the data server through the user account not for the first login, and the time interval between the current login and the last login is a variable, which affects the validity of the data information in the data file, so it is necessary to check the validity of the data file.
In one embodiment, after the terminal device logs in the data server by using a user account, the terminal device receives second login response information returned by the data server; the step of verifying the validity of the data file by the terminal equipment comprises the following steps:
the terminal equipment checks whether the second login response information is consistent with the first login response information;
if the second login response information is consistent with the first login response information, the terminal equipment judges that the validity check is passed;
and if the second login response information is inconsistent with the first login response information, the terminal equipment judges that the validity check is not passed.
In this embodiment, the terminal device checks the first login response information recorded in the data file and the second login response information returned by the data server to the terminal device after the terminal device logs in the data server this time, and if the two login response information are inconsistent, the data file is invalid; if the two login response messages are consistent, the data file is valid. In the process of checking the two login response messages, the data server generally has respective data information updating rules in order to meet the industry requirements, and the data information can be updated in a month period or a day period. Therefore, when the validity of the data file is verified, different login response information contents can be selected according to the data information generation rule of the server for comparison. For example, assuming that the data server is a trading system, the stored data information is updated by taking a trading day as a period, and when a new trading day is initialized, the data of the previous trading day is replaced; at the moment, the validity of the data file can be verified in a transaction date comparison mode, namely if the transaction dates of the two login response messages are the same, the validity of the data file is judged to be verified; and if the transaction dates of the two login response messages are different, judging that the validity check of the data file is not passed.
Further, for different results of validity check of the data file, different ways are adopted to update the data information in the data file. In an embodiment, if the validity check of the data file fails, the terminal device empties data information in the data file, then obtains the target data through the data server, and stores the obtained target data in the data file.
In this embodiment, the terminal device checks that the data file is invalid, and the terminal device will first empty the data information in the data file, then obtain the target data from the data server through the terminal device, and finally cache the target data in the data file to be queried. Preferably, when the invalid data information cache target data in the data file is emptied each time to update the data information in the data file, the first login response information stored in the data file is updated synchronously, so that the inaccuracy of the verification result and the slow updating of the data information are avoided when the terminal equipment logs in the data service to perform validity verification on the data file next time. For example, in the case that the data information is updated periodically on a trading day, it is assumed that the user logs in the trading system through the terminal device for the first time on the trading day of 20200630, and after logging in, the terminal device constructs the latest data information X of the data server in the logging-in period as a data file to be cached locally, where the data file further includes first login response information 20200630; the user logs in the transaction system again through the terminal device at the transaction date of 20200701, and the latest data information in the data server is Y; the terminal device detects and judges the locally cached data file, and when the data information X in the locally cached data file fails, the terminal device empties the data information X and caches the data information Y to update the data information in the data file, and at the same time, updates the first login response information 20200630 in the data file to 20200701. According to the method, the invalid data file is updated, the first login response information is updated, the situation that the transaction system logs in again in the same transaction day, the validity judgment of the data file is wrong due to the fact that the first login response information is not updated can be avoided, and the efficiency of updating the data information is reduced.
After the terminal device performs validity check on the data file, if the validity check passes, in one embodiment, the terminal device reads a maximum value N of the serial numbers of the data file records, where N is a positive integer; and the terminal equipment acquires the data information with the serial number of the user account being N +1 or more through the data server, and stores the acquired data information with the serial number being N +1 or more into the data file.
In this embodiment, if the validity check of the data file passes, the data information recorded in the data file is proved to be valid. At this time, the terminal device only needs to acquire the data information which has been generated by the data server but the data file is not synchronously cached. As described above, the data in the data server is generated sequentially from the sequence number 0, and the data file records the sequence number corresponding to the data information at the same time as the data information. Therefore, the terminal device may first obtain the serial number of the last piece of data information recorded by the data file, that is, the maximum value N of the serial numbers recorded by the data file, where N is a positive integer; and then acquiring data information with the serial number of the user account being N +1 or more from a data server according to the maximum value N of the serial numbers, and storing the data information into a data file. By adopting the method, the data information in the data file cached locally and the latest data information generated by the data server can be kept consistent. For example, suppose that a user logs in a certain trading system through a trading client B on a terminal device a, at this time, the serial number of the latest data information generated by the data server of the trading system is 1000, and the corresponding trading client B has cached the 1000 pieces of data information into a local data file by the above method. Then, the user logs out of the login, and orders the user after logging in other terminal equipment and a client, or orders the user through modes such as telephone delegation and the like, wherein 100 pieces of data information are generated on a data server by ordering operation, namely 1100 pieces of data information corresponding to the user account are generated at the moment; finally, the user logs in the trading system for data query through the trading client B on the terminal device A, the number of data information in the locally cached data file is 1000 before logging in, after logging in, the trading client B starts to subscribe to the trading system from the number 1001 data information, and the 100 newly generated data information of the data server is synchronously subscribed and cached in the data file, so that the data information in the local data file and the data information in the trading system are kept synchronous, and the accuracy in data query is ensured.
During the period from the time when the terminal device logs on to the data server to the time when the terminal device logs off, the data server may still have new data generated. Therefore, in an embodiment, after the terminal device logs in the data server by using the user account, the method further includes: and if the terminal equipment receives the updated data information of the user account sent by the data server, updating the data information recorded by the data file by adopting the updated data information of the user account.
When the data server sends the updated data information of the user account to the terminal equipment, the terminal equipment can update the data information recorded in the data file in real time through the data information after receiving the data information, and the accuracy of the query result is improved.
In order to better understand the above embodiments, the following further describes an example of performing data query by logging in a transaction system through a client during a financial transaction process, and specifically referring to fig. 2, fig. 2 shows a flowchart of applying a data query method to a client in the financial field. The method comprises the following specific steps:
the user logs in the trading system through the client by adopting the user account, and after the login is successful, the trading system feeds back login response information to the client; and after receiving the login response information, the client detects whether the data file is locally cached, and if the data file is not cached, the current user account logs in the transaction system through the client for the first time. In order to reduce interference of a network on query time consumption in a subsequent query process, a client acquires data information with a serial number of a user account number of 0 or more from a transaction system, constructs a data file according to the data information and caches the data file to the local; after the data file is cached, a user can wait for initiating a query request through the client, and after the query request is detected, the client queries the data file according to the query request to obtain a corresponding query result, and feeds the query result back to a client interface for displaying. Preferably, the data file further stores login response information received by the client when logging in the trading system this time, and the login response information is marked as first login response information, and the first login response information can be used as a verification reference for verifying the validity of the data file when the client logs in the trading system again through the user account.
If the client detects that the data file is locally cached, the client checks the validity of the cached data file. At this time, the data file cached locally contains first login response information, wherein the first login response information is generally login response information received by the client for logging in the transaction system last time; and the login response information received by the current client login transaction system is the second login response information. Whether the currently detected data file is valid or not can be verified by comparing whether the first login response information is matched with the second login response information or not; if the first login response information is not matched with the second login response information, the data information in the data file is invalid, at this time, the client firstly empties the historical data information in the data file, and then acquires the data information of which the serial number of the user account is 0 or more from the transaction system; after the transaction system sends the data information with the serial number of the user account number being 0 or more to the client, the client caches the data information in a data file; after detecting the query request, the client queries the data file according to the query request to obtain a corresponding query result, and feeds the query result back to the client interface for display. It should be noted that, while caching the data information with the serial number of 0 or more to the data file, the content of the first login response information is updated to the content of the second login response information, so that the accuracy of validity check of the data file can be improved after the client logs in the transaction system next time.
If the first login response information and the second login response information are matched, the data information in the data file is valid, at this time, the client reads the serial number corresponding to the last piece of data information recorded in the data file, namely the maximum value N of the serial number of the data information in the data file, acquiring the data information of N +1 and above of the user account number from a transaction system, after the transaction system sends the data information of N +1 and above of the user account number to the client, the client sequentially caches the data information connected with the data information with the serial number N until the data information in the data file is consistent with the data information in the transaction system, the client can wait for the user to initiate a query request through the client, and after the query request is detected, the client queries the data file according to the query request to obtain a corresponding query result and feeds the query result back to a client interface for display.
If the transaction system generates new data information after caching the data information acquired by the client to the transaction system, the data information recorded in the data file can be updated by adopting the updated data information of the user account, so that real-time updating and synchronous caching of the data are ensured, and the accuracy of the data query result is improved.
In summary, the data information corresponding to the user account is received through the terminal device, the data information is cached to form a data file and is cached to the local, and when the user initiates a data query request through the terminal device, the corresponding data query result can be directly obtained from the localized data information without network interaction; if the user logs in the terminal equipment for querying data for multiple times within the time period that the data is valid and not updated, the data information cached in the local data file at the previous time is reused to complete querying.
Fig. 3 shows a block diagram of a data query apparatus according to an embodiment of the present application, and only shows portions related to the embodiment of the present application for convenience of description.
Referring to fig. 3, the apparatus includes:
a local query module 301, configured to query, if a data query request is detected, a data query result corresponding to the data query request from a data file cached locally;
the data file is constructed by data acquired by the data server when the data inquiry device logs in the data server.
Further, the apparatus may further include:
the account login module is used for logging in the data server by adopting a user account;
the cache detection module is used for detecting whether the data file is cached locally;
and the file construction module is used for acquiring target data of the user account through the data server if the data file is not cached locally, constructing the data file according to the target data, and caching the constructed data file locally.
Further, the file construction module may be configured to perform validity check on the data file if the data file is cached locally, and the file construction module may further include:
and the file updating unit is used for emptying data information in the data file if the validity check fails, then acquiring the target data through the data server, and storing the acquired target data into the data file.
Further, the data file records first login response information, the first login response information is login response information received when the data query device logs in the data server when the data file is constructed, the login module is further configured to receive second login response information returned by the data server, and the file construction module further includes:
the verification comparison unit is used for verifying whether the second login response information is consistent with the first login response information;
a first determination unit, configured to determine that the validity check passes if the second login response information is consistent with the first login response information;
and a second determination unit, configured to determine that the validity check fails if the second login response information is inconsistent with the first login response information.
Further, the data file records a serial number of each piece of data information of the user account acquired by the data server, and the first determination unit further includes:
a sequence number reading subunit, configured to read a maximum value N of the sequence numbers recorded in the data file if the validity check passes, where N is a positive integer;
and the data updating subunit is used for acquiring the data information with the serial number of the user account being N +1 or more through the data server and storing the acquired data information with the serial number being N +1 or more into the data file.
Further, the file building module may further include:
and the target data acquisition unit is used for acquiring data information of which the serial number of the user account is 0 or more through the data server.
Further, the apparatus may further include:
and the data real-time updating module is used for updating the data information recorded by the data file by adopting the updated data information of the user account if the updated data information of the user account sent by the data server is received.
The embodiment of the present application further provides a terminal device, which includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor implements the steps of each data query method as proposed in the present application when executing the computer program.
An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the steps of the data query methods as set forth in the present application.
The embodiment of the present application further provides a computer program product, which, when running on a terminal device, enables the terminal device to execute the steps of each data query method provided by the present application.
Fig. 4 is a schematic structural diagram of a terminal device according to an embodiment of the present application. As shown in fig. 4, the terminal device 4 of this embodiment includes: at least one processor 40 (only one shown in fig. 4), a memory 41, and a computer program 42 stored in the memory 41 and executable on the at least one processor 40, the processor 40 implementing the steps in any of the data query method embodiments described above when executing the computer program 42.
The terminal device 4 may be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices, and a smart watch, a smart bracelet and other wearable devices. The terminal device may include, but is not limited to, a processor 40, a memory 41. Those skilled in the art will appreciate that fig. 4 is merely an example of the terminal device 4, and does not constitute a limitation of the terminal device 4, and may include more or less components than those shown, or combine some components, or different components, such as an input-output device, a network access device, and the like.
The Processor 40 may be a Central Processing Unit (CPU), and the Processor 40 may be other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 41 may in some embodiments be an internal storage unit of the terminal device 4, such as a hard disk or a memory of the terminal device 4. In other embodiments, the memory 41 may also be an external storage device of the terminal device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like provided on the terminal device 4. Further, the memory 41 may also include both an internal storage unit and an external storage device of the terminal device 4. The memory 41 is used for storing operating means, applications, bootloaders (bootloaders), data and other programs, such as program code of the computer program. The memory 41 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the above-mentioned apparatus may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical functional division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another device, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium and can implement the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include at least: any entity or apparatus capable of carrying computer program code to a terminal device, recording medium, computer Memory, Read-Only Memory (ROM), Random-Access Memory (RAM), electrical carrier wave signals, telecommunications signals, and software distribution medium. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A method for querying data, comprising:
if the terminal equipment detects a data query request, querying a data query result corresponding to the data query request from a data file cached locally;
the data file is constructed by data acquired by the data server when the terminal equipment logs in the data server.
2. The data query method of claim 1, before the terminal device detects a data query request, and queries a data query result corresponding to the data query request from a locally cached data file, the method further comprising:
the terminal equipment logs in the data server by adopting a user account;
the terminal equipment detects whether the data file is cached locally or not;
and if the data file is not cached locally, the terminal equipment acquires target data of the user account through the data server, constructs the data file according to the target data, and caches the constructed data file locally.
3. The data query method of claim 2, after the terminal device detects whether the data file is cached locally, further comprising:
if the data file is cached locally, the terminal equipment carries out validity check on the data file;
if the validity check is not passed, the terminal device empties the data information in the data file, then the target data is obtained through the data server, and the obtained target data is stored in the data file.
4. The data query method according to claim 3, wherein the data file records first login response information, the first login response information is login response information received when the terminal device logs in the data server when the data file is constructed, and after the terminal device logs in the data server by using a user account, the method further includes:
the terminal equipment receives second login response information returned by the data server;
the validity check of the data file by the terminal equipment comprises the following steps:
the terminal equipment checks whether the second login response information is consistent with the first login response information;
if the second login response information is consistent with the first login response information, the terminal equipment judges that the validity check is passed;
and if the second login response information is inconsistent with the first login response information, the terminal equipment judges that the validity check is not passed.
5. The data query method according to claim 3, wherein the data file records a serial number of each piece of data information of the user account that has been acquired by the data server, and after the terminal device performs validity check on the data file, the method further includes:
if the validity check is passed, the terminal equipment reads the maximum value N of the serial numbers recorded by the data file, wherein N is a positive integer;
and the terminal equipment acquires the data information with the serial number of the user account being N +1 or more through the data server, and stores the acquired data information with the serial number being N +1 or more into the data file.
6. The data query method of claim 3, wherein the terminal device obtaining the target data through the data server comprises:
and the terminal equipment acquires the data information with the serial number of the user account being 0 or more through the data server.
7. The data query method according to any one of claims 2 to 6, further comprising, after the terminal device logs in the data server with a user account:
and if the terminal equipment receives the updated data information of the user account sent by the data server, updating the data information recorded by the data file by adopting the updated data information of the user account.
8. A data query apparatus, comprising:
the local query module is used for querying a data query result corresponding to the data query request from a data file cached locally if the data query request is detected;
the data file is constructed by data acquired by the data server when the data inquiry device logs in the data server.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the data query method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored, which, when being executed by a processor, implements a data query method according to any one of claims 1 to 7.
CN202010685186.4A 2020-07-16 2020-07-16 Data query method, device, terminal equipment and storage medium Pending CN111984606A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010685186.4A CN111984606A (en) 2020-07-16 2020-07-16 Data query method, device, terminal equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010685186.4A CN111984606A (en) 2020-07-16 2020-07-16 Data query method, device, terminal equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111984606A true CN111984606A (en) 2020-11-24

Family

ID=73439521

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010685186.4A Pending CN111984606A (en) 2020-07-16 2020-07-16 Data query method, device, terminal equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111984606A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113032338A (en) * 2021-05-31 2021-06-25 智者四海(北京)技术有限公司 Cross-data-center data storage and query method and system
CN115063923A (en) * 2022-06-28 2022-09-16 北京字跳网络技术有限公司 Voting processing method, system, device, electronic equipment and storage medium
CN117724852A (en) * 2024-02-07 2024-03-19 微网优联科技(成都)有限公司 Cloud computer computing resource allocation method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101815087A (en) * 2010-02-10 2010-08-25 北京播思软件技术有限公司 Method for caching information of mobile communication terminal
CN104753966A (en) * 2013-12-25 2015-07-01 明博教育科技有限公司 Resource file inquiry method and system based on server and client caches
CN107168999A (en) * 2017-03-30 2017-09-15 咪咕数字传媒有限公司 A kind of method for updating pages and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101815087A (en) * 2010-02-10 2010-08-25 北京播思软件技术有限公司 Method for caching information of mobile communication terminal
CN104753966A (en) * 2013-12-25 2015-07-01 明博教育科技有限公司 Resource file inquiry method and system based on server and client caches
CN107168999A (en) * 2017-03-30 2017-09-15 咪咕数字传媒有限公司 A kind of method for updating pages and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113032338A (en) * 2021-05-31 2021-06-25 智者四海(北京)技术有限公司 Cross-data-center data storage and query method and system
CN115063923A (en) * 2022-06-28 2022-09-16 北京字跳网络技术有限公司 Voting processing method, system, device, electronic equipment and storage medium
CN117724852A (en) * 2024-02-07 2024-03-19 微网优联科技(成都)有限公司 Cloud computer computing resource allocation method and device
CN117724852B (en) * 2024-02-07 2024-05-07 微网优联科技(成都)有限公司 Cloud computer computing resource allocation method and device

Similar Documents

Publication Publication Date Title
CN111984606A (en) Data query method, device, terminal equipment and storage medium
US10600049B2 (en) Digital wallet-based transaction method, apparatus, and system
WO2019134543A1 (en) Method and apparatus for information transmission and electronic device
CN109948882B (en) Task processing method based on block data structure and related equipment
CN113935813A (en) Information display method and device, electronic equipment and storage medium
CN111881329A (en) Account balance management method and system
CN106408100A (en) Smart reservation and registration system and method
CN111767481B (en) Access processing method, device, equipment and storage medium
CN108280648B (en) Transaction processing method and server
CN110704486A (en) Data processing method, device, system, storage medium and server
CN114356970B (en) Storage system resource caching method and device
CN110599158A (en) Virtual card combination method, virtual card combination device and terminal equipment
US20210390521A1 (en) Systems configured to manage user-related external party-activity software objects by using machine-readable indicia and methods of use thereof
CN109313771A (en) The degree of reiability of real-time auction
CN110443684B (en) Combined product snapshot type price information processing method and device
CN114742547A (en) Internet online collection control method, device, medium and electronic equipment
CN107833031A (en) A kind of IC-card remaining sum collecting method and device
CN111476562A (en) Virtual resource transfer method, device, electronic equipment and storage medium
CN111367634A (en) Information processing method, information processing device and terminal equipment
CN114205639B (en) Video processing method and device, electronic equipment and storage medium
CN110008283B (en) Data processing method and device based on data tag
CN115758300B (en) Data processing method, device, electronic equipment and storage medium
CN113435554B (en) Method, device, equipment and medium for managing and displaying information triggered by code scanning
CN111917556B (en) Interactive file detection method, device, terminal and storage medium
US20230274242A1 (en) Synchronized on-demand funding system

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