CN114124399A - Data access method and device and computer equipment - Google Patents

Data access method and device and computer equipment Download PDF

Info

Publication number
CN114124399A
CN114124399A CN202111236064.8A CN202111236064A CN114124399A CN 114124399 A CN114124399 A CN 114124399A CN 202111236064 A CN202111236064 A CN 202111236064A CN 114124399 A CN114124399 A CN 114124399A
Authority
CN
China
Prior art keywords
data
token
docking
tokens
data token
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.)
Granted
Application number
CN202111236064.8A
Other languages
Chinese (zh)
Other versions
CN114124399B (en
Inventor
鲍俊浩
罗琪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Anheng Information Security Technology Co Ltd
Original Assignee
Hangzhou Anheng Information Security Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Anheng Information Security Technology Co Ltd filed Critical Hangzhou Anheng Information Security Technology Co Ltd
Priority to CN202111236064.8A priority Critical patent/CN114124399B/en
Publication of CN114124399A publication Critical patent/CN114124399A/en
Application granted granted Critical
Publication of CN114124399B publication Critical patent/CN114124399B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/321Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving a third party or a trusted authority
    • H04L9/3213Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving a third party or a trusted authority using tickets or tokens, e.g. Kerberos
    • 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/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The application relates to a data access method, a data access device, a computer device and a computer readable storage medium, wherein a predetermined number of data tokens are acquired from a first interface of a third party platform, and the data tokens have validity periods; recording the acquisition time of the data tokens, inserting the acquired data tokens into an ordered main queue of the REDIS service, and sequencing the data tokens according to the acquisition time of the data tokens; when data access is needed, the data token with the prior acquisition time is preferentially taken out from the ordered main queue of the REDIS service, and the docking data is acquired from the second interface of the third-party platform by using the taken-out data token. According to the method and the device, the data tokens are sequenced through the ordered main queue of the REDIS service, so that the data tokens are efficiently utilized, and the data docking efficiency is effectively improved.

Description

Data access method and device and computer equipment
Technical Field
The present application relates to the field of network communication technologies, and in particular, to a data access method, an apparatus, and a computer device.
Background
With the continuous expansion of the internet scale, the traditional network security can not meet the current network security requirements, so the network security situation awareness system is generated. At present, in a situation awareness system, various data of a third-party platform need to be docked and shared, so that a client can be better served. However, the security situation awareness system has a limited number of data tokens acquired from the third-party platform every day, the validity period of the data tokens is usually 72 hours, in order to maximize data docking, the data tokens are required to be fully utilized to the maximum extent, the data tokens are used according to the time sequence when the data tokens are used, and the data tokens applied at the earliest are preferentially used.
In the prior art, the applied data token is stored in mysql, the application time of the data token is sequenced when the data token is used each time, the unexpired data token applied earliest is inquired, the data token is taken out, and data docking is carried out on the data token and a third-party platform.
However, the data docking method has a problem of low data docking efficiency, and an effective solution to the problem of low data docking efficiency in the related art has not been proposed at present.
Disclosure of Invention
In view of the foregoing, it is necessary to provide a data docking method, an apparatus and a computer device to solve the problem of low data docking efficiency in the related art.
In a first aspect, an embodiment of the present application provides a data access method, including the following steps:
obtaining a predetermined number of data tokens from a first interface of the third party platform, the data tokens having a validity period; recording the acquisition time of the data token, inserting the acquired data token into an ordered main queue of the REDIS service, and sequencing the data token according to the acquisition time of the data token;
when data access is needed, the data token with the prior acquisition time is preferentially taken out from the ordered main queue of the REDIS service, and the taken-out data token is utilized to acquire docking data from a second interface of the third-party platform.
In some embodiments, preferentially fetching the data token with the previous fetching time from the ordered main queue of the REDIS service, and fetching the docking data from the second interface of the third-party platform by using the fetched data token, including the following steps:
preferentially taking out the data token with the previous acquisition time from the ordered main queue of the REDIS service, and judging whether the taken out data token is in the valid period;
and if the taken data token is in the valid period, acquiring docking data from a second interface of the third-party platform by using the taken data token.
In some embodiments, obtaining a predetermined number of data tokens from a first interface of the third party platform comprises:
setting a first timing task for acquiring the data token;
and acquiring a preset number of the data tokens from the first interface by calling the first timing task.
In some embodiments, after preferentially fetching the data token with a previous acquisition time from the ordered primary queue of the REDIS service, the method further comprises:
deleting the information of the data token that has been taken out from the ordered primary queue of the REDIS service.
In some embodiments, the obtaining docking data from the second interface of the third party platform using the retrieved data token includes:
setting a second timing task for acquiring the docking data;
and acquiring the docking data from the second interface by calling the second timing task.
In some embodiments, after the obtaining of the docking data from the second interface of the third party platform by using the fetched data token, the method further comprises:
receiving a data docking result returned by the third-party platform;
under the condition that the data docking result shows that the data docking is failed, judging whether the reason causing the data docking failure is the failure of the data token;
if the reason causing the data docking failure is not that the data token is invalid, reinserting the current data token into the ordered primary queue of the REDIS service.
In some embodiments, if the reason for the data docking failure is not that the data token is invalid, reinserting the current data token into the ordered primary queue of the REDIS service includes the following steps:
in the case that the reason causing the data docking failure is not that the data token is invalid, inserting the current data token into a secondary queue of the REDIS service;
periodically detecting all data tokens in the secondary queue of the REDIS service, and reinserting the unexpired data tokens in the secondary queue of the REDIS service into the ordered primary queue of the REDIS service.
In some of these embodiments, the method further comprises:
and periodically detecting all data tokens in the ordered main queue of the REDIS service, and cleaning the data tokens within a preset time range from the expiration time.
In a second aspect, in this embodiment, a data access apparatus is provided, configured to access data of a third party platform, the apparatus includes: the data token acquisition module and the docking module:
the data token acquisition module is used for acquiring a preset number of data tokens from a first interface of the third-party platform, and the data tokens have validity periods; recording the acquisition time of the data token, inserting the acquired data token into an ordered main queue of the REDIS service, and sequencing the data token according to the acquisition time of the data token;
the docking module is configured to preferentially fetch the data token with the previous acquisition time from the ordered main queue of the REDIS service when data access is required, and acquire docking data from a second interface of the third-party platform by using the fetched data token.
In a third aspect, there is provided in this embodiment a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method according to the first aspect when executing the computer program.
According to the data docking method, the data docking device and the computer equipment, a preset number of data tokens are obtained from a first interface of a third-party platform, and the data tokens have validity periods; recording the acquisition time of the data tokens, inserting the acquired data tokens into an ordered main queue of the REDIS service, and sequencing the data tokens according to the acquisition time of the data tokens; when data access is needed, the data token with the prior acquisition time is preferentially taken out from the ordered main queue of the REDIS service, and the docking data is acquired from the second interface of the third-party platform by using the taken-out data token. According to the method and the device, the data tokens are sequenced through the ordered main queue of the REDIS service, so that the data tokens are efficiently utilized, and the data docking efficiency is effectively improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a first flowchart of a data access method provided in an embodiment of the present application;
FIG. 2 is a flow chart diagram II of a method of the flow chart diagram provided in accordance with an embodiment of the present application;
FIG. 3 is a block diagram of an apparatus according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a computer device provided according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments provided in the present application without any inventive step are within the scope of protection of the present application.
It is obvious that the drawings in the following description are only examples or embodiments of the present application, and that it is also possible for a person skilled in the art to apply the present application to other similar contexts on the basis of these drawings without inventive effort. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the specification. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of ordinary skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments without conflict.
Unless defined otherwise, technical or scientific terms referred to herein shall have the ordinary meaning as understood by those of ordinary skill in the art to which this application belongs. Reference to "a," "an," "the," and similar words throughout this application are not to be construed as limiting in number, and may refer to the singular or the plural. The present application is directed to the use of the terms "including," "comprising," "having," and any variations thereof, which are intended to cover non-exclusive inclusions; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or elements, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. Reference to "connected," "coupled," and the like in this application is not intended to be limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The term "plurality" as referred to herein means two or more. "and/or" describes an association relationship of associated objects, meaning that three relationships may exist, for example, "A and/or B" may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. Reference herein to the terms "first," "second," "third," and the like, are merely to distinguish similar objects and do not denote a particular ordering for the objects.
An embodiment of the present application provides a data access method, which may be used for data access in the technical field of network communication, and as shown in fig. 1, the method includes the following steps:
step S110, acquiring a preset number of data tokens from a first interface of a third-party platform, wherein the data tokens have validity periods; and recording the acquisition time of the data tokens, inserting the acquired data tokens into an ordered main queue of the REDIS service, and sequencing the data tokens according to the acquisition time of the data tokens.
Specifically, the third-party platform may be a data management system of any enterprise or unit, and if the situation analysis of the third-party platform is to be implemented, docking and data sharing of data in the third-party platform are required. The butted data comprises unit information, risk hidden dangers, safety events and the like, and because the butted data belongs to data with privacy, in order to ensure the safety of the butted data, a data token is required to be used for authority authentication during data butting. The data token is an encrypted character string and has the authority verification function. The third party platform provides the data token and provides an account number for obtaining the data token, the account number for obtaining the data token has a limited number of data tokens which can be obtained from the third party platform every day, and the obtained data token has an expiration date. The account number capability provided by the third party platform controls the number of data tokens and the duration of validity of the data tokens. Due to the fact that the number of the data tokens is limited and the data tokens have validity periods, in order to achieve data docking maximization, the data tokens need to be fully utilized, the data tokens need to be used according to the time sequence of token acquisition when the data tokens are used, and the data tokens acquired earliest are preferentially used. The REDIS (Remote Dictionary Server) is a high-performance key-value database, the inserted data may be sorted according to a designated field, after a data token is acquired from a third-party platform, the acquisition time of the data token is recorded, the acquisition time of all the data tokens may be stored in a format of a timestamp, for example, 20211030140130, the acquired data token is inserted into an ordered main queue of the REDIS service, and the data token is sorted according to the acquisition time of the data token.
Step S120, when data access is needed, the data token with the previous acquisition time is preferentially taken out from the ordered main queue of the REDIS service, and the taken-out data token is used for acquiring the docking data from the second interface of the third-party platform.
Specifically, when taking out a token from the ordered main queue of the REDIS service, a data token whose acquisition time is before may be taken out one time, or a plurality of data tokens may be taken out at one time, and the preset number of the taken-out data tokens may be set according to actual requirements. If the data volume needing to be docked is large at present, a plurality of data tokens can be taken out at one time, so that the time spent on taking out the data tokens is saved, and the working efficiency is improved; if the data volume needing to be docked is small at present, a small number of data tokens can be taken out at a time, and waste of the data tokens is avoided. Typically, the first interface for obtaining the data token from the third party platform and the second interface for obtaining the docking data from the third party platform are not one interface. And if the docking data is successfully acquired from the second interface of the third party, the data token is successfully consumed, the third party platform returns the docking data, and the newly adding and updating operations of the docking data can be realized subsequently.
In the related technology, the applied data tokens are stored in mysql, the application time of the data tokens is sequenced when the data tokens are used each time, the unexpired data tokens applied earliest are inquired out, the data tokens are taken out, and data docking is carried out on the data tokens and a third-party platform. Through the steps from S110 to S120, a predetermined number of data tokens are obtained from a first interface of a third-party platform, the obtaining time of the data tokens is recorded, the obtained data tokens are inserted into an ordered main queue of the REDIS service, and the data tokens are sequenced according to the obtaining time of the data tokens; when data access is needed, the data token with the previous acquisition time is preferentially taken out from the ordered main queue of the REDIS service, and the docking data can be acquired from the second interface of the third-party platform by using the taken-out data token. According to the method and the device, the data tokens are stored through the ordered main queue of the REDIS service, when the data tokens are used, sequencing is not required at every time, and the data tokens with the previous acquisition time can be directly taken out from the ordered main queue of the REDIS service in a priority mode to be used, so that efficient utilization of the data tokens is achieved, and data butt joint efficiency is effectively improved.
In one embodiment, based on the step S120 of preferentially fetching the data token with the previous fetching time from the ordered main queue of the REDIS service, and using the fetched data token to fetch the docking data from the second interface of the third-party platform, the method includes the following steps:
step S121, preferentially fetching the data token with the previous acquisition time from the ordered main queue of the REDIS service, and determining whether the fetched data token is in the validity period.
Step S122, if the taken out data token is in the valid period, the taken out data token is used to obtain the docking data from the second interface of the third party platform.
Specifically, all the data tokens have the validity period, and the validity period of the taken data tokens is judged, so that the data tokens subjected to data docking can be ensured to be in the validity period, and the success rate of acquiring the docking data is effectively improved.
In one embodiment, the obtaining of the predetermined number of data tokens from the first interface of the third party platform based on the step S110 includes the following steps:
step S111, a first timing task of acquiring the data token is set.
In step S112, a predetermined number of data tokens are obtained from the first interface by calling the first timing task.
Specifically, the time of the first timing task may be set according to actual requirements. For example, the time of the first timing task may be set at zero point of each day, and the server is idle at the normal zero point, and at this time, the task of acquiring the data token is performed more efficiently and has no influence on other services of the server. In addition, since the number of data tokens acquired from the third-party platform every day is limited, by setting a first timing task of acquiring the data tokens, and acquiring a predetermined number of data tokens from the first interface every day at regular time, the maximum number of data tokens can be accumulated, and a solid foundation is provided for acquiring the docking data.
Further, in one embodiment, after preferentially fetching the data token with the previous acquisition time from the ordered primary queue of the REDIS service, the data access method provided by the present application further includes the following steps:
information of the data token that has been taken out is deleted from the ordered main queue of the REDIS service.
Specifically, the information of the taken data token is deleted from the ordered main queue of the REDIS service, so that the situation that the data token is repeatedly used can be avoided, and the data docking efficiency is further improved.
In one embodiment, the method for obtaining the docking data from the second interface of the third-party platform by using the taken data token comprises the following steps:
setting a second timing task for acquiring the docking data;
and acquiring the docking data from the second interface by calling the second timing task.
Specifically, the time of the second timing task may be set according to actual requirements. For example, the time of the second timing task may be set at a zero point every day, the server is idle at a general zero point, the task efficiency of acquiring the docking data is relatively high at this time, and other services of the server are not affected.
Further, as shown in fig. 2, in one embodiment, after the step S120 acquires the docking data from the second interface of the third party platform by using the retrieved data token, the data docking method provided by the present application further includes:
and step S130, receiving a data docking result returned by the third-party platform.
Specifically, after the data token is used to obtain the docking data from the third-party platform, the third-party platform returns the data docking result regardless of whether the data docking is successful. If the data docking is successful, the third-party platform returns the docking data; if the data docking fails, the third-party platform returns the reason of the data docking failure, and the reason of the failure can be returned in a form of a pop-up box or a form of a webpage code.
Step S140, when the data docking result shows that the data docking is failed, determining whether the reason for the data docking failure is the data token failure.
Specifically, the data token failure may be due to expiration of the data token, repeated use of the data token, and a defect of the data token itself, and when the data docking result shows that the data docking fails, it is determined whether the reason causing the data docking failure is the data token failure, and if the data token failure causes the data docking failure, it is verified that the current data token itself is unavailable and the current data token cannot be used to obtain the docking data.
Step S150, if the reason for the data docking failure is not that the data token is invalid, reinserting the current data token into the ordered primary queue of the REDIS service.
Specifically, if the reason causing the data docking failure is not the data token failure, and may be that the current data docking failure is caused by the current network failure and some problems of the server operation, it is proved that the current data token itself is available, the current data token can be used to obtain the docking data, the current data token is reinserted into the ordered main queue of the REDIS service, and the current data token is subsequently reused.
Through the steps S130 to S150, the data tokens that are not invalidated are reinserted into the ordered main queue of the REDIS service, so that the utilization rate of the data tokens that are not invalidated is effectively improved.
In one embodiment, if the reason for the data docking failure in step S150 is not that the data token is invalid, the step of reinserting the current data token into the ordered primary queue of the REDIS service includes the following steps:
step S151, in case that the reason for the data docking failure is not that the data token is invalid, inserting the current data token into the auxiliary queue of the REDIS service.
Step S152, periodically detect all data tokens in the secondary queue of the REDIS service, and reinsert the unexpired data tokens in the secondary queue of the REDIS service into the ordered primary queue of the REDIS service.
Specifically, the secondary queue of the REDIS service is another REDIS service queue different from the ordered primary queue of the REDIS service, and the secondary queue of the REDIS service stores therein data tokens that have not failed in their own right despite the data docking failure. In this embodiment, all data tokens in the secondary queue of the REDIS service are periodically detected, and unexpired data tokens in the secondary queue of the REDIS service are reinserted into the ordered primary queue of the REDIS service, where a detection period may be established according to a requirement. This data token is inserted into the ordered primary queue of the REDIS service immediately as opposed to each time the acquired data token is not expired. In this embodiment, an auxiliary queue of the REDIS service is added to store data tokens that have failed data docking but do not fail, and all data tokens in the auxiliary queue of the REDIS service are periodically detected, and unexpired data tokens in the auxiliary queue of the REDIS service are reinserted into an ordered main queue of the REDIS service, so that consumption of server performance can be effectively reduced, and data docking efficiency can be improved.
In one embodiment, the data interfacing method provided by the present application further includes: and periodically detecting all data tokens in the ordered main queue of the REDIS service, and cleaning the data tokens within a preset time range from the expiration time.
After the data token is acquired from the third-party platform, the data token is inserted into the ordered main queue of the REDIS service, but the data token in the ordered main queue of the REDIS service is not necessarily used immediately, so that in order to avoid that the data token taken out of the ordered main queue of the REDIS service is expired, all the data tokens in the ordered main queue of the REDIS service are periodically detected, and the data tokens with the time length within a preset time range from the expiration time are cleaned. The detection period and the preset time range can be set according to actual requirements, for example, the detection period can be set to half an hour, and the preset time range is set to 40 minutes, so that the preset time range is ten minutes more than the detection period, and the purpose is to ensure that a thread for cleaning the expired data tokens can complete the cleaning task of the expired data tokens within the ten minutes. Through the steps, the data tokens in the ordered main queue of the REDIS service can be ensured to be in the validity period, and the data access efficiency is effectively improved.
The present embodiment further provides a data access method, where the process includes the following steps:
step S210, a first timing task for acquiring the data token is set.
Step S220, acquiring a preset number of data tokens from a first interface of a third-party platform by calling a first timing task, recording the acquisition time of the data tokens, inserting the acquired data tokens into an ordered main queue of the REDIS service, and sequencing the data tokens according to the acquisition time of the data tokens.
Step S230, a second timing task for acquiring the docking data is set.
Step S240, by calling the second timing task, preferentially take out the data token with the previous acquisition time from the ordered main queue of the REDIS service, and acquire the docking data from the second interface of the third-party platform by using the taken out data token.
And step S250, receiving a data docking result returned by the third-party platform.
Step S260, under the condition that the data docking result shows that the data docking is failed, judging whether the reason causing the data docking failure is data token failure, and if the reason causing the data docking failure is not the data token failure, inserting the current data token into an auxiliary queue of the REDIS service;
step S270, periodically detecting all data tokens in the secondary queue of the REDIS service, and reinserting the unexpired data tokens in the secondary queue of the REDIS service into the ordered primary queue of the REDIS service.
Step S280, periodically detecting all data tokens in the ordered main queue of the REDIS service, and cleaning the data tokens within a preset time range from the expiration time.
Fig. 3 is a schematic diagram of a data access device according to an embodiment of the present invention, and as shown in fig. 3, there is provided a data access device 30, which includes a data token obtaining module 31 and a docking module 32, where:
a data token obtaining module 31, configured to obtain a predetermined number of data tokens from a first interface of a third-party platform, where the data tokens have validity periods; recording the acquisition time of the data tokens, inserting the acquired data tokens into an ordered main queue of the REDIS service, and sequencing the data tokens according to the acquisition time of the data tokens;
the docking module 32 is configured to preferentially fetch a data token with a previous acquisition time from the ordered main queue of the REDIS service when data access is required, and acquire docking data from the second interface of the third-party platform by using the fetched data token.
The data docking device 30 obtains a predetermined number of data tokens from the first interface of the third-party platform, where the data tokens have validity periods; recording the acquisition time of the data tokens, inserting the acquired data tokens into an ordered main queue of the REDIS service, and sequencing the data tokens according to the acquisition time of the data tokens; when data access is needed, the data token with the prior acquisition time is preferentially taken out from the ordered main queue of the REDIS service, and the docking data is acquired from the second interface of the third-party platform by using the taken-out data token. According to the method and the device, the data tokens are sequenced through the ordered main queue of the REDIS service, so that the data tokens are efficiently utilized, and the data docking efficiency is effectively improved.
In one embodiment, the docking module 32 is further configured to preferentially fetch a data token with a previous acquisition time from the ordered main queue of the REDIS service, and determine whether the fetched data token is in the validity period;
and if the taken data token is in the valid period, the taken data token is utilized to obtain the docking data from the second interface of the third-party platform.
In one embodiment, the data token obtaining module 31 is further configured to set a first timing task for obtaining the data token;
a predetermined number of data tokens are obtained from the first interface by invoking a first timing task.
In one embodiment, after preferentially fetching the data token with the previous acquisition time from the ordered main queue of the REDIS service, the docking module 32 is further configured to delete the information of the fetched data token from the ordered main queue of the REDIS service.
In one embodiment, the docking module 32 is further configured to set a second timing task for acquiring the docking data;
and acquiring the docking data from the second interface by calling the second timing task.
In one embodiment, the data access device 30 further includes a data token recycling module, configured to receive a data docking result returned by the third-party platform;
under the condition that the data docking result shows that the data docking fails, judging whether the reason causing the data docking failure is the failure of the data token;
and if the reason causing the data docking failure is not the data token failure, reinserting the current data token into the ordered main queue of the REDIS service.
In one embodiment, the data token recycling module is further configured to insert the current data token into a secondary queue of the REDIS service if the reason for the data docking failure is not that the data token is invalid;
and periodically detecting all data tokens in the secondary queue of the REDIS service, and reinserting the unexpired data tokens in the secondary queue of the REDIS service into the ordered primary queue of the REDIS service.
In one embodiment, the data access device 30 further includes a detection module, configured to periodically detect all data tokens in the ordered primary queue of the REDIS service, and clean the data tokens within a preset time range from the expiration time.
The above modules may be functional modules or program modules, and may be implemented by software or hardware. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 4. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The memory provides an environment for the operating system and the computer programs to run in the non-volatile storage medium. The database of the computer device is used for storing a preset configuration information set. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement the above-described data interfacing method.
In one embodiment, a computer device is provided, which may be a terminal. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The memory provides an environment for the operating system and the computer programs to run in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a data interfacing method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 4 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring a preset number of data tokens from a first interface of a third-party platform, wherein the data tokens have validity periods; recording the acquisition time of the data tokens, inserting the acquired data tokens into an ordered main queue of the REDIS service, and sequencing the data tokens according to the acquisition time of the data tokens;
when data access is needed, the data token with the prior acquisition time is preferentially taken out from the ordered main queue of the REDIS service, and the docking data is acquired from the second interface of the third-party platform by using the taken-out data token.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
preferentially taking out the data token with the previous acquisition time from the ordered main queue of the REDIS service, and judging whether the taken out data token is in the valid period;
and if the taken data token is in the valid period, the taken data token is utilized to obtain the docking data from the second interface of the third-party platform.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
setting a first timing task for acquiring a data token;
a predetermined number of data tokens are obtained from the first interface by invoking a first timing task.
In one embodiment, after preferentially fetching the data token with the previous acquisition time from the ordered primary queue of the REDIS service, the processor when executing the computer program further performs the steps of:
information of the data token that has been taken out is deleted from the ordered main queue of the REDIS service.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
setting a second timing task for acquiring the docking data;
and acquiring the docking data from the second interface by calling the second timing task.
In one embodiment, after obtaining the docking data from the second interface of the third party platform using the retrieved data token, the processor when executing the computer program further performs the following steps:
receiving a data docking result returned by the third-party platform;
under the condition that the data docking result shows that the data docking fails, judging whether the reason causing the data docking failure is the failure of the data token;
and if the reason causing the data docking failure is not the data token failure, reinserting the current data token into the ordered main queue of the REDIS service.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
under the condition that the reason causing the data docking failure is not the data token failure, inserting the current data token into an auxiliary queue of the REDIS service;
and periodically detecting all data tokens in the secondary queue of the REDIS service, and reinserting the unexpired data tokens in the secondary queue of the REDIS service into the ordered primary queue of the REDIS service.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
and periodically detecting all data tokens in the ordered main queue of the REDIS service, and cleaning the data tokens within a preset time range from the expiration time.
The storage medium acquires a preset number of data tokens from a first interface of a third-party platform, and the data tokens have validity periods; recording the acquisition time of the data tokens, inserting the acquired data tokens into an ordered main queue of the REDIS service, and sequencing the data tokens according to the acquisition time of the data tokens; when data access is needed, the data token with the prior acquisition time is preferentially taken out from the ordered main queue of the REDIS service, and the docking data is acquired from the second interface of the third-party platform by using the taken-out data token. According to the method and the device, the data tokens are sequenced through the ordered main queue of the REDIS service, so that the data tokens are efficiently utilized, and the data docking efficiency is effectively improved.
It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to be limiting. All other embodiments, which can be derived by a person skilled in the art from the examples provided herein without any inventive step, shall fall within the scope of protection of the present application.
It is obvious that the drawings are only examples or embodiments of the present application, and it is obvious to those skilled in the art that the present application can be applied to other similar cases according to the drawings without creative efforts. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.
The term "embodiment" is used herein to mean that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is to be expressly or implicitly understood by one of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the patent protection. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims (10)

1. A data access method for accessing data of a third party platform, the method comprising the steps of:
obtaining a predetermined number of data tokens from a first interface of the third party platform, the data tokens having a validity period; recording the acquisition time of the data token, inserting the acquired data token into an ordered main queue of the REDIS service, and sequencing the data token according to the acquisition time of the data token;
when data access is needed, the data token with the prior acquisition time is preferentially taken out from the ordered main queue of the REDIS service, and the taken-out data token is utilized to acquire docking data from a second interface of the third-party platform.
2. The data access method according to claim 1, wherein the data token with the previous acquisition time is preferentially fetched from the ordered main queue of the REDIS service, and the fetched data token is used to acquire the docking data from the second interface of the third-party platform, comprising the following steps:
preferentially taking out the data token with the previous acquisition time from the ordered main queue of the REDIS service, and judging whether the taken out data token is in the valid period;
and if the taken data token is in the valid period, acquiring docking data from a second interface of the third-party platform by using the taken data token.
3. The data access method of claim 1, wherein obtaining a predetermined number of data tokens from the first interface of the third party platform comprises:
setting a first timing task for acquiring the data token;
and acquiring a preset number of the data tokens from the first interface by calling the first timing task.
4. The data access method of claim 1, wherein after preferentially fetching the data token with a previous acquisition time from an ordered primary queue of the REDIS service, the method further comprises:
deleting the information of the data token that has been taken out from the ordered primary queue of the REDIS service.
5. The data access method of claim 1, wherein the step of obtaining the docking data from the second interface of the third party platform using the retrieved data token comprises the steps of:
setting a second timing task for acquiring the docking data;
and acquiring the docking data from the second interface by calling the second timing task.
6. The data access method of any one of claims 1 to 5, wherein after the retrieving the docking data from the second interface of the third party platform using the retrieved data token, the method further comprises:
receiving a data docking result returned by the third-party platform;
under the condition that the data docking result shows that the data docking is failed, judging whether the reason causing the data docking failure is the failure of the data token;
if the reason causing the data docking failure is not that the data token is invalid, reinserting the current data token into the ordered primary queue of the REDIS service.
7. The data access method according to claim 6, wherein if the reason for the data docking failure is not the data token failure, reinserting the current data token into the ordered primary queue of the REDIS service comprises the following steps:
in the case that the reason causing the data docking failure is not that the data token is invalid, inserting the current data token into a secondary queue of the REDIS service;
periodically detecting all data tokens in the secondary queue of the REDIS service, and reinserting the unexpired data tokens in the secondary queue of the REDIS service into the ordered primary queue of the REDIS service.
8. The data access method of claim 1, further comprising:
and periodically detecting all data tokens in the ordered main queue of the REDIS service, and cleaning the data tokens within a preset time range from the expiration time.
9. A data access apparatus for accessing data of a third party platform, the apparatus comprising: the data token acquisition module and the docking module:
the data token acquisition module is used for acquiring a preset number of data tokens from a first interface of the third-party platform, and the data tokens have validity periods; recording the acquisition time of the data token, inserting the acquired data token into an ordered main queue of the REDIS service, and sequencing the data token according to the acquisition time of the data token;
the docking module is configured to preferentially fetch the data token with the previous acquisition time from the ordered main queue of the REDIS service when data access is required, and acquire docking data from a second interface of the third-party platform by using the fetched data token.
10. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method of any of claims 1 to 8 are implemented when the computer program is executed by the processor.
CN202111236064.8A 2021-10-22 2021-10-22 Data access method, device and computer equipment Active CN114124399B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111236064.8A CN114124399B (en) 2021-10-22 2021-10-22 Data access method, device and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111236064.8A CN114124399B (en) 2021-10-22 2021-10-22 Data access method, device and computer equipment

Publications (2)

Publication Number Publication Date
CN114124399A true CN114124399A (en) 2022-03-01
CN114124399B CN114124399B (en) 2024-04-16

Family

ID=80376683

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111236064.8A Active CN114124399B (en) 2021-10-22 2021-10-22 Data access method, device and computer equipment

Country Status (1)

Country Link
CN (1) CN114124399B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105450587A (en) * 2014-07-28 2016-03-30 国际商业机器公司 Network communication safety protection method and device
CN109672627A (en) * 2018-09-26 2019-04-23 深圳壹账通智能科技有限公司 Method for processing business, platform, equipment and storage medium based on cluster server
WO2019120217A1 (en) * 2017-12-19 2019-06-27 北京金山云网络技术有限公司 Token obtaining method and apparatus, server, user terminal, and medium
CN112367270A (en) * 2020-10-30 2021-02-12 锐捷网络股份有限公司 Method and equipment for sending message
CN112468409A (en) * 2020-11-24 2021-03-09 平安消费金融有限公司 Access control method, device, computer equipment and storage medium
CN112711235A (en) * 2020-12-29 2021-04-27 浙江中控技术股份有限公司 Method for self-adapting token scheduling time of industrial control system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105450587A (en) * 2014-07-28 2016-03-30 国际商业机器公司 Network communication safety protection method and device
WO2019120217A1 (en) * 2017-12-19 2019-06-27 北京金山云网络技术有限公司 Token obtaining method and apparatus, server, user terminal, and medium
CN109672627A (en) * 2018-09-26 2019-04-23 深圳壹账通智能科技有限公司 Method for processing business, platform, equipment and storage medium based on cluster server
CN112367270A (en) * 2020-10-30 2021-02-12 锐捷网络股份有限公司 Method and equipment for sending message
CN112468409A (en) * 2020-11-24 2021-03-09 平安消费金融有限公司 Access control method, device, computer equipment and storage medium
CN112711235A (en) * 2020-12-29 2021-04-27 浙江中控技术股份有限公司 Method for self-adapting token scheduling time of industrial control system

Also Published As

Publication number Publication date
CN114124399B (en) 2024-04-16

Similar Documents

Publication Publication Date Title
US9870268B2 (en) Virtual computing instance migration
EP3509270A1 (en) Data backup method and device, storage medium and electronic apparatus
CN109117153B (en) Application processing method, device, terminal and storage medium
CN111369334B (en) Salary calculation method and system
CN109842621A (en) A kind of method and terminal reducing token storage quantity
CN112837154A (en) Method and device for registering and executing timing intelligent contract in block chain
US9940157B2 (en) Computer readable medium, method, and management device for determining whether a virtual machine can be constructed within a time period determined based on historical data
CN114124399A (en) Data access method and device and computer equipment
CN112181645A (en) Resource scheduling method, device, equipment and storage medium
CN116701020A (en) Message delay processing method, device, equipment, medium and program product
CN111460256A (en) Webpage data crawling method and device, computer equipment and storage medium
CN111741141A (en) Method and system for realizing efficient IP proxy pool and data acquisition method
CN113961334B (en) Task processing method, device, equipment and storage medium
CN113157569A (en) Automatic testing method and device, computer equipment and storage medium
CN110442380B (en) Data preheating method and computing equipment
JPWO2017159522A1 (en) Electronic data inspection system, electronic data inspection method, and electronic data inspection program
CN109903022B (en) Resource distribution method, device, equipment and computer readable storage medium
CN113368494A (en) Cloud equipment distribution method and device, electronic equipment and storage medium
CN113031984A (en) Remote online upgrading method and device for application program of double-core intelligent ammeter management unit
JP4057045B1 (en) Misoperation judgment system
CN112135187B (en) Multimedia data generation method, intercepting method, device, equipment and storage medium
CN110460601B (en) Dependency package security detection method, dependency package security detection device and storage medium
CN111475322A (en) Method and device for positioning stuck thread, computer equipment and readable storage medium
CN113535780A (en) User request processing method and device, computer equipment and storage medium
CN117633329A (en) Data acquisition method and system for multiple data sources

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