Data processing methods, apparatus, electronic devices and storage media
Patent Information
- Application Number
- CN202211286617.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-20
- Publication Date
- 2026-09-01
- Estimated Expiration
- 2042-10-20
AI Technical Summary
很多用户可能共用一个数据库连接信息,但是不同用户的使用需求可能是不同的,如所需使用的数据库信息或密码等,因此,这种方式是不能满足用户使用需求的
[0018]本发明实施例的技术方案,通过在接收到数据请求时,确定数据请求中的请求参数;若目标缓存中包括与请求参数相对应的数据库接口数据,且接收到数据请求的接收时刻与上一历史接收时刻之间的间隔时长在预设时长范围之内,则确定与数据库接口数据相对应的数据库驱动和目标数据库处于连接状态;其中,目标缓存与用户标识相对应;在连接状态下,将数据请求所对应的数据库指令发送至目标数据库,以基于目标数据库反馈与数据库指令对应的目标反馈数据,解决了现有技术中不同用户共用同一数据库信息,不能满足用户使用需求的问题,实现了通过为用户标识设置对应的目标缓存,保证不同用户之间的缓存空间相互独立,不受干扰,缓存空间中可保存各自对应的数据库信息,满足了用户的使用需求,同时可实现动态管理目标缓存中的数据库接口数据的技术效果。
Smart Images

Figure CN115437716B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer processing technology, and in particular to a data processing method, apparatus, electronic device, and storage medium. Background Technology
[0002] Currently, the Spring Boot framework is the mainstream technology framework for backend application development. This framework uses JDBC (Java Database Connectivity) to connect to the database. In order to better connect to the database, database information needs to be configured.
[0003] Regarding JDBC connection management, existing database connection technologies typically require configuring one or more databases before application startup. A Spring Boot application only needs to configure one or a few fixed databases, and JDBC connections to these databases are usually managed using a DataSource approach. Different users on the Spring Boot application can only use a fixed database and JDBC connection. Many users may share the same database connection information, but different users may have different needs, such as the required database information or password. Therefore, this approach cannot meet the needs of all users. Summary of the Invention
[0004] This invention provides a data processing method, apparatus, electronic device, and storage medium to allocate corresponding caches to different users, so as to store the database information required by each user in the cache, thereby achieving the effect of meeting the user's needs.
[0005] According to one aspect of the present invention, a data processing method is provided, the method comprising:
[0006] Upon receiving a data request, the request parameters in the data request are determined; wherein, the request parameters include a user identifier and a database interface identifier;
[0007] If the target cache includes database interface data corresponding to the request parameters, and the interval between the time of receiving the data request and the previous historical time of receiving the data is within a preset time range, then it is determined that the database driver corresponding to the database interface data and the target database are in a connected state; wherein, the target cache corresponds to the user identifier;
[0008] In the connected state, the database instruction corresponding to the data request is sent to the target database, so as to provide target feedback data corresponding to the database instruction based on the target database.
[0009] According to another aspect of the present invention, a data processing apparatus is provided, the apparatus comprising:
[0010] The request parameter determination module is used to determine the request parameters in the data request when a data request is received; wherein the request parameters include a user identifier and a database interface identifier;
[0011] The interface data determination module is used to determine that the database driver corresponding to the database interface data and the target database are in a connected state if the target cache includes database interface data corresponding to the request parameters, and the interval between the receiving time of the data request and the previous historical receiving time is within a preset time range; wherein, the target cache corresponds to the user identifier;
[0012] The database instruction sending module is used to send the database instruction corresponding to the data request to the target database in the connected state, so as to provide target feedback data corresponding to the database instruction based on the target database.
[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0014] At least one processor; and
[0015] A memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the data processing method according to any embodiment of the present invention.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the data processing method described in any embodiment of the present invention.
[0018] The technical solution of this invention, upon receiving a data request, determines the request parameters in the data request; if the target cache includes database interface data corresponding to the request parameters, and the interval between the receiving time of the data request and the previous historical receiving time is within a preset time range, then it is determined that the database driver corresponding to the database interface data and the target database are in a connected state; wherein, the target cache corresponds to the user identifier; in the connected state, the database instruction corresponding to the data request is sent to the target database, and the target feedback data corresponding to the database instruction is fed back from the target database. This solves the problem in the prior art where different users share the same database information, which cannot meet user needs. It achieves the technical effect of dynamically managing the database interface data in the target cache by setting a corresponding target cache for the user identifier, ensuring that the cache space of different users is independent and undisturbed, and that the cache space can store their respective corresponding database information, thus meeting user needs.
[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a flowchart of a data processing method provided according to Embodiment 1 of the present invention;
[0022] Figure 2 This is a schematic diagram of the data processing system provided in Embodiment 2 of the present invention;
[0023] Figure 3 This is a schematic diagram of the data processing method provided in Embodiment 2 of the present invention;
[0024] Figure 4 This is a schematic diagram of the structure of a data processing device according to Embodiment 3 of the present invention;
[0025] Figure 5 This is a schematic diagram of the structure of an electronic device that implements the data processing method of the present invention. Detailed Implementation
[0026] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0028] Example 1
[0029] Figure 1 This is a flowchart of a data processing method according to Embodiment 1 of the present invention. This embodiment is applicable to situations involving database connections. The method can be executed by a data processing device, which can be implemented in hardware and / or software and can be configured in a computing device. Figure 1 As shown, the method includes:
[0030] S110. Upon receiving a data request, determine the request parameters in the data request.
[0031] A data request can be an instruction or code that requests data. For example, it might request the use of system resources, access a database, or request CRUD operations on data within the database. Data requests are related to user needs and can be generated based on user actions on system pages. The data request executes logic to obtain data that meets the user's requirements. Request parameters can be used to characterize the request's features, such as user identifiers and database interface identifiers. The user identifier (e.g., a user ID) represents the user's uniqueness, while the database interface identifier represents the uniqueness of the database connection information. A database connection can be understood as interface data that grants access to the database, such as JDBC.
[0032] In practical applications, when a user triggers an operation on a control on a system page, it can be considered that a data request initiated by the user's client has been received. At this time, request parameters such as the user identifier and database interface identifier in the data request are extracted so that subsequent determinations can be made based on the request parameters to determine whether to connect to the database. When connecting to the database, data processing is completed.
[0033] To ensure the timeliness and accuracy of database connection checks, interception techniques can be used to intercept data requests and perform subsequent database connection checks. Specifically, determining the request parameters in a received data request can be achieved by: receiving data requests generated by triggering operations on the front-end application page using an interceptor; parsing the data request to obtain the request parameters carried on it.
[0034] Interceptors can parse request parameters. The front-end application page can be the system's front-end display interface, and its system application structure can be Spring Boot. The triggering operation can be at least one of click, touch, swipe, and drag.
[0035] In this embodiment, a data request can be generated when a user clicks a data request control on the front-end application page. When the data request enters the application server, an interceptor can be invoked to intercept it. After obtaining the data request, it is parsed to obtain the request parameters carried within. For example, when a user makes a request on the front-end application page, the data request reaches the Spring Boot application. The data request first enters the connection management interceptor, which parses the request parameters in the data request. Before the request reaches other components of the application, the interceptor determines whether a database connection exists in the user's memory space.
[0036] It should be noted that, to ensure the independence of database connection information among users and to improve the convenience and security of maintaining database connection information for different users, corresponding memory spaces can be allocated for different users in the application system, and their respective database connection information can be stored in these memory spaces. This allows the system to locate the memory space corresponding to the user initiating the request after determining the request parameters, and then determine whether to connect to the database based on the information stored in that memory space.
[0037] Optionally, upon receiving a data request, after determining the request parameters in the data request, the method further includes: determining the target cache corresponding to the user identifier from at least one independent cache on the server based on mapping technology.
[0038] The server can have at least one independent cache, each corresponding to a user, and storing the database connection information for that user. For example, user A's independent cache 'a' stores JDBC1 corresponding to user A, and a mapping relationship can be established between user A (as user identifier), independent cache 'a', and JDBC1 (as interface identifier). Consequently, multiple mapping relationships can be obtained.
[0039] In practical applications, after obtaining the user identifier in the request parameters, the independent cache corresponding to the user identifier can be determined based on mapping technology, and the independent cache can be used as the target cache so that the database connection information can be determined from the target cache in the future.
[0040] S120. If the target cache includes database interface data corresponding to the request parameters, and the interval between the time of receiving the data request and the previous historical time of receiving the data is within the preset time range, then it is determined that the database driver corresponding to the database interface data and the target database are in a connected state.
[0041] The target cache corresponds to the user identifier and stores the database connection information for that user, i.e., the database interface data. Database interface data refers to the interface data that grants access to the database. Different types of databases may require different database connection information; for example, MySQL may require JDBC1, while Oracle may require JDBC2. The database interface data may include the user's username, password, URL (defining the protocol, subprotocols, data source identifier, etc., used to connect to the database), and the driver required to connect to the database.
[0042] In Java applications, the database interface data can be JDBC, which is a program interface in the Java language used to standardize access between Java applications and databases. The preset duration can be either 10 minutes or 30 minutes, with no fixed limit. A database driver refers to a program that can operate on a database. The target database can be a location used to manage data.
[0043] In practical applications, after identifying the target cache, it can be determined whether the target cache contains database interface data corresponding to the request parameters. Specifically, it can be determined whether database interface data corresponding to the database interface identifier exists. If it does, it can be assumed that the database driver corresponding to the database interface data has connected with the target database within a certain period of time. If the interval between the received time of the data request and the historical received time of the previous request is within a preset time range, it can be assumed that the database driver and the target database have not been disconnected periodically, i.e., they are in a connected state. To reduce load consumption, this technical solution periodically disconnects the database connection. For example, if no data request is received from the front end for a relatively long period of time, it can be assumed that there is no need for database access, and the connection with the database can be disconnected.
[0044] It should be noted that, to alleviate memory pressure, database interface data in the target cache can also be deleted periodically. For example, when disconnecting from the database, the database interface data can be deleted from the target cache. That is, for a period of time after the database connection is successful, the database interface data can be temporarily stored in the target cache. If the database interface data corresponding to the request parameters is detected in the target cache, it is considered that the database driver and the target database are in a connected state. Alternatively, to meet user needs, the database interface data can be temporarily retained when disconnecting from the database. If no data request is received from the front end within a period of time after disconnecting from the database, the database interface data can be deleted from the target cache.
[0045] Optionally, if the target cache includes database interface data corresponding to the request parameters, and the interval between the time of receiving the data request and the previous historical time of receiving the data is outside the preset time range, then it is determined that the database driver corresponding to the database interface data and the target database are in a disconnected state; in the disconnected state, the database interface data is loaded into the database driver so that the database driver can connect to the target database.
[0046] In practical applications, if the target cache includes database interface data corresponding to the database interface identifier, and the interval between the time of receiving the data request and the previous historical time of receiving the data is outside the preset time range, it can be assumed that no data request has been received within the preset time from the previous historical time of receiving the data. The database driver and the target database will automatically disconnect, that is, the database driver and the target database are in a disconnected state. At this time, the database interface data can be called to load the database interface data into the database driver, so that the database driver can connect to the target database to complete the data processing logic in the connected state.
[0047] It's important to note that when configuring the corresponding database interface data for users, the configuration data is backed up and stored in a fixed location. If the target cache does not include the database interface data corresponding to the request parameters, it indicates that the database interface data in the target cache may have been cleared or may not have been configured. In this case, the database interface data corresponding to the request parameters can be retrieved from the fixed location, and if it exists, it can be used.
[0048] Optionally, if the target cache does not contain database interface data corresponding to the request parameters, the database connection record table is retrieved; if the database connection record table contains target database interface information corresponding to the request parameters, the target database interface information is cached in the target cache and loaded into the corresponding database driver so that the database driver can connect to the target database.
[0049] The database connection record table includes database interface information corresponding to at least one requesting user identifier. The requesting user identifier is used to uniquely identify the user who has requested database interface information, which is the database connection information.
[0050] It should be noted that when configuring the corresponding database connection information for users, the database connection information can be recorded as database interface information in the database connection record table, and a correspondence between the database interface information and the user identifier can be created.
[0051] In practical applications, if the target cache does not contain database interface data corresponding to the request parameters, the database connection record table is retrieved to determine if it contains database interface information corresponding to the user identifier. If it does, this database interface information is used as the target database interface information. This target database interface information can then be cached as database interface data in the target cache and loaded into the corresponding database driver. The database driver can then connect to the target database based on the target database interface information, ensuring a connection between the driver and the target database. For example, if the target cache session in the Spring Boot server's memory does not cache the database connection corresponding to the database interface identifier, the database connection record table is queried to determine if the connection exists. If it does, the corresponding JDBC connection is created and cached in the target cache session.
[0052] Optionally, after retrieving the database connection record table, if the database connection record table does not include the target database interface information corresponding to the request parameters, an exception message will be generated and displayed.
[0053] In practical applications, if the database connection record table does not contain the target database interface information corresponding to the request parameters, it indicates that the database interface information has not been configured. In this case, an exception message can be generated and displayed to the user on the front-end page, indicating that the database cannot return the data corresponding to the data request. To improve the convenience of database connection maintenance for users, exception messages can also be stored in the log, allowing maintenance personnel to maintain user information based on the information in the log. For example, if the target cache session in the Spring Boot server's memory does not cache the database connection, and the connection record table also does not contain information about that connection, an exception message is returned.
[0054] It should be noted that, in order to further improve the convenience of data connection maintenance and meet user needs, modification information that modifies the data connection information can be received, so that the corresponding data connection information can be updated based on the modification information.
[0055] Optionally, the data processing method further includes: upon receiving an interface modification request, determining the modification parameters in the interface modification request; updating the database interface data in the independent cache corresponding to the user identifier to be applied based on the modification parameters; and / or updating the database interface information corresponding to the user identifier to be applied in the database connection record table based on the modification parameters.
[0056] An interface modification request can be understood as an instruction or code to modify database interface data. The modification parameters include the user identifier to be applied, the database interface identifier to be modified, the user attribute information to be modified, the database information to be modified, and / or the connection driver information to be modified. The user attribute information to be modified refers to the user attributes that need to be changed, such as username and password. The database information to be modified can be the database type and database name. The connection driver information to be modified refers to the database connection driver that needs to be modified. The user identifier to be applied is the user identifier that needs to be used to update the database connection information corresponding to that user identifier.
[0057] In practical applications, when a user edits and uploads changes to data connection information within the system, it can be considered that the system has received an interface modification request. This request can then be parsed to obtain the modification parameters. Furthermore, based on the user identifier to be modified within the modification parameters, the independent cache that needs to be modified—that is, the independent cache that has a mapping relationship with the user identifier—can be located. Then, based on the database interface identifier to be modified, the corresponding database interface data can be found, and the database interface data can be updated accordingly based on the content in the modification parameters. Alternatively, the database interface information corresponding to the user identifier in the database connection record table can be updated based on the content in the modification parameters.
[0058] For example, database information can be added or modified according to the user's situation. For instance, user A can directly and dynamically modify the database information and JDBC database connection information in user A's independent cached Session in the code logic.
[0059] S130. In the connected state, the database instruction corresponding to the data request is sent to the target database, so as to provide target feedback data corresponding to the database instruction based on the feedback from the target database.
[0060] Database commands can be instructions that cause the database to perform corresponding functions, such as SQL statements.
[0061] Specifically, when the database driver corresponding to the database interface data and the target database are in a connected state, corresponding database commands can be generated based on the data request. For example, if the data request is to delete data A, then the database command can be a `DELETE` statement to delete data A. Furthermore, the database command can be sent to the target database, so that the target database, upon receiving the command, executes it and processes it to obtain the corresponding target feedback data. For instance, if the target cache Session in the Spring Boot server's memory contains cached database interface data, or if the interceptor can successfully establish a JDBC connection, then the JDBC connection is used for processing by the business logic component. The business logic component can return a success message or an exception message based on the execution status of the business logic.
[0062] It should be noted that, to improve data processing security and ensure database security, database interface data can be deleted from the target cache and database connection record table when abnormal data is detected. For example, if an abnormal message (such as a malformed message) is detected in a data request, it can be considered as abnormal data; or, if a network attack occurs during data transmission and abnormal network attacks the database, it can be considered as abnormal data detection. In this case, the database driver and target database can be automatically shut down, and the database interface data can be deleted (i.e., the memory of the independent cache is released).
[0063] The technical solution of this embodiment determines the request parameters in the data request when a data request is received; if the target cache includes database interface data corresponding to the request parameters, and the interval between the time of receiving the data request and the previous historical time of receiving the data is within a preset time range, then it is determined that the database driver corresponding to the database interface data and the target database are in a connected state; wherein, the target cache corresponds to the user identifier; in the connected state, the database instruction corresponding to the data request is sent to the target database, and the target feedback data corresponding to the database instruction is fed back by the target database. This solves the problem in the prior art where different users share the same database information, which cannot meet the user's needs. It achieves the technical effect of dynamically managing the database interface data in the target cache by setting a corresponding target cache for the user identifier, ensuring that the cache space of different users is independent and not interfered with, and that the cache space can store the corresponding database information of each user, thus meeting the user's needs. At the same time, it can achieve the technical effect of dynamically managing the database interface data in the target cache.
[0064] Example 2
[0065] As an optional embodiment of the above embodiments, Figure 2 This is a schematic diagram of the data processing system provided according to Embodiment 2 of the present invention. For details, please refer to the following specific content.
[0066] See Figure 2This invention's technical solution manages the lifecycle of JDBC database connections using server-side HttpSession. The HttpSession space can be managed independently within the Spring Boot application and remains independent of other application components (such as Controller, Service, and DAO components) during Spring Boot runtime. For example, the HttpSession space can include multiple independent cached sessions for users, such as independent caches for user A, user B, user C, etc. Each independent cache can store its own corresponding database information and database connection. When a user initiates a request to Spring Boot using a client, the data request is received by an interceptor before reaching other components of the application. The database connection interceptor finds the independent cache corresponding to the user ID in the data request, determines whether the independent cache contains database interface data (i.e., a database connection) corresponding to the database interface identifier in the data request, and if a database connection exists, the data request is sent to other components of the application, thus enabling database access. If the database interface data corresponding to the database interface identifier does not exist in the independent cache, it can be determined whether the database interface data exists in the database connection record table. If so, the database interface data is created to enable the database driver to connect to the database and access the database normally. This technical solution utilizes Spring Boot's database connection interceptor to manage the lifecycle. The database connection interceptor manages all database information and JDBC connection information in the current HttpSession's independent memory and ensures the correctness of the JDBC connection state throughout the user request-response lifecycle. For example, when a user makes a request, before the data request reaches other components of the application, the database connection interceptor will remove abnormal database connections and close timed-out database connections through code logic, ensuring the correctness of the HttpSession state and JDBC connection, thus ensuring user independence. Simultaneously, users can directly and dynamically modify the database information and JDBC database connection in their own dedicated independent cache session within the code logic. It should be noted that interceptors can maintain the database information and JDBC connection in the server-side session memory before other Spring Boot components work, and then execute the code logic of the user component, ultimately enabling the use of database information and JDBC connection on demand in the code logic of the user component.
[0067] To enable those skilled in the art to further understand the technical solutions of the embodiments of the present invention, specific application scenario examples are provided. For details, please refer to... Figure 3When a data request arrives at the Spring Boot application, it first enters the Spring Boot connection management interceptor. The interceptor checks if the target cache session in the Spring Boot server's memory contains a cached database connection. If the target cache does not cache the connection, it checks the database connection record table for information about the connection. If the database connection record table contains the connection, it creates the corresponding JDBC connection and caches it in the target cache. If the target cache does not cache the connection, and the database connection record table does not contain information about the connection, it returns an exception message. If the target cache contains the connection, or the interceptor can successfully create a JDBC connection, the JDBC connection cache in the target cache is used for processing by the business logic components. The business logic components return a success message or an exception message based on the execution status of the business logic.
[0068] This technical solution achieves unified management of JDBC database connections by storing JDBC database connections in HttpSession and leveraging the coding characteristics of the Spring Boot framework and the component-based lifecycle management of HttpSession. This allows different Spring Boot application users to have different memory spaces for storing database connections, with these memory spaces isolated from each other. Each user's memory space can hold the database information and JDBC database connections needed by that user. Based on the Spring Boot framework and HttpSession technology, it enables independent management of database information and JDBC connections for each Spring Boot user. Furthermore, based on Spring Boot interceptor technology, it enables dynamic management of JDBC connections and database information, including the creation, destruction, and use of JDBC connections, automatically closing and releasing memory of discarded connections, and automatically recreating timed-out but still useful connections.
[0069] The technical solution of this embodiment determines the request parameters in the data request when a data request is received; if the target cache includes database interface data corresponding to the request parameters, and the interval between the time of receiving the data request and the previous historical time of receiving the data is within a preset time range, then it is determined that the database driver corresponding to the database interface data and the target database are in a connected state; wherein, the target cache corresponds to the user identifier; in the connected state, the database instruction corresponding to the data request is sent to the target database, and the target feedback data corresponding to the database instruction is fed back by the target database. This solves the problem in the prior art where different users share the same database information, which cannot meet the user's needs. It achieves the technical effect of dynamically managing the database interface data in the target cache by setting a corresponding target cache for the user identifier, ensuring that the cache space of different users is independent and not interfered with, and that the cache space can store the corresponding database information of each user, thus meeting the user's needs. At the same time, it can achieve the technical effect of dynamically managing the database interface data in the target cache.
[0070] Example 3
[0071] Figure 4 This is a schematic diagram of the structure of a data processing device according to Embodiment 3 of the present invention. Figure 4 As shown, the device includes: a request parameter determination module 410, an interface data determination module 420, and a database instruction sending module 430.
[0072] The request parameter determination module 410 is used to determine the request parameters in the data request when a data request is received; wherein the request parameters include a user identifier and a database interface identifier; the interface data determination module 420 is used to determine that the database driver corresponding to the database interface data and the target database are in a connected state if the target cache includes database interface data corresponding to the request parameters, and the interval between the receiving time of the data request and the previous historical receiving time is within a preset time range; wherein the target cache corresponds to the user identifier; the database instruction sending module 430 is used to send the database instruction corresponding to the data request to the target database in the connected state, so as to provide target feedback data corresponding to the database instruction based on the target database feedback.
[0073] The technical solution of this embodiment determines the request parameters in the data request when a data request is received; if the target cache includes database interface data corresponding to the request parameters, and the interval between the time of receiving the data request and the previous historical time of receiving the data is within a preset time range, then it is determined that the database driver corresponding to the database interface data and the target database are in a connected state; wherein, the target cache corresponds to the user identifier; in the connected state, the database instruction corresponding to the data request is sent to the target database, and the target feedback data corresponding to the database instruction is fed back by the target database. This solves the problem in the prior art where different users share the same database information, which cannot meet the user's needs. It achieves the technical effect of dynamically managing the database interface data in the target cache by setting a corresponding target cache for the user identifier, ensuring that the cache space of different users is independent and not interfered with, and that the cache space can store the corresponding database information of each user, thus meeting the user's needs. At the same time, it can achieve the technical effect of dynamically managing the database interface data in the target cache.
[0074] Optionally, based on the above-mentioned device, the request parameter determination module 410 includes a data request interception unit and a request parameter determination unit.
[0075] The data request interception unit is used to receive data requests generated by trigger operations on the front-end application page based on the interceptor;
[0076] The request parameter determination unit is used to parse the data request to obtain the request parameters carried on the data request.
[0077] Optionally, based on the above-described apparatus, the apparatus may further include a target cache determination module, which is used to determine, based on mapping technology, a target cache corresponding to the user identifier from at least one independent cache in the server.
[0078] Optionally, based on the above-described device, the device may further include an interface data loading module, which includes a disconnection state determination unit and an interface data loading unit.
[0079] The disconnection state determination unit is used to determine that the database driver and the target database corresponding to the database interface data are in a disconnection state if the target cache includes database interface data corresponding to the request parameters, and the interval between the receiving time of receiving the data request and the previous historical receiving time is outside a preset time range.
[0080] An interface data loading unit is used to load the database interface data into the database driver in the disconnected state, so that the database driver can connect to the target database.
[0081] Optionally, based on the above-mentioned device, the device may further include: a record table query module, which includes a record table determination unit and an interface information caching unit.
[0082] The record table determination unit is used to retrieve the database connection record table if the target cache does not include database interface data corresponding to the request parameters; wherein the database connection record table includes database interface information corresponding to at least one request user identifier;
[0083] An interface information caching unit is used to cache the target database interface information in the target cache if the database connection record table includes target database interface information corresponding to the request parameters, and to load the target database interface information into the corresponding database driver so that the database driver can connect to the target database.
[0084] Optionally, based on the above-mentioned device, the record table query module is further configured to generate and display an exception message if the database connection record table does not include target database interface information corresponding to the request parameters.
[0085] Optionally, based on the above-mentioned device, the device may further include: an interface data modification module, which includes a parameter modification determination unit and an interface data update unit.
[0086] The parameter determination unit is used to determine the modification parameters in the interface modification request when receiving the interface modification request, wherein the modification parameters include the user identifier to be applied, the database interface identifier to be modified, the user attribute information to be modified, the database information to be modified, and / or the connection driver information to be modified.
[0087] The interface data update unit is used to update the database interface data in the independent cache corresponding to the user identifier to be applied based on the modified parameters; and / or, to update the database interface information corresponding to the user identifier to be applied in the database connection record table based on the modified parameters.
[0088] The data processing apparatus provided in the embodiments of the present invention can execute the data processing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the method.
[0089] Example 4
[0090] Figure 5A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0091] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0092] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0093] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as data processing methods.
[0094] In some embodiments, the data processing method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the data processing method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the data processing method by any other suitable means (e.g., by means of firmware).
[0095] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0096] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0097] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0098] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0099] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0100] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0101] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0102] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A data processing method, characterized in that, include: Upon receiving a data request, the request parameters in the data request are determined; wherein, the request parameters include a user identifier and a database interface identifier; If the target cache includes database interface data corresponding to the request parameters, and the interval between the time the data request is received and the previous historical time of receipt is within a preset time range, then it is determined that the database driver corresponding to the database interface data and the target database are in a connected state; wherein, the target cache corresponds to the user identifier; the server is configured with at least one independent cache, each independent cache corresponding to one user, and the independent cache stores the database connection information of the corresponding user; after obtaining the user identifier in the request parameters, the independent cache corresponding to the user identifier is determined based on mapping technology, and the independent cache is used as the target cache; In the connected state, the database instruction corresponding to the data request is sent to the target database, so as to provide target feedback data corresponding to the database instruction based on the target database.
2. The method according to claim 1, characterized in that, The step of determining the request parameters in the data request upon receiving the data request includes: Based on the interceptor receiving data requests generated by trigger operations on the front-end application page; The data request is parsed to obtain the request parameters carried on the data request.
3. The method according to claim 1 or 2, characterized in that, After determining the request parameters in the data request upon receiving the data request, the process further includes: Based on mapping technology, the target cache corresponding to the user identifier is determined from at least one independent cache in the server.
4. The method according to claim 1, characterized in that, Also includes: If the target cache includes database interface data corresponding to the request parameters, and the interval between the receiving time of the data request and the previous historical receiving time is outside the preset time range, then it is determined that the database driver corresponding to the database interface data and the target database are in a disconnected state. In the disconnected state, the database interface data is loaded into the database driver so that the database driver can connect to the target database.
5. The method according to claim 1, characterized in that, Also includes: If the target cache does not contain database interface data corresponding to the request parameters, then the database connection record table is retrieved; wherein, the database connection record table includes database interface information corresponding to at least one request user identifier; If the database connection record table includes target database interface information corresponding to the request parameters, then the target database interface information is cached in the target cache, and the target database interface information is loaded into the corresponding database driver so that the database driver connects to the target database.
6. The method according to claim 5, characterized in that, After retrieving the database connection record table, the following is also included: If the database connection record table does not include the target database interface information corresponding to the request parameters, an error message will be generated and displayed.
7. The method according to claim 5, characterized in that, Also includes: Upon receiving an interface modification request, the modification parameters in the interface modification request are determined; wherein, the modification parameters include the user identifier to be applied, the database interface identifier to be modified, the user attribute information to be modified, the database information to be modified, and / or the connection driver information to be modified; Update the database interface data in the independent cache corresponding to the user identifier to be applied based on the modified parameters; and / or, Based on the modified parameters, update the database interface information in the database connection record table corresponding to the user identifier to be applied.
8. A data processing apparatus, characterized in that, include: The request parameter determination module is used to determine the request parameters in the data request when a data request is received; wherein the request parameters include a user identifier and a database interface identifier; The interface data determination module is used to determine that the database driver corresponding to the database interface data and the target database are in a connected state if the target cache includes database interface data corresponding to the request parameters, and the interval between the time of receiving the data request and the previous historical time of receiving the data is within a preset time range; wherein, the target cache corresponds to the user identifier; the server is set up with at least one independent cache, each independent cache corresponds to one user, and the independent cache stores the database connection information of the corresponding user; after obtaining the user identifier in the request parameters, the independent cache corresponding to the user identifier is determined based on mapping technology, and the independent cache is used as the target cache; The database instruction sending module is used to send the database instruction corresponding to the data request to the target database in the connected state, so as to provide target feedback data corresponding to the database instruction based on the target database.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the data processing method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the data processing method according to any one of claims 1-7.
Citation Information
Patent Citations
SaaS multi-tenant data isolation access method and device, electronic equipment and storage medium
CN111491012A
Multi-tenant application system control method and system
CN114185946A