Data storage method and device, storage medium and electronic device
By verifying the service requests of the terminal device and accessing the DB database and non-relational database, the problem of low efficiency in business data storage is solved and efficient data processing and storage is achieved.
Patent Information
- Application Number
- CN202111538981.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-15
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2041-12-15
AI Technical Summary
In the prior art, the storage efficiency of business data is low, especially when the database is upgraded or updated, it affects the stored procedures.
By verifying the service requests of the terminal device, accessing independent DB databases and non-relational databases, processing and storing business data respectively, using the microservice call interface and API interface for data interaction, realizing the storage of business processing results.
It improves the storage efficiency of business data, reduces the impact of database upgrades or updates on stored procedures, and improves the stability and efficiency of data processing.
Smart Images

Figure CN114254025B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communications, and in particular to a data storage method and device, a storage medium, and an electronic device. Background Art
[0002] Currently, with the explosive growth in business services across various industries, the amount of data generated by these services has increased exponentially, leading to an exponential increase in the difficulty of storing data for these services. In current data storage scenarios, different databases are configured for different business services to facilitate data exchange between these services and the database. Consequently, databases store vast amounts of business service data and related cached data. Due to the high coupling between business services and databases, upgrading or updating the database itself can impact the storage of business data, reducing storage efficiency.
[0003] In the related art, when processing business data, there is a problem of low storage efficiency of business data.
[0004] In the related art, when processing business data, there is a problem of low storage efficiency of business data, and no effective solution has been proposed yet. Summary of the Invention
[0005] The embodiments of the present application provide a data storage method and device, a storage medium, and an electronic device to at least solve the problem of low storage efficiency of business data when processing business data in the related art.
[0006] According to one embodiment of the embodiments of the present application, a data storage method is provided, including: verifying a service request sent by a terminal device; when it is determined that the service request passes the verification, accessing first data in a DB database and second data in a non-relational database, wherein the first data includes: first service data of a service service node, and the second data includes: second service data of the service service node and cache data generated when the service service node processes the second service data, and the DB database and the non-relational database are independent of each other; performing service processing on the first data and the second data to obtain service processing results, and storing the service processing results in the non-relational database.
[0007] In an exemplary embodiment, the business request is verified in the following manner: parsing the business request to obtain the token carried in the business request and the business authority in the business request; if the token carried in the business request passes the verification, if it is determined that the business authority exists in the whitelist, then the business request is determined to have passed the verification; or, if the token carried in the business request passes the verification, if it is determined that the business authority does not exist in the blacklist, then the business request is determined to have passed the verification.
[0008] In an exemplary embodiment, in the process of accessing first data in a DB database and second data in a non-relational database, the method further includes: determining a business type of the business request; determining business processing conditions for performing business processing on the first data and the second data based on the business type; when it is determined that the business processing conditions correspond to a first access interface of the DB database, connecting the first access interface through a microservice call interface of the business service node to establish an access channel between the business service node and the DB database; accessing the first data in the DB database based on the access channel; wherein the microservice call interface is a call interface of the business service node to the DB database.
[0009] In an exemplary embodiment, storing the business processing result in the non-relational database includes: connecting to the data storage interface of the non-relational database by using the microservice call interface; and storing the business processing result in the non-relational database through the data storage interface.
[0010] In an exemplary embodiment, the method further includes: in a case where it is determined that the business processing condition corresponds to a second access interface of the non-relational database, calling the application programming interface API of the non-relational database by using the external application service interface of the business service node, wherein the second access interface is a business data interface in the non-relational database; in a case where the API call is successful, accessing the second business data in the second data of the non-relational database through the API; in a case where it is determined that the result of accessing the second business data in the second data of the non-relational database through the API is a successful access, operating the second business data in the second data of the non-relational database according to the business request to obtain a business operation result; in a case where it is determined that the result of accessing the second business data in the second data of the non-relational database through the API is a failed access, accessing the first data in the DB database based on the access channel, and operating the first data in the DB database according to the business request to obtain the business operation result.
[0011] In an exemplary embodiment, storing the business processing result in the non-relational database includes: performing business processing on the obtained business operation result through the external application service of the business service node; and storing the business operation result after business processing in the non-relational database.
[0012] In an exemplary embodiment, after storing the business processing result in the non-relational database, the method further includes: determining a data standard for the business processing result to be sent to the terminal device; encapsulating the business processing result according to the data standard to obtain a business processing result that meets the data standard, and returning the business processing result that meets the data standard to the terminal device.
[0013] According to another embodiment of the embodiments of the present application, a data storage device is also provided, including: a verification module for verifying a service request sent by a terminal device; an access module for accessing first data in a DB database and second data in a non-relational database when it is determined that the service request passes the verification, wherein the first data includes: first business data of a business service node, and the second data includes: second business data of the business service node and cache data generated when the business service node processes the second business data, and the DB database and the non-relational database are independent of each other; a storage module for performing business processing on the first data and the second data, obtaining business processing results, and storing the business processing results in the non-relational database.
[0014] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned data storage method when running.
[0015] According to another aspect of an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the data storage method through the computer program.
[0016] In an embodiment of the present application, the business request sent by the terminal device is verified. When it is determined that the business request passes the verification, the first data in the DB database and the second data in the non-relational database are accessed, and business processing is performed on the first data and the second data to obtain a business processing result, and the business processing result is stored in the non-relational database. By adopting the above technical solution, the problem of low storage efficiency of business data when processing business data is solved, thereby improving the storage efficiency of business data. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0018] Figure 1 This is a hardware structure block diagram of a computer terminal of a data storage method according to an embodiment of the present application;
[0019] Figure 2 is a flowchart of a data storage method according to an embodiment of the present application;
[0020] Figure 3 is a schematic diagram of a data storage method according to an embodiment of the present application (1);
[0021] Figure 4 Schematic diagram (2) of a data storage method according to an embodiment of the present application;
[0022] Figure 5 This is a structural block diagram of a data storage device according to an embodiment of the present application. DETAILED DESCRIPTION
[0023] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0025] The method embodiments provided in the embodiments of the present application can be executed in a computer terminal or similar computing device. Taking running on a computer terminal as an example, Figure 1This is a hardware structure block diagram of a computer terminal of a data storage method according to an embodiment of the present application. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 Only one is shown) a processor 102 (the processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA and other processing devices) and a memory 104 for storing data. In an exemplary embodiment, the computer terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. For example, the computer terminal may also include Figure 1 More or fewer components than shown, or with Figure 1 Equivalent functions or comparisons shown Figure 1 Shown are different configurations with more functionality.
[0026] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the data storage method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implementing the above-mentioned method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0027] The transmission device 106 is used to receive or send data via a network. A specific example of the aforementioned network may include a wireless network provided by a computer terminal's communications provider. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0028] In this embodiment, a data storage method is provided, which is applied to the above-mentioned computer terminal. Figure 2 This is a flow chart of a data storage method according to an embodiment of the present application, which includes the following steps:
[0029] Step S202: Verify the service request sent by the terminal device;
[0030] It should be noted that the above-mentioned terminal devices may include mobile phones, tablets, Bluetooth headsets, wearable smart devices, etc., but are not limited to these.
[0031] Step S204: If it is determined that the service request passes verification, access first data in the database and second data in the non-relational database, wherein the first data includes first service data of the service node, and the second data includes second service data of the service node and cache data generated when the service node processes the second service data. The database and the non-relational database are independent of each other.
[0032] It should be noted that the above-mentioned non-relational databases may include Redis database, Membase, MongoDB, etc., but are not limited thereto.
[0033] It should be noted that the DB database can be understood as a data set organized according to a certain data model and stored in a secondary memory, for example, a relational database.
[0034] Step S206: performing business processing on the first data and the second data to obtain a business processing result, and storing the business processing result in the non-relational database.
[0035] Through the above steps, the business request sent by the terminal device is verified; when it is determined that the business request passes the verification, the first data in the DB database and the second data in the non-relational database are accessed, wherein the first data includes: the first business data of the business service node, and the second data includes: the second business data of the business service node and the cache data generated when the business service node processes the second business data, and the DB database and the non-relational database are independent of each other; business processing is performed on the first data and the second data to obtain business processing results, and the business processing results are stored in the non-relational database, which solves the problem of low storage efficiency of business data when processing business data in related technologies, thereby improving the storage efficiency of business data.
[0036] In an exemplary embodiment, in order to better understand how to verify the business request sent by the terminal device in the above-mentioned step S202, a technical solution is proposed that can verify the business request in the following manner, specifically: parse the business request to obtain the token carried in the business request and the business authority in the business request; when the token carried in the business request passes the verification, if it is determined that the business authority exists in the whitelist, then the business request is determined to have passed the verification; or, when the token carried in the business request passes the verification, if it is determined that the business authority does not exist in the blacklist, then the business request is determined to have passed the verification.
[0037] It should be noted that the service authority of the service request can be set according to the terminal type of the mobile terminal, or according to the service account that initiates the service request, and the set service authority can be stored in the whitelist.
[0038] It should be noted that the whitelist stores the service permissions that can be used by the service request, and the blacklist stores the service permissions that are prohibited from being used by the service request.
[0039] For example, in one embodiment, if the terminal type of the mobile terminal is determined to be a Bluetooth headset and the service request initiated by the mobile terminal is for a call, the service permission for the service request is set to voice call permission. In another embodiment, if the service account initiating the service request is determined to be a membership account and the service request initiated by the mobile terminal is for a phone charge, the service permission for the service request is set to phone charge discount permission.
[0040] In one embodiment, if it is determined that the terminal type of the mobile terminal is a Bluetooth headset, and the service request initiated by the mobile terminal is a call, and the service permission of the service request is a voice call permission, if it is determined that the service permission that can be used by the service request initiated by the Bluetooth headset is the voice call permission found in the whitelist, then the call initiated by the Bluetooth headset is determined to have passed verification. Alternatively, if it is determined that the service permission that is prohibited from being used by the service request initiated by the Bluetooth headset is the voice call permission found in the blacklist, then the call initiated by the Bluetooth headset is determined to have passed verification.
[0041] In an exemplary embodiment, in order to better understand how to access the first data in the DB database and the second data in the non-relational database in the above-mentioned step S204, a technical solution is proposed in the process of accessing the first data in the DB database and the second data in the non-relational database. The specific steps include: determining the business type of the business request; determining the business processing conditions for performing business processing on the first data and the second data based on the business type; when it is determined that the business processing conditions correspond to the first access interface of the DB database, connecting the first access interface through the microservice call interface of the business service node to establish an access channel between the business service node and the DB database; accessing the first data in the DB database based on the access channel; wherein, the microservice call interface is the call interface of the business service node to the DB database.
[0042] It should be noted that the business processing condition can be understood as the business processing time corresponding to the business type. The process of determining the business processing conditions for the first data and the second data based on the business type is as follows: setting the case where the business processing time corresponding to the business type is less than a first preset value as the business processing condition for the business processing of the second data, and accessing the non-relational database through the second access interface of the non-relational database. Setting the case where the business processing time corresponding to the business type is greater than the first preset value as the business processing condition for the business processing of the first data, and accessing the DB database through the first access interface of the DB database.
[0043] Among them, the above-mentioned first preset value can be 1 second, 1 hour, 1 day, 1 week, etc., and this application does not impose any restrictions on this.
[0044] Among them, in other embodiments, the non-relational database can be accessed through the microservice call interface of the above-mentioned business service node, and this application does not impose any restrictions on this.
[0045] In an exemplary embodiment, a technical solution is proposed for storing the business processing results in the non-relational database, and the specific steps include: connecting the data storage interface of the non-relational database by using the microservice call interface; storing the business processing results in the non-relational database through the data storage interface.
[0046] In an exemplary embodiment, a technical solution is also proposed, and the specific steps include: when it is determined that the business processing condition corresponds to the second access interface of the non-relational database, calling the application programming interface API of the non-relational database by using the external application service interface of the business service node, wherein the second access interface is the business data interface in the non-relational database; when the API call is successful, accessing the second business data in the second data of the non-relational database through the API; when it is determined that the result of accessing the second business data in the second data of the non-relational database through the API is a successful access, operating the second business data in the second data of the non-relational database according to the business request to obtain a business operation result; when it is determined that the result of accessing the second business data in the second data of the non-relational database through the API is a failed access, accessing the first data in the DB database based on the access channel, and operating the first data in the DB database according to the business request to obtain the business operation result.
[0047] It should be noted that the above API is an Application Programming Interface, which is a predefined application interface, such as a function interface.
[0048] In an exemplary embodiment, a technical solution is provided for storing the business processing results in the non-relational database, and the specific steps include: performing business processing on the obtained business operation results through the external application service of the business service node; and storing the business operation results after business processing in the non-relational database.
[0049] In an exemplary embodiment, a technical solution is provided for storing the business processing results in the non-relational database, and the specific steps include: determining the data standard of the business processing results sent to the terminal device; encapsulating the business processing results according to the data standard to obtain the business processing results that meet the data standard, and returning the business processing results that meet the data standard to the terminal device.
[0050] In one embodiment, the SpringBoot framework is used to build a basic database service, and the business service node and the database are registered with Nacos (Dynamic Naming and Configuration Service) to perform load balancing of business data. The interactive operation interface of the Redis database (equivalent to the above-mentioned second access interface) is added to Nacos, and the service call interface (equivalent to the above-mentioned external application service interface) connected to the Redis database is configured for the business service node. When a business request is received from a mobile terminal, the business request can be received through Jedis, and according to the business request, the service call interface is used to call the API of the Redis database to operate on the second data in the Redis database to obtain the business operation result. The obtained business operation result is then processed by the external application service of the business service node, and the processed business operation result is stored in the Redis database.
[0051] It should be noted that the above-mentioned SpringBoot framework can be understood as an open source application framework of the JAVA platform, which is used to provide a container with inversion of control characteristics.
[0052] It should be noted that the above-mentioned Nacos can be used to deploy multiple business service nodes, improve the stability of business services, and improve the efficiency of business services. Multiple service nodes and service interfaces that have been registered in Nacos can call data with each other through the interface defined by Feign (equivalent to the above-mentioned microservice call interface), or directly call the API interface for data call.
[0053] Among them, Feign is an interface declarative calling framework, which can be understood as a Web Service web service client. It is equivalent to providing a client interface that can implement API calling operations without calling the API interface. It is often used in the microservice (a service architecture for developing a single application) model to simplify the calling process between microservices and provide load balancing microservice functions.
[0054] It should be noted that the above-mentioned interactive operation interface of Redis may include a data acquisition interface, a data configuration interface, a data deletion interface, a data modification interface and operation interfaces for different data types, but is not limited thereto.
[0055] It should be noted that the above Jedis can be understood as a Java-based Redis client. The default package file format of the Redis database is jar (Java Archive). Users can use Jedis to write jar-format files to complete data operations in the Redis database.
[0056] Through the above embodiments, the Redis database can be accessed through Feign, or through the Redis database API, which decouples the business data processing process from the business data storage process and improves the storage efficiency of the business data.
[0057] In order to better understand the process of the above-mentioned data storage method, the implementation method flow of the above-mentioned data storage is described below in combination with an optional embodiment, but it is not used to limit the technical solution of the embodiment of this application.
[0058] In this embodiment, a data storage method is provided. Figure 3 Schematic diagram (1) of a data storage method according to an embodiment of the present application, such as Figure 3 As shown in the figure, a storage method for business data in a microservice model is proposed, which is as follows:
[0059] Among them, Figure 3 In the process, the service gateway and the distributed A service node jointly complete the functions of the above business service node.
[0060] Step S301: The client (installed in the above-mentioned mobile terminal) sends a request (equivalent to the above-mentioned service request).
[0061] Step S302: The service gateway intercepts the request, performs token verification and permission list verification, and finally forwards the request.
[0062] It should be noted that the aforementioned permission list includes both a blacklist and a whitelist. After the token is verified, the permission list is verified. That is, if it is determined that the service type corresponding to the request is on the whitelist, the request is considered to have passed verification. Alternatively, if it is determined that the service type corresponding to the request is not on the blacklist, the request is considered to have passed verification.
[0063] Step S303: The service gateway makes a data call through the interface defined by Fegin (equivalent to the above-mentioned microservice call interface) and accesses the distributed A service node (equivalent to the above-mentioned business service node).
[0064] Step S304: the distributed A service node accesses the business data of the distributed A service node stored in the DB database.
[0065] Step S305: The DB database returns the business data corresponding to the request.
[0066] Step S306: Perform business processing on the obtained business data.
[0067] For example, if the request is for a voice call, a call record is generated based on the business data after the call ends.
[0068] Step S307: Fegin inter-service call, that is, the distributed A service node uses the interface defined by Fegin to access the distributed Redis database, stores the processing results of the business data in the distributed Redis database, and stores the cache data generated when processing the business data in the distributed Redis database.
[0069] Step S308: The distributed Redis database returns the storage result to the distributed A service node.
[0070] Step S309: The distributed A service node returns the business processing result to the service gateway.
[0071] Step S310: The service gateway encapsulates the business processing results.
[0072] Step S311: The service gateway returns the encapsulated business processing result to the client.
[0073] Through the above steps, business data can be processed and stored simultaneously. Since the Redis database stores both business data and cached data from processing it, business data can be processed and stored either through the Redis database or by combining a database with the Redis database. Furthermore, when targeting a microservices model, accessing business data through Feign calls can speed up access to business data and improve storage efficiency.
[0074] In this embodiment, a data storage method is provided. Figure 4 Schematic diagram (II) of the data storage method according to an embodiment of the present application, such as Figure 4 As shown, by providing the Redis database API to the application service node (equivalent to the business service node mentioned above), the Redis database can be remotely called using the Http protocol through the external application service of the application service node. Figure 4 The application service node in Figure 3 The functions of the distributed A service nodes in the same way are used to implement the functions of the above business service nodes. Figure 4 The Redis database in Figure 3The distributed Redis database in has the same functions and is used to implement the functions of the above-mentioned non-relational database.
[0075] Steps S401-S402, steps S404-S406, steps S408-S411 are the same as above Figure 3 Steps S301-S302, S304-S306, and S308-S311 are similar and will not be repeated in this application.
[0076] Among them, Figure 4 In the service gateway and application service node, the functions of the above business service node are completed together.
[0077] The remaining different steps are described below:
[0078] Step S403: The service gateway accesses the application service node according to the request and calls the application service provided by the application service node.
[0079] Step S407: The application service node remotely calls the API of the Redis database through the HTTP protocol (equivalent to the above-mentioned external application service interface) and accesses the non-relational database through the API
[0080] Through the above steps, the business data storage process can be completed while the business data is being processed, thereby improving the stability of the business data processing and the storage efficiency of the business data.
[0081] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0082] Figure 5 This is a structural block diagram of a data storage device according to an embodiment of the present application. Figure 5 Shown, including:
[0083] Verification module 52, used to verify the service request sent by the terminal device;
[0084] It should be noted that the above-mentioned terminal devices may include mobile phones, tablets, Bluetooth headsets, wearable smart devices, etc., but are not limited to these.
[0085] An access module 54 is configured to, upon determining that the service request passes verification, access first data in a database and second data in a non-relational database, wherein the first data includes first service data of a service service node, and the second data includes second service data of the service service node and cached data generated when the service service node processes the second service data, and the database and the non-relational database are independent of each other;
[0086] It should be noted that the above-mentioned non-relational databases may include Redis database, Membase, MongoDB, etc., but are not limited thereto.
[0087] The storage module 56 is configured to perform business processing on the first data and the second data, obtain business processing results, and store the business processing results in the non-relational database.
[0088] It should be noted that the DB database can be understood as a data set organized according to a certain data model and stored in a secondary memory, for example, a relational database.
[0089] The above-mentioned device verifies the service request sent by the terminal device; when it is determined that the service request passes the verification, the first data in the DB database and the second data in the non-relational database are accessed, wherein the first data includes: the first service data of the service node, and the second data includes: the second service data of the service node and the cache data generated when the service node processes the second service data, and the DB database and the non-relational database are independent of each other; service processing is performed on the first data and the second data to obtain a service processing result, and the service processing result is stored in the non-relational database, which solves the problem of low storage efficiency of service data when processing service data in the related art, thereby improving the storage efficiency of service data.
[0090] Optionally, in an exemplary embodiment, the above-mentioned verification module is also used to parse the business request to obtain the token carried in the business request and the business authority in the business request; when the token carried in the business request passes the verification, if it is determined that the business authority exists in the whitelist, then the business request is determined to have passed the verification; or, when the token carried in the business request passes the verification, if it is determined that the business authority does not exist in the blacklist, then the business request is determined to have passed the verification.
[0091] It should be noted that the service authority of the service request can be set according to the terminal type of the mobile terminal, or according to the service account that initiates the service request, and the set service authority can be stored in the whitelist.
[0092] It should be noted that the whitelist stores the service permissions that can be used by the service request, and the blacklist stores the service permissions that are prohibited from being used by the service request.
[0093] For example, in one embodiment, if the terminal type of the mobile terminal is determined to be a Bluetooth headset and the service request initiated by the mobile terminal is for a call, the service permission for the service request is set to voice call permission. In another embodiment, if the service account initiating the service request is determined to be a membership account and the service request initiated by the mobile terminal is for a phone charge, the service permission for the service request is set to phone charge discount permission.
[0094] In one embodiment, if it is determined that the terminal type of the mobile terminal is a Bluetooth headset, and the service request initiated by the mobile terminal is a call, and the service permission of the service request is a voice call permission, if it is determined that the service permission that can be used by the service request initiated by the Bluetooth headset is the voice call permission found in the whitelist, then the call initiated by the Bluetooth headset is determined to have passed verification. Alternatively, if it is determined that the service permission that is prohibited from being used by the service request initiated by the Bluetooth headset is the voice call permission found in the blacklist, then the call initiated by the Bluetooth headset is determined to have passed verification.
[0095] Optionally, in an exemplary embodiment, the above-mentioned access module is also used to determine the business type of the business request; determine the business processing conditions for performing business processing on the first data and the second data based on the business type; when it is determined that the business processing conditions correspond to the first access interface of the DB database, connect the first access interface through the microservice call interface of the business service node to establish an access channel between the business service node and the DB database; access the first data in the DB database based on the access channel; wherein, the microservice call interface is the call interface of the business service node to the DB database.
[0096] It should be noted that the business processing condition can be understood as the business processing time corresponding to the business type. The process of determining the business processing conditions for the first data and the second data based on the business type is as follows: setting the case where the business processing time corresponding to the business type is less than a first preset value as the business processing condition for the business processing of the second data, and accessing the non-relational database through the second access interface of the non-relational database. Setting the case where the business processing time corresponding to the business type is greater than the first preset value as the business processing condition for the business processing of the first data, and accessing the DB database through the first access interface of the DB database.
[0097] Among them, the above-mentioned first preset value can be 1 second, 1 hour, 1 day, 1 week, etc., and this application does not impose any restrictions on this.
[0098] Among them, in other embodiments, the non-relational database can be accessed through the microservice call interface of the above-mentioned business service node, and this application does not impose any restrictions on this.
[0099] Optionally, in an exemplary embodiment, the above-mentioned data storage device also includes a connection module for connecting to the data storage interface of the non-relational database by using the microservice call interface; and storing the business processing results in the non-relational database through the data storage interface.
[0100] Optionally, in an exemplary embodiment, the data storage device further includes a calling module for calling the application programming interface API of the non-relational database by using the external application service interface of the business service node when it is determined that the business processing condition corresponds to the second access interface of the non-relational database, wherein the second access interface is the business data interface in the non-relational database; when the API call is successful, accessing the second business data in the second data of the non-relational database through the API; when it is determined that the result of accessing the second business data in the second data of the non-relational database through the API is a successful access, performing an operation on the second business data in the second data of the non-relational database according to the business request to obtain a business operation result; when it is determined that the result of accessing the second business data in the second data of the non-relational database through the API is a failed access, accessing the first data in the DB database based on the access channel, and performing an operation on the first data in the DB database according to the business request to obtain the business operation result.
[0101] It should be noted that the above API is an Application Programming Interface, which is a predefined application interface, such as a function interface.
[0102] Optionally, in an exemplary embodiment, the data storage device further includes a processing module for performing business processing on the obtained business operation results through the external application service of the business service node; and storing the business operation results after business processing in the non-relational database.
[0103] Optionally, in an exemplary embodiment, the above-mentioned data storage device also includes an encapsulation module for determining the data standard of the business processing results sent to the terminal device; encapsulating the business processing results according to the data standard to obtain business processing results that meet the data standard, and returning the business processing results that meet the data standard to the terminal device.
[0104] An embodiment of the present application further provides a storage medium, which includes a stored program, wherein the program executes any of the above methods when it is run.
[0105] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:
[0106] S1, verify the service request sent by the terminal device;
[0107] S2: If it is determined that the service request passes verification, access first data in a database and second data in a non-relational database, wherein the first data includes first service data of a service service node, and the second data includes second service data of the service service node and cache data generated when the service service node processes the second service data, and the database and the non-relational database are independent of each other.
[0108] S3: Perform business processing on the first data and the second data to obtain a business processing result, and store the business processing result in the non-relational database.
[0109] An embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0110] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0111] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:
[0112] S1, verify the service request sent by the terminal device;
[0113] S2: If it is determined that the service request passes verification, access first data in a database and second data in a non-relational database, wherein the first data includes first service data of a service service node, and the second data includes second service data of the service service node and cache data generated when the service service node processes the second service data, and the database and the non-relational database are independent of each other.
[0114] S3: Perform business processing on the first data and the second data to obtain a business processing result, and store the business processing result in the non-relational database.
[0115] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0116] Optionally, specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0117] Obviously, those skilled in the art should understand that the modules or steps of the present application described above can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices. Alternatively, they can be implemented using program code executable by the computing device, so that they can be stored in a storage device and executed by the computing device. In some cases, the steps shown or described can be performed in a different order than herein, or they can be made into separate integrated circuit modules, or multiple modules or steps can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0118] The above description is merely a preferred embodiment of the present application and is not intended to limit the present application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application shall be included within the scope of protection of the present application.
Claims
1. A data storage method, characterized in that: include: Verify the service request sent by the terminal device; If it is determined that the service request passes verification, accessing first data in a relational database and second data in a non-relational database, wherein the first data includes: first service data of a service service node, and the second data includes: second service data of the service service node and cache data generated when the service service node processes the second service data, and the relational database and the non-relational database are independent of each other; Performing business processing on the first data and the second data to obtain a business processing result, and storing the business processing result in the non-relational database; In the process of accessing the first data in the relational database and the second data in the non-relational database, the method further includes: Determining a service type of the service request; and determining a service processing condition for performing service processing on the first data and the second data based on the service type; When it is determined that the business processing condition corresponds to a first access interface of the relational database, connecting the first access interface through a microservice call interface of the business service node to establish an access channel between the business service node and the relational database; Accessing the first data in the relational database based on the access channel; wherein the microservice calling interface is a calling interface of the business service node facing the relational database; The business processing condition represents the business processing time corresponding to the business type. The process of determining the business processing conditions for business processing of the first data and the second data based on the business type is: setting the situation where the business processing time corresponding to the business type is less than the first preset value as the business processing condition for business processing of the second data, and accessing the non-relational database through the second access interface of the non-relational database; setting the situation where the business processing time corresponding to the business type is greater than the first preset value as the business processing condition for business processing of the first data, and accessing the relational database through the first access interface of the relational database.
2. The data storage method according to claim 1, wherein: Verify the service request in the following ways: Parsing the service request to obtain the token carried in the service request and the service authority in the service request; In a case where the token carried in the service request passes the verification, if it is determined that the service permission exists in the whitelist, then it is determined that the service request passes the verification; Alternatively, when the token carried in the service request passes the verification, if it is determined that the service authority does not exist in the blacklist, it is determined that the service request passes the verification.
3. The data storage method according to claim 1, wherein: Storing the business processing result in the non-relational database includes: Connecting to the data storage interface of the non-relational database by using the microservice call interface; The business processing result is stored in the non-relational database through the data storage interface.
4. The data storage method according to claim 1, wherein: The method further comprises: In a case where it is determined that the business processing condition corresponds to a second access interface of the non-relational database, calling an application programming interface API of the non-relational database by using an external application service interface of the business service node, wherein the second access interface is a business data interface in the non-relational database; When the API call is successful, access the second business data in the second data of the non-relational database through the API; If it is determined that the result of accessing the second business data in the second data of the non-relational database through the API is successful, operating the second business data in the second data of the non-relational database according to the business request to obtain a business operation result; When it is determined that the result of accessing the second business data in the second data of the non-relational database through the API is an access failure, the first data in the relational database is accessed based on the access channel, and the first data in the relational database is operated according to the business request to obtain the business operation result.
5. The data storage method according to claim 4, characterized in that: Storing the business processing result in the non-relational database includes: Performing business processing on the obtained business operation results through the external application service of the business service node; The business operation results after business processing are stored in the non-relational database.
6. The data storage method according to claim 1, wherein: After storing the business processing result in the non-relational database, the method further includes: Determining a data standard for a service processing result sent to the terminal device; The service processing result is encapsulated according to the data standard to obtain a service processing result that meets the data standard, and the service processing result that meets the data standard is returned to the terminal device.
7. A data storage device, characterized in that include: A verification module, used to verify the service request sent by the terminal device; an access module, configured to, upon determining that the service request passes verification, access first data in a relational database and second data in a non-relational database, wherein the first data includes first service data of a service service node, and the second data includes second service data of the service service node and cached data generated when the service service node processes the second service data, and the relational database and the non-relational database are independent of each other; a storage module, configured to perform business processing on the first data and the second data, obtain business processing results, and store the business processing results in the non-relational database; The access module is further configured to determine a business type of the business request; determine a business processing condition for performing business processing on the first data and the second data based on the business type; if it is determined that the business processing condition corresponds to a first access interface of the relational database, connect the first access interface via a microservice call interface of the business service node to establish an access channel between the business service node and the relational database; and access the first data in the relational database based on the access channel; wherein the microservice call interface is a call interface of the business service node to the relational database; The business processing condition represents the business processing time corresponding to the business type, and the device is also used to implement the following process of determining the business processing conditions for business processing of the first data and the second data based on the business type: setting the situation where the business processing time corresponding to the business type is less than the first preset value as the business processing condition for business processing of the second data, and accessing the non-relational database through the second access interface of the non-relational database; setting the situation where the business processing time corresponding to the business type is greater than the first preset value as the business processing condition for business processing of the first data, and accessing the relational database through the first access interface of the relational database.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 6 when executed.
9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 6 through the computer program.
Citation Information
Patent Citations
Database management method based on NoSQL
CN107436903A
Security authentication method and device and storage medium
CN113315637A