Data processing method and device, electronic equipment and storage medium

By detecting the running status of the target database when the target application is running and automatically saving data to the local location under a preset fault state, the data loss problem caused by the unavailability of the database is solved, and high data availability and cost reduction are achieved.

CN119806421APending Publication Date: 2025-04-11LIANLIAN YINJIA INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411913967.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

When the target application is running, the target database is unavailable or the prediction is unavailable, resulting in data loss or corruption, affecting business continuity.

Method used

By obtaining the running status of the target database, when a preset fault status is detected, the data of the target application is automatically saved to the local target location, such as the local database or local cache.

Benefits of technology

It realizes automatic data saving in case of database failure, avoids additional disaster recovery cluster deployment and manual intervention, ensures high data availability and reduces costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806421A_ABST
    Figure CN119806421A_ABST
Patent Text Reader

Abstract

The invention relates to a data processing method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining a running state corresponding to a target database under the condition that a target application is running, and the target database is a data source carrier of the target application; under the condition that the running state indicates that the target database is in a preset fault state, data corresponding to the target application is stored to a local target position, the local target position is a local database or a local cache, and the preset fault state refers to an unavailable state or a predicted unavailable state. According to the method, the data corresponding to the target application can be automatically stored locally to support operation of the target application when the default database of the target application is in the preset fault state, so that an additional disaster recovery backup cluster is prevented from being deployed for the target application, dependence on manual intervention of cluster switching operation is avoided, high availability of data is realized, and user experience is improved. And the labor and hardware cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a data processing method, device, electronic equipment and storage medium. Background Art

[0002] Data preservation is a key measure to ensure data integrity and availability. Data preservation is directly related to business continuity. Whether it is a company's business records or personal image data or document data, once lost or damaged, it may bring immeasurable losses. Therefore, it is crucial to adopt a reasonable data preservation strategy to preserve data. Summary of the invention

[0003] In order to solve at least one of the technical problems mentioned above, the present disclosure proposes a data processing method, device, electronic device and storage medium.

[0004] In one aspect, the present invention provides a data processing method, comprising:

[0005] When the target application is running, the running status of the target database is obtained, and the target database is the data source carrier of the target application;

[0006] When the running status indicates that the target database is in a preset fault state, the data corresponding to the target application is saved to a local target location, the local target location is a local database or a local cache, and the preset fault state refers to an unavailable state or a predicted unavailable state.

[0007] In an optional embodiment, saving the data corresponding to the target application to a local target location includes:

[0008] Based on the preset rewrite instruction, the cache interface is instantiated to obtain the target save interface. The preset rewrite instruction is used to rewrite the function corresponding to the cache interface. The cache interface is the cache interface configured in the Spring cache framework. The target save interface is used to provide an operation entry for saving the data corresponding to the target application to the local target location.

[0009] Based on the target saving interface, the data corresponding to the target application is saved to the local target location.

[0010] In an optional embodiment, saving the data corresponding to the target application to a local target location includes:

[0011] Writing data corresponding to the target application into the local cache and obtaining a first operation result, where the first operation result is a read and write operation result for the data corresponding to the target application stored in the local cache;

[0012] If the first operation result is successful, writing the data corresponding to the target application into the local database;

[0013] When the first operation result is a failure, the failure record information corresponding to the first operation result is obtained; when the failure record information meets the preset degradation condition, the local cache is abandoned and the data corresponding to the target application is written into the local database.

[0014] In an optional embodiment, the method further comprises:

[0015] If the local cache is not abandoned, the data corresponding to the target application read from the local cache is returned to the target application;

[0016] When the local cache is abandoned, the data corresponding to the target application read from the local database is returned to the target application.

[0017] In an optional embodiment, after the data corresponding to the target application is saved to the local target location, the method further includes:

[0018] Loading a first target interface, the first target interface is used to provide an operation entry corresponding to a first target operation, the first target operation at least including uploading an expiration time unit and expiration time information, a data shaping operation, and a data increase or decrease operation;

[0019] Based on the first target interface, a first target operation is performed on the data corresponding to the target application stored in the local target location.

[0020] In an optional embodiment, the method further comprises:

[0021] Loading a second target interface, where the second target interface is used to provide an operation entry corresponding to a second target operation, where the second target operation includes other user-defined operations except the first target operation;

[0022] Based on the second target interface, a second target operation is performed on the data corresponding to the target application stored in the local target location.

[0023] In a second aspect, the present invention further provides a data processing device, comprising:

[0024] The acquisition module is used to acquire the running status of the target database when the target application is running, and the target database is the data source carrier of the target application;

[0025] The saving module is used to save the data corresponding to the target application to a local target location when the running status indicates that the target database is in a preset fault state. The local target location is a local database or a local cache. The preset fault state refers to an unavailable state or a predicted unavailable state.

[0026] In a third aspect, the present invention further provides an electronic device, comprising:

[0027] processor;

[0028] a memory for storing processor-executable instructions;

[0029] The processor is used to execute instructions to implement the above data processing method.

[0030] In a fourth aspect, the present invention further provides a storage medium, which, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute the above-mentioned data processing method.

[0031] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.

[0032] The implementation of this disclosure has the following beneficial effects:

[0033] When the target application is running, the operating status corresponding to the target database is obtained, and the target database is the data source carrier of the target application; when the operating status indicates that the target database is in a preset fault state, the data corresponding to the target application is saved to a local target location, and the local target location is a local database or a local cache. The preset fault state refers to an unavailable state or a predicted unavailable state.

[0034] The present invention saves the data corresponding to the target application to a local target location when the data source of the target application is in an unavailable state or is predicted to be unavailable. When a database configured for the target application fails, the local database or local cache can be used as a disaster recovery database for the target application, and the data corresponding to the target application can be automatically saved locally to support the operation of the target application, thereby avoiding the deployment of an additional disaster recovery cluster for the target application, getting rid of the reliance on manual intervention to switch cluster operations, achieving high data availability, and reducing labor and hardware costs.

[0035] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present application or the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the prior art description. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure, and do not constitute an improper limitation of the present disclosure.

[0037] Figure 1 is a schematic diagram of an implementation environment according to an exemplary embodiment;

[0038] Figure 2 is a flow chart of a data processing method according to an exemplary embodiment;

[0039] Figure 3 is a flow chart showing a method of saving data corresponding to a target application to a local target location according to an exemplary embodiment;

[0040] Figure 4 is another flowchart showing a method of saving data corresponding to a target application to a local target location according to an exemplary embodiment;

[0041] Figure 5 is a flow chart showing a method of returning data stored in a local target location to a target application according to an exemplary embodiment;

[0042] Figure 6 is a flow chart showing a data reading and writing logic according to an exemplary embodiment;

[0043] Figure 7 is a flow chart showing a first target operation based on a first target interface according to an exemplary embodiment;

[0044] Figure 8 is a flow chart showing a second target operation based on a second target interface according to an exemplary embodiment;

[0045] Fig. 9 is a schematic diagram of a data processing device according to an exemplary embodiment;

[0046] Fig.10 It is a block diagram of an electronic device for data processing according to an exemplary embodiment. DETAILED DESCRIPTION

[0047] The following will be combined with the drawings in the embodiments of this specification to clearly and completely describe the technical solutions in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0048] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or server that includes 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.

[0049] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the drawings, the drawings are not necessarily drawn to scale unless otherwise indicated. The word "exemplary" is used specifically herein to mean "serving as an example, embodiment, or illustrative". Any embodiment described herein as "exemplary" is not necessarily to be construed as being superior or better than other embodiments.

[0050] The term "and / or" herein is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set consisting of A, B, and C.

[0051] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.

[0052] See also Figure 1 , Figure 1 is a schematic diagram of an application environment according to an exemplary embodiment. Figure 1 As shown, the application environment may include a server 01 and a terminal 02 .

[0053] In an optional embodiment, the server 01 can perform computational processing on the data processing method. Specifically, the server 01 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0054] In an optional embodiment, the terminal 02 may perform calculation processing in combination with the data processing method of the server 01. Specifically, the terminal 02 may include but is not limited to electronic devices such as smart phones, desktop computers, tablet computers, laptop computers, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, smart wearable devices, etc. Optionally, the operating system running on the electronic device may include but is not limited to Android system, IOS system, Linux system, Windows system, Unix system, etc.

[0055] For example, the running status of the target application is obtained through terminal 02 and transmitted to server 01; when the target application is running, the running status corresponding to the target database is obtained through server 01, and the target database is the data source carrier of the target application; when the running status indicates that the target database is in a preset fault state, the data corresponding to the target application is saved to a local target location, which is a local database or a local cache. The preset fault state refers to an unavailable state or a predicted unavailable state, and the saved result is transmitted to terminal 02.

[0056] In addition, it should be noted that Figure 1 What is shown is only one application environment provided by the present disclosure. In actual application, other application environments may also be included.

[0057] In the embodiments of this specification, the server 01 and the terminal 02 may be directly or indirectly connected via wired or wireless communication, which is not limited in this disclosure.

[0058] Figure 2 is a flow chart of a data processing method according to an exemplary embodiment. Figure 2 As shown, the data processing method may include the following steps:

[0059] Step S201: when the target application is running, obtain the running status corresponding to the target database, where the target database is the data source carrier of the target application.

[0060] In the disclosed embodiment, the target database is a default database configured during the development of the target application, and the database may be a remote distributed cluster database.

[0061] The operating state corresponding to the target database may refer to the operating status or mode of the target database, and the operating state corresponding to the target database can be used to describe the availability of the database. The operating state corresponding to the target database may include multiple states such as online state, offline state, suspended state, and closed state. In the online state, users can perform operations such as query, update, insert, and delete. In the offline state, the database is unavailable. The database may be set to offline state due to maintenance, backup or other operations, or it may be offline due to network failure. In the suspended state, the database may be damaged or have problems, and needs to be checked and repaired. If the database file is damaged or recovery fails, the database will enter the suspended state. The closed state means that the database service is shutting down or has been shut down, and no new connections are accepted.

[0062] In the disclosed embodiment, the target application is running, which may mean that the target application has just started running, or that the target application has been running for a period of time, or that the interface of the target application has been exited but its background is still running. In these cases, the running state corresponding to the target database is obtained. The target database can be determined by searching the data carrier of the target application according to the relevant configuration information of the target application, thereby determining the target database.

[0063] Exemplarily, the implementation method of step S201 may be that after the user triggers the target application, the target application starts running, and when the target application starts running, the data carrier of the target application is searched according to the relevant configuration information of the target application, the target database is determined, and the running status corresponding to the target database is obtained. When the target application is running, after the target database is determined for the first time, the running status corresponding to the target database may be obtained once at a preset interval until the target application stops running.

[0064] In the embodiments of the present disclosure, obtaining the operating status corresponding to the target database can be achieved in any of the following ways: using a database monitoring tool to monitor the performance indicators of the database to obtain the operating status corresponding to the target database; or, using the monitoring function of the database itself, such as the built-in monitoring function provided by the database management system, which can provide comprehensive performance monitoring and fault diagnosis functions, and thus obtain the operating status corresponding to the target database; or, by viewing the log file, understanding the operating status of the target database; or, using a command line tool to view the process status, and obtain the operating status corresponding to the target database; or, using scripts and programming languages ​​to monitor database performance, for example, by executing queries and recording the start and end times to monitor query performance, and obtain the operating status of the target database; or, using the monitoring service of a cloud service platform or a third-party monitoring service to obtain the operating status of the database.

[0065] Step S202: when the running status indicates that the target database is in a preset fault state, data corresponding to the target application is saved to a local target location, the local target location is a local database or a local cache, and the preset fault state refers to an unavailable state or a predicted unavailable state.

[0066] In the disclosed embodiment, the unavailable state of the target database refers to the situation where the target database cannot be accessed or operated, and the predicted unavailable state of the target database refers to the prediction that the target database may soon enter an unavailable state by monitoring and analyzing the operating status of the target database. Among the aforementioned operating states of the various databases, the online state is an available state, and the offline state, suspended state, and closed state can all be considered unavailable states. If it is predicted that the target database is about to be in an offline state, suspended state, or closed state by monitoring and analyzing the operating status of the target database, then the target database can be considered to be in a predicted unavailable state.

[0067] In the embodiment of the present disclosure, the local database may be a relational database or a virtual database.

[0068] Figure 3 The flowchart of saving data corresponding to a target application to a local target location according to an exemplary embodiment is shown. In an optional embodiment, saving the data corresponding to the target application to the local target location in step S202 includes:

[0069] Step S301: Based on the preset rewrite instruction, the cache interface is instantiated to obtain the target save interface. The preset rewrite instruction is used to rewrite the function corresponding to the cache interface. The cache interface is the cache interface configured in the Spring cache framework. The target save interface is used to provide an operation entry for saving the data corresponding to the target application to the local target location.

[0070] In the disclosed embodiment, the preset rewrite instruction indicates the cache interface that needs to be rewritten, the specific rewrite logic, and the configuration information required for the rewrite. In the Spring cache framework, the cache management component (CacheManager) is responsible for managing the creation, configuration, and acquisition of the cache. The cache interface is instantiated based on the preset rewrite instruction to obtain the cache creation, configuration, and acquisition functions by inheriting the cache management component in the Spring cache framework. Subsequently, the cache interface to be rewritten is locked according to the name of the cache interface that needs to be rewritten indicated by the preset rewrite instruction. Based on the rewrite logic indicated by the preset rewrite instruction and the configuration information required for the rewrite, the inherited cache creation, configuration, and acquisition functions are used to perform interface function rewrite operations on the cache interface, complete the instantiation of the cache interface in the Spring cache framework, and obtain the target saved interface.

[0071] Step S302: based on the target saving interface, save the data corresponding to the target application to the local target location.

[0072] In the disclosed embodiment, based on the target saving interface, saving the data corresponding to the target application to the local target location can be implemented by a custom cache service component (CacheService), which is used to execute the specific logic of saving the data corresponding to the target application to the local target location. In the Spring cache framework, the Abstract Value Adapting Cache class (AbstractValueAdaptingCache) is a general cache implementation class under the Spring cache framework, which can be used to implement data saving operations. The cache service component obtains the function of performing data saving operations by inheriting the Abstract Value Adapting Cache class in the Spring cache framework, and uses the inherited data saving operation function to save the data corresponding to the target application to the local target location through the instantiation of the target saving interface.

[0073] Based on the above, it can be known that in the embodiment of the present disclosure, by instantiating the cache interface based on the preset rewrite instruction, the function of the original cache interface in the Spring cache framework can be rewritten, so that the interface can support the function of saving the data corresponding to the target application to the local target location, thereby realizing the operation of saving the data corresponding to the target application to the local target location based on the Spring cache framework.

[0074] Figure 4 is another flowchart of saving data corresponding to a target application to a local target location according to an exemplary embodiment. In an optional embodiment, the specific execution logic of saving the data corresponding to the target application to the local target location in step S202 or step S302 includes:

[0075] Step S401: write data corresponding to the target application into the local cache, and obtain a first operation result, where the first operation result is a read and write operation result for the data corresponding to the target application stored in the local cache.

[0076] In the disclosed embodiment, the data corresponding to the target application is written into the local cache through the cache service component. Specifically, the cache service component obtains the function of performing data saving operations by inheriting the abstract value adapter cache class in the Spring cache framework, and the cache service component writes the data corresponding to the target application into a predetermined cache location in the local cache through the target saving interface. After the data corresponding to the target application is written into the local cache, the data required by the target application is read from the local cache and returned to the target application, and the results of the read and write operations are recorded.

[0077] Step S402: When the first operation result is successful, the data corresponding to the target application is written into the local database.

[0078] In the disclosed embodiment, writing the data corresponding to the target application into the local database is performed by the cache service component. Specifically, the cache service component obtains the function of performing data saving operations by inheriting the abstract value adapter cache class in the Spring cache framework. When the read and write operations of the data corresponding to the target application saved in the local cache are successful, the cache service component writes the data corresponding to the target application into a predetermined saving location in the local database through the target saving interface, thereby realizing local storage of the data corresponding to the target application.

[0079] Step S403: when the first operation result is a failure, obtain failure record information corresponding to the first operation result; when the failure record information meets a preset degradation condition, abandon the local cache and write the data corresponding to the target application into the local database.

[0080] In the disclosed embodiment, the failure record information corresponding to the first operation result is a record of read and write operation errors. In an exemplary embodiment, the preset degradation condition is that the number of read and write operation errors within a preset time period exceeds a preset number threshold, the preset time period may be 1 minute, and the preset number threshold may be 10 times. Then the preset degradation condition may be more than 10 read and write operation errors within 1 minute. When the failure record information meets the preset degradation condition, the cache service component directly writes the data corresponding to the target application to the predetermined storage location in the local database through the target storage interface.

[0081] Based on the above, it can be known that in the embodiments of the present disclosure, by successfully writing the data corresponding to the target application stored in the local cache, the data corresponding to the target application is written to the local database, and the operation of the target application can be further guaranteed by using the data corresponding to the target application stored in the local database to prevent the target application from being unable to run when the local cache is unavailable; by abandoning the local cache when failing to read and write the data corresponding to the target application stored in the local cache, it is possible to prevent the failed operation from affecting the operation of the target application.

[0082] Figure 5 is a flowchart showing a method of returning data stored in a local target location to a target application according to an exemplary embodiment. In an optional embodiment, the method further includes:

[0083] Step S501: when the local cache is not abandoned, the data corresponding to the target application read from the local cache is returned to the target application.

[0084] In the embodiment of the present disclosure, if the local cache is not abandoned, the data required by the target application is queried from the local cache, and the hit data is returned to the target application. Specifically, if network transmission is required, the data can be serialized and sent to the target application through the network or inter-process communication (IPC) mechanism.

[0085] Step S502: when the local cache is abandoned, the data corresponding to the target application read from the local database is returned to the target application.

[0086] In the embodiment of the present disclosure, when the local cache is abandoned, a data query request will be directly initiated to the local database to obtain the data required by the target application. After receiving the query request, the local database will retrieve the corresponding data, and when the local database retrieves the required data, it will return the data to the target application that initiated the request.

[0087] Based on the above, it can be known that in the embodiments of the present disclosure, by returning the data corresponding to the target application read from the local cache to the target application when the local cache is not abandoned, the number of accesses to the local database can be reduced and the operating pressure of the local database can be reduced; by returning the data corresponding to the target application read from the local database to the target application when the local cache is abandoned, the normal operation of the target application can be guaranteed.

[0088] Figure 6 is a flow chart of a data reading and writing logic according to an exemplary embodiment. In an optional embodiment, the implementation logic of the above steps S401-S502 is as follows: Figure 6As shown, when the target database is in a preset fault state, whether to write the data corresponding to the target application to the local cache or to the local database is determined by the fuse switch. When the fuse switch is turned off, the data corresponding to the target application is written to the local cache, and when the target application initiates a data query request to the local cache, the data corresponding to the target application read from the local cache is returned to the target application, and the read and write operation results for the data corresponding to the target application stored in the local cache are obtained. In the case where the read and write operation results for the data corresponding to the target application stored in the local cache are successful, the data corresponding to the target application is synchronously written to the local database; in the case where the read and write operation results for the data corresponding to the target application stored in the local cache are failed, the relevant information of the failed operation is asynchronously counted to obtain the failure record information, and when the failure record information meets the preset degradation condition, the fuse switch is turned on, the local cache is abandoned, and the data corresponding to the target application is directly written to the local database, and when the target application initiates a data query request to the local database, the data corresponding to the target application read from the local database is returned to the target application. The above implementation logic is encapsulated in a custom cache service component. When the user uses annotations to implement data saving operations, the instance in the cache service component can be obtained. After successful instantiation, the corresponding implementation logic of the cache service component is executed.

[0089] Based on the above, it can be known that the embodiments of the present disclosure save the data corresponding to the target application to the local target location when the data source of the target application is in an unavailable state or predicted to be unavailable state. This can achieve that when the database configured for the target application fails, the local database or local cache is used as the disaster recovery database of the target application, and the data corresponding to the target application is automatically saved locally to support the operation of the target application, thereby avoiding the deployment of an additional disaster recovery cluster for the target application, getting rid of the reliance on manual intervention to switch cluster operations, achieving high data availability, and reducing labor and hardware costs.

[0090] Figure 7 is a flowchart of performing a first target operation based on a first target interface according to an exemplary embodiment. In an optional embodiment, after saving the data corresponding to the target application to the local target location, the method further includes:

[0091] Step S701: Loading a first target interface, the first target interface is used to provide an operation entry corresponding to a first target operation, the first target operation at least including uploading an expiration time unit and expiration time information, a data shaping operation, and a data increase or decrease operation.

[0092] In the disclosed embodiment, the first target interface is a custom interface. Since the Spring cache framework is not configured with an operation entry that can perform the first target operation on the data corresponding to the target application stored in the local target location, loading the custom first target interface can provide an operation entry for implementing the first target operation under the Spring cache framework.

[0093] Step S702: Based on the first target interface, a first target operation is performed on the data corresponding to the target application stored in the local target location.

[0094] In the disclosed embodiment, an abstract extended cache class (AbstractExtCache) is defined under the Spring cache framework, and the abstract extended cache class is used to implement the function of extending the operation on the cached data, wherein the extended functions of the abstract extended cache class include the implementation of sending expiration time units and expiration time information, data shaping operations, and data increase and decrease operations. Based on the first target interface, the first target operation on the data corresponding to the target application stored in the local target location can be implemented by a custom cache service component. The specific process can be that the cache service component inherits the functions of the abstract extended cache class in the Spring cache framework, and the cache service component uses the inherited functions of sending expiration time units and expiration time information, data shaping operations, and data increase and decrease operations to perform the corresponding first target operation through the first target interface.

[0095] In an exemplary embodiment, the first target operation includes setting the expiration time unit of the data corresponding to the target application stored in the local target location to seconds or milliseconds, setting the expiration time of the data corresponding to the target application to a specified timestamp, and increasing the value corresponding to the data of the target application stored in the local target location by 1, increasing a specified integer, increasing a specified floating point number, or decreasing a specified integer.

[0096] Based on the above, it can be known that by loading the first target interface in the embodiment of the present disclosure, the interface under the Spring cache framework can be expanded. Through the first target interface, it is possible to implement operations such as uploading expiration time units and expiration time information, data shaping operations, and data increase and decrease for the data corresponding to the target application stored in the local target location, thereby increasing the operation functions of local data under the Spring cache framework.

[0097] Figure 8 is a flowchart showing a method of performing a second target operation based on a second target interface according to an exemplary embodiment. In an optional embodiment, the method further includes:

[0098] Step S801: loading a second target interface, where the second target interface is used to provide an operation entry corresponding to a second target operation, where the second target operation includes other user-defined operations except the first target operation.

[0099] In the disclosed embodiment, the second target interface is a custom interface. Since the Spring cache framework is not configured with an operation entry that can perform a second target operation on the data corresponding to the target application stored in the local target location, loading the custom second target interface can provide an operation entry for implementing the second target operation under the Spring cache framework.

[0100] Step S802: Based on the second target interface, a second target operation is performed on the data corresponding to the target application stored in the local target location.

[0101] In the disclosed embodiment, the functions extended by the abstract extended cache class also include other user-defined second target operations in addition to the first target operation. Based on the second target interface, the second target operation on the data corresponding to the target application stored in the local target location can be implemented by a customized cache service component. The specific process can be that the cache service component inherits the functions of the abstract extended cache class in the Spring cache framework, and the cache service component uses the inherited functions of performing other user-defined second target operations to execute the corresponding second target operation through the second target interface.

[0102] In the disclosed embodiment, the second target operation includes performing richer database operations on the data corresponding to the target application stored in the local target location. Specifically, it may be transaction management operations to ensure the integrity of the data, such as starting a transaction, committing a transaction, and rolling back a transaction. It may also include index management operations, such as creating and managing indexes to improve query efficiency, and may also include permission management operations, such as setting and managing permissions for database users.

[0103] In an exemplary embodiment, based on the second target interface, performing a second target operation on the data corresponding to the target application stored in the local target location may include performing other data processing operations on the data corresponding to the target application stored in the local target location, including performing a data conversion operation to convert the data from one format to another format, performing data deduplication to delete duplicate items in the data, performing a data cleaning operation to correct errors and inconsistencies in the data, and performing a data segmentation operation to segment large data sets into smaller, more manageable parts.

[0104] In an exemplary embodiment, based on the second target interface, performing a second target operation on the data corresponding to the target application saved in the local target location may include performing a data analysis operation on the data corresponding to the target application saved in the local target location, including statistical analysis operations, such as correlation analysis, regression analysis, etc., and may also be a data mining operation to discover patterns and relationships from large amounts of data, and may also be a predictive analysis operation to use historical data to predict future trends.

[0105] In an exemplary embodiment, based on the second target interface, performing a second target operation on the data corresponding to the target application stored in the local target location may include performing data security operations on the data corresponding to the target application stored in the local target location, such as encryption operations to protect the data from unauthorized access; desensitization operations to hide or modify sensitive data to protect privacy; and audit operations to monitor and record data access and operations to ensure compliance and security.

[0106] In an exemplary embodiment, based on the second target interface, performing a second target operation on the data corresponding to the target application stored in the local target location may include performing more advanced data storage operations on the data corresponding to the target application stored in the local target location, such as data compression operations to reduce the demand for data storage space; data archiving operations to move infrequently used data to long-term storage units; and data tiering operations to store data in storage units of different levels according to the frequency and importance of the data.

[0107] Based on the above, it can be seen that in the embodiment of the present disclosure, by loading the second target interface, the interface under the Spring cache framework can be expanded. Through the second target interface, user-defined operations can be performed on the data corresponding to the target application stored in the local target location, thereby increasing the operation functions of local data under the Spring cache framework.

[0108] In a specific embodiment, the present disclosure is implemented as follows:

[0109] The present disclosure provides four framework packages for the access party, namely, the automatic configuration framework package (starter), the high availability implementation framework package (ha), the cache implementation framework package (cache) and the client framework package (client). The access party can implement the method of the present disclosure at the access end through the above four framework packages. Among them,

[0110] The starter package is mainly used to initialize the classes in the Spring cache framework.

[0111] The ha framework package mainly realizes the connection with the target database and the operations of adding, deleting, checking and modifying data.

[0112] The cache shelf package is mainly used for function optimization and rewriting based on the Spring cache framework. By inheriting the cache management component (CacheManager) in the Spring cache framework and rewriting the interface function, the cache interface in the Spring cache framework is instantiated to obtain the target preservation interface. Then the custom cache service component (CacheService) inherits the abstract value adaptation cache class (AbstractValueAdaptingCache) in the Spring cache framework, and implements the function of saving the data corresponding to the target application to the local target location through the instantiated target preservation interface. The specific execution logic of saving the data corresponding to the target application to the local target location is encapsulated in the instance of the cache service component. When the access party uses annotations to implement cache operations, it will first obtain the instance in the cache service component, and execute the corresponding logic of the cache service component after successful instantiation.

[0113] Specifically, during the execution process, first determine whether the fuse switch is turned on. If the fuse is turned on, the local database read and write operations will be performed directly, and then the results will be returned to the caller, that is, the target application. If the fuse is not turned on, a request is made to read and write the local cache. When the read and write fails, a downgrade solution is automatically adopted to perform read and write operations on the local database to avoid business abnormalities, and asynchronously count the relevant information of the failed operation to obtain failure record information. When the failure record information meets the preset downgrade conditions, such as 10 times in 1 minute, the fuse switch is automatically turned on, and the execution logic when the fuse is turned on is subsequently executed.

[0114] The client package is mainly used to provide the implementation of the first target interface and the second target interface. The client package defines an abstract extension cache class (AbstractExtCache) to extend additional operations for cached data to implement more advanced cache strategies or features. The abstract extension cache class inherits the functions of the abstract value adaptation cache class (AbstractValueAdaptingCache) in the Spring cache framework to define various abstract methods, and finally inherits the abstract extension cache class through the cache service component to implement the extended functions, including but not limited to sending expiration time units and expiration time information, data shaping operations, and data increase and decrease operations. Specifically, the client package extends the first target interface for the access end to implement the sending of expiration time units and expiration time information, data shaping operations, and data increase and decrease operations under the Spring cache framework, as well as the second target interface for implementing other user-defined operations except the first target operation. By loading the first target interface, the access end can perform the first target operation on the data corresponding to the target application stored in the local target location based on the first target interface. By loading the second target interface, the access end can perform the second target operation on the data corresponding to the target application stored in the local target location based on the second target interface.

[0115] Fig. 9 is a block diagram of a data processing device according to an exemplary embodiment. Fig. 9 The device includes an acquisition module 901 and a storage module 902, wherein:

[0116] The acquisition module 901 is used to acquire the running status of the target database when the target application is running, and the target database is the data source carrier of the target application;

[0117] The saving module 902 is used to save the data corresponding to the target application to a local target location when the running status indicates that the target database is in a preset fault state. The local target location is a local database or a local cache. The preset fault state refers to an unavailable state or a predicted unavailable state.

[0118] In an optional embodiment, the saving module 902 includes:

[0119] An instantiation unit is used to instantiate the cache interface based on a preset rewrite instruction to obtain a target save interface. The preset rewrite instruction is used to rewrite the function corresponding to the cache interface. The cache interface is a cache interface configured in the Spring cache framework. The target save interface is used to provide an operation entry for saving the data corresponding to the target application to a local target location.

[0120] The saving unit is used to save the data corresponding to the target application to a local target location based on the target saving interface.

[0121] In an optional embodiment, the saving module 902 includes:

[0122] A first writing unit, used to write data corresponding to the target application into the local cache and obtain a first operation result, where the first operation result is a read and write operation result for the data corresponding to the target application stored in the local cache;

[0123] A second writing unit, used for writing the data corresponding to the target application into the local database when the first operation result is successful;

[0124] The third writing unit is used to obtain failure record information corresponding to the first operation result when the first operation result is a failure; when the failure record information meets a preset degradation condition, abandon the local cache and write the data corresponding to the target application into the local database.

[0125] In an optional embodiment, the device further comprises:

[0126] A first returning module, configured to return the data corresponding to the target application read from the local cache to the target application if the local cache is not abandoned;

[0127] The second returning module is used to return the data corresponding to the target application read from the local database to the target application when the local cache is abandoned.

[0128] In an optional embodiment, the device further comprises:

[0129] A first loading module, used to load a first target interface, the first target interface is used to provide an operation entry corresponding to a first target operation, the first target operation at least includes sending an expiration time unit and expiration time information, a data shaping operation, and a data increase or decrease operation;

[0130] The first operation module is used to perform a first target operation on the data corresponding to the target application stored in the local target location based on the first target interface.

[0131] In an optional embodiment, the device further comprises:

[0132] A second loading module, used for loading a second target interface, the second target interface is used for providing an operation entry corresponding to a second target operation, the second target operation including other user-defined operations except the first target operation;

[0133] The second operation module is used to perform a second target operation on the data corresponding to the target application stored in the local target location based on the second target interface.

[0134] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware such as processing circuits or memories, or a combination thereof. Similarly, one processor or multiple processors or memories can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0135] In an exemplary embodiment, an electronic device is also provided, including: a processor; and a memory for storing instructions executable by the processor; wherein the processor is used for the instructions to implement the data processing method in the embodiment of the present disclosure.

[0136] Fig.10 is a block diagram of an electronic device for data processing according to an exemplary embodiment. The electronic device may be a terminal, and its internal structure diagram may be as shown in FIG. Fig.10 As shown. The electronic device includes a processor, a memory, a network interface, a display screen and an input device connected via a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a data processing method is implemented. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covering the display screen, or a key, trackball or touchpad provided on the housing of the electronic device, or an external keyboard, touchpad or mouse, etc.

[0137] Those skilled in the art will understand that Fig.10 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0138] In an exemplary embodiment, a storage medium is also provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the data processing method in the embodiment of the present disclosure.

[0139] In an exemplary embodiment, a computer program product containing instructions is also provided. When the computer program product is run on a computer, the computer is caused to execute the data processing method in the embodiment of the present disclosure.

[0140] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present disclosure can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0141] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

[0142] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A data processing method, characterized in that: The method comprises: When the target application is running, obtaining the running status corresponding to the target database, the target database being the data source carrier of the target application; When the running status indicates that the target database is in a preset fault state, the data corresponding to the target application is saved to a local target location, the local target location is a local database or a local cache, and the preset fault state refers to an unavailable state or a predicted unavailable state.

2. The method according to claim 1, characterized in that Saving the data corresponding to the target application to a local target location includes: Based on the preset rewrite instruction, the cache interface is instantiated to obtain the target save interface, the preset rewrite instruction is used to rewrite the function corresponding to the cache interface, the cache interface is the cache interface configured in the Spring cache framework, and the target save interface is used to provide an operation entry for saving the data corresponding to the target application to the local target location; Based on the target saving interface, the data corresponding to the target application is saved to a local target location.

3. The method according to claim 1 or 2, characterized in that: Saving the data corresponding to the target application to a local target location includes: Writing the data corresponding to the target application into the local cache, and obtaining a first operation result, where the first operation result is a read and write operation result for the data corresponding to the target application stored in the local cache; If the first operation result is successful, writing the data corresponding to the target application into the local database; When the first operation result is a failure, obtain failure record information corresponding to the first operation result; when the failure record information meets a preset degradation condition, abandon the local cache and write the data corresponding to the target application into the local database.

4. The method according to claim 3, characterized in that The method further comprises: If the local cache is not abandoned, returning the data corresponding to the target application read from the local cache to the target application; In the case where the local cache is abandoned, the data corresponding to the target application read from the local database is returned to the target application.

5. The method according to claim 1, characterized in that After the data corresponding to the target application is saved to the local target location, the method further includes: Loading a first target interface, the first target interface is used to provide an operation entry corresponding to a first target operation, the first target operation at least including sending an expiration time unit and expiration time information, a data shaping operation, and a data increase or decrease operation; Based on the first target interface, the first target operation is performed on the data corresponding to the target application stored in the local target location.

6. The method according to claim 5, characterized in that The method further comprises: Loading a second target interface, where the second target interface is used to provide an operation entry corresponding to a second target operation, where the second target operation includes other user-defined operations except the first target operation; Based on the second target interface, the second target operation is performed on the data corresponding to the target application stored in the local target location.

7. A data processing device, characterized in that: The device comprises: An acquisition module, used to acquire the running status corresponding to a target database when a target application is running, the target database being a data source carrier of the target application; A saving module is used to save the data corresponding to the target application to a local target location when the operating status indicates that the target database is in a preset fault state. The local target location is a local database or a local cache. The preset fault state refers to an unavailable state or a predicted unavailable state.

8. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is used for executing the instructions to implement the data processing method according to any one of claims 1 to 6.

9. A storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the data processing method as claimed in any one of claims 1 to 6.

10. A computer program product, characterized in that The computer program product comprises a computer program, which is stored in a readable storage medium. At least one processor of a computer device reads and executes the computer program from the readable storage medium, so that the device performs the data processing method according to any one of claims 1 to 6.