Data cross-process sharing method, terminal equipment and computer readable storage medium

文档序号:1953062 发布日期:2021-12-10 浏览:14次 中文

阅读说明:本技术 数据跨进程共享的方法、终端设备及计算机可读存储介质 (Data cross-process sharing method, terminal equipment and computer readable storage medium ) 是由 刘锐 谢铮 熊友军 于 2021-08-27 设计创作,主要内容包括:本申请适用于数据处理技术领域,提供了一种数据跨进程共享的方法、终端设备及计算机可读存储介质,其中,数据跨进程共享的方法包括:接收来自第一进程的数据处理请求,所述数据处理请求中携带有第一令牌、待处理的目标共享数据的第一标识及所述目标共享数据的目标数据处理策略;基于所述第一令牌对所述第一进程进行身份校验;若所述身份校验成功,则基于所述第一标识从共享内存中查找目标共享数据,并基于目标数据处理策略对所述目标共享数据进行处理;将处理后的所述目标共享数据同步至各个目标进程,所述目标进程为获取过所述目标共享数据的进程,所述目标进程包括所述第一进程,从而可以提高数据跨进程共享过程中共享数据的安全性及原子性。(The application is applicable to the technical field of data processing, and provides a data cross-process sharing method, terminal equipment and a computer readable storage medium, wherein the data cross-process sharing method comprises the following steps: receiving a data processing request from a first process, wherein the data processing request carries a first token, a first identifier of target shared data to be processed and a target data processing strategy of the target shared data; performing identity verification on the first process based on the first token; if the identity verification is successful, searching target shared data from a shared memory based on the first identifier, and processing the target shared data based on a target data processing strategy; and synchronizing the processed target shared data to each target process, wherein the target process is a process for acquiring the target shared data and comprises the first process, so that the security and atomicity of the shared data in the process of sharing the data across processes can be improved.)

1. A method for data cross-process sharing, comprising:

receiving a data processing request from a first process, wherein the data processing request carries a first token, a first identifier of target shared data to be processed and a target data processing strategy of the target shared data;

performing identity verification on the first process based on the first token;

if the identity verification is successful, searching the target shared data from a shared memory based on the first identifier, and processing the target shared data based on the target data processing strategy;

and synchronizing the processed target shared data to each target process, wherein the target process is a process which acquires the target shared data, and the target process comprises the first process.

2. The method of claim 1, wherein the first identifier is an identifier of the target shared data in a shared memory;

correspondingly, the searching the target shared data from the shared memory based on the first identifier and processing the target shared data based on the target data processing policy includes:

determining a second identification of the target shared data in the first process based on the first identification;

judging whether the target shared data is included in the first process or not based on the second identification;

and if the first process comprises the target shared data, processing the target shared data in the first process based on the target data processing strategy, and synchronizing the processed target shared data into the shared memory.

3. The method of claim 2, wherein after the determining whether the target shared data is included in the first process based on the second identifier, the method further comprises:

if the first process does not include the target shared data, judging whether the shared memory stores the target shared data or not based on the first identifier;

and if the target shared data are stored in the shared memory, processing the target shared data stored in the shared memory based on the target data processing strategy.

4. The method according to claim 3, wherein after said determining whether the target shared data is stored in the shared memory based on the first identifier, the method further comprises:

and if the target shared data is not stored in the shared memory, returning first prompt information to the first process, wherein the first prompt information is used for prompting that the target shared data does not exist.

5. The method according to any one of claims 1 to 4, wherein after the synchronizing the processed target shared data to the respective target processes, the method further comprises:

and storing the processed target shared data into a first database.

6. The method according to any one of claims 1 to 4, wherein the data processing request further carries an identity of the first process;

correspondingly, the identity verification of the first process based on the first token includes:

analyzing the first token based on a preset decryption strategy to obtain the validity period of the first token and the identity of a process;

and if the current time is within the validity period and the identity of the process obtained by analysis is the same as the identity of the first process carried in the data processing request, confirming that the identity verification is successful.

7. The method of any of claims 1 to 4, wherein after said identity checking the first process based on the first token, the method further comprises:

and if the identity verification fails, returning second prompt information to the first process, wherein the second prompt information is used for prompting that the first process does not have the authority for processing the target shared data.

8. A terminal device, comprising:

the system comprises a request processing unit, a first processing unit and a second processing unit, wherein the request processing unit is used for receiving a data processing request from a first process, and the data processing request carries a first token, a first identifier of target shared data to be processed and a target data processing strategy of the target shared data;

the identity verification unit is used for verifying the identity of the first process based on the first token;

the data processing unit is used for searching the target shared data from the shared memory based on the first identifier and processing the target shared data based on the target data processing strategy if the identity verification is successful;

and the data synchronization unit is used for synchronizing the processed target shared data to each target process, wherein the target process is a process which acquires the target shared data, and the target process comprises the first process.

9. A terminal device comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, the processor implementing the method of any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 7.

Technical Field

The present application belongs to the technical field of data processing, and in particular, to a method for data cross-process sharing, a terminal device, and a computer-readable storage medium.

Background

An existing terminal device (e.g., a mobile phone) may generally run multiple processes, and data may be shared between different processes, for example, an a application may share some application data thereof to a B application, and such an operation that data is shared between different processes is referred to as cross-process sharing of data.

However, the existing data cross-process sharing mode cannot guarantee the security of shared data, so that the shared data is easily tampered by some malicious processes; and the existing data cross-process sharing mode can not ensure the consistency of the same shared data in different processes, thereby reducing the atomicity of the shared data.

Disclosure of Invention

In view of this, embodiments of the present application provide a data cross-process sharing method, a terminal device, and a computer-readable storage medium, so as to solve the technical problem that the security and atomicity of shared data are low in the existing data cross-process sharing method.

In a first aspect, an embodiment of the present application provides a method for data cross-process sharing, including:

receiving a data processing request from a first process, wherein the data processing request carries a first token, a first identifier of target shared data to be processed and a target data processing strategy of the target shared data;

performing identity verification on the first process based on the first token;

if the identity verification is successful, searching the target shared data from a shared memory based on the first identifier, and processing the target shared data based on the target data processing strategy;

and synchronizing the processed target shared data to each target process, wherein the target process is a process which acquires the target shared data, and the target process comprises the first process.

Optionally, the first identifier is an identifier of the target shared data in a shared memory;

correspondingly, the searching the target shared data from the shared memory based on the first identifier and processing the target shared data based on the target data processing policy includes:

determining a second identification of the target shared data in the first process based on the first identification;

judging whether the target shared data is included in the first process or not based on the second identification;

and if the first process comprises the target shared data, processing the target shared data in the first process based on the target data processing strategy, and synchronizing the processed target shared data into the shared memory.

Optionally, after the determining whether the target shared data is included in the first process based on the second identifier, the method further includes:

if the first process does not include the target shared data, judging whether the shared memory stores the target shared data or not based on the first identifier;

and if the target shared data are stored in the shared memory, processing the target shared data stored in the shared memory based on the target data processing strategy.

Optionally, after determining whether the target shared data is stored in the shared memory based on the first identifier, the method further includes:

and if the target shared data is not stored in the shared memory, returning first prompt information to the first process, wherein the first prompt information is used for prompting that the target shared data does not exist.

Optionally, after the synchronizing the processed target shared data to each target process, the method further includes:

and storing the processed target shared data into a first database.

Optionally, the data processing request further carries an identity of the first process;

correspondingly, the identity verification of the first process based on the first token includes:

analyzing the first token based on a preset decryption strategy to obtain the validity period of the first token and the identity of a process;

and if the current time is within the validity period and the identity of the process obtained by analysis is the same as the identity of the first process carried in the data processing request, confirming that the identity verification is successful.

Optionally, after the identity verification of the first process based on the first token, the method further includes:

and if the identity verification fails, returning second prompt information to the first process, wherein the second prompt information is used for prompting that the first process does not have the authority for processing the target shared data.

In a second aspect, an embodiment of the present application provides a terminal device, including:

the system comprises a request processing unit, a first processing unit and a second processing unit, wherein the request processing unit is used for receiving a data processing request from a first process, and the data processing request carries a first token, a first identifier of target shared data to be processed and a target data processing strategy of the target shared data;

the identity verification unit is used for verifying the identity of the first process based on the first token;

the data processing unit is used for searching the target shared data from the shared memory based on the first identifier and processing the target shared data based on the target data processing strategy if the identity verification is successful;

and the data synchronization unit is used for synchronizing the processed target shared data to each target process, wherein the target process is a process which acquires the target shared data, and the target process comprises the first process.

In a third aspect, an embodiment of the present application provides a terminal device, where the terminal device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the method for sharing data across processes in the first aspect or any optional manner of the first aspect is implemented.

In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements a method for data cross-process sharing according to the first aspect or any alternative manner of the first aspect.

In a fifth aspect, an embodiment of the present application provides a computer program product, which when run on a terminal device, causes the terminal device to execute the method for data cross-process sharing described in the first aspect or any optional manner of the first aspect.

The implementation of the method for data cross-process sharing, the terminal device, the computer readable storage medium and the computer program product provided by the embodiment of the application has the following beneficial effects:

according to the method for data cross-process sharing provided by the embodiment of the application, the data processing request initiated by the first process carries the first token, the identity of the first process is verified based on the first token when the data processing request initiated by the first process is received, and the target shared data stored in the shared memory is processed based on the target data processing strategy carried in the data processing request after the identity verification is successful, namely the target shared data is processed under the condition that the first process has the authority of processing the target shared data, so that the security of the shared data is improved; after the target shared data is processed, the processed target shared data is synchronized to each process which acquires the target shared data, so that the consistency of the target shared data in different processes can be ensured, and the atomicity of the target shared data is improved.

Drawings

In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.

Fig. 1 is a schematic structural diagram of a terminal device according to an embodiment of the present application;

FIG. 2 is a schematic flow chart of a method for data cross-process sharing according to an embodiment of the present application;

fig. 3 is a flowchart of a specific implementation of S203 in a method for data cross-process sharing according to an embodiment of the present application;

FIG. 4 is a schematic flow chart diagram illustrating a method for cross-process data sharing according to another embodiment of the present application;

fig. 5 is a schematic structural diagram of a terminal device according to another embodiment of the present application;

fig. 6 is a schematic structural diagram of a terminal device according to yet another embodiment of the present application.

Detailed Description

It is noted that the terminology used in the description of the embodiments of the present application is for the purpose of describing particular embodiments of the present application only and is not intended to be limiting of the present application. In the description of the embodiments of the present application, "/" means "or" unless otherwise specified, for example, a/B may mean a or B; "and/or" herein is merely an associative relationship describing an association, meaning that there may be three relationships, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present application, "a plurality" means two or more, and "at least one", "one or more" means one, two or more, unless otherwise specified.

In the following, the terms "first", "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a definition of "a first" or "a second" feature may explicitly or implicitly include one or more of the features.

Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.

The execution main body of the data cross-process sharing method provided by the embodiment of the application can be terminal equipment. Illustratively, the terminal device may be an electronic device such as a mobile phone, a tablet computer or a notebook computer.

Referring to fig. 1, fig. 1 is a schematic structural diagram of a terminal device according to an embodiment of the present disclosure. As shown in fig. 1, the terminal device may provide a process management service 11, a data storage management service 12, and the like.

The process management service 11 is specifically configured to provide services such as process registration, process monitoring, and processing and/or responding to a request initiated by a process.

Specifically, before a certain process is run for the first time by the terminal device, the process needs to be registered (i.e., created) in the process management service 11. When the terminal device registers a process in the process management service 11, the process management service 11 determines whether the process requested to be registered by the terminal device is a process allowed by the process management service 11.

If the process management service 11 determines that the process requested to be registered by the terminal device is the process allowed by the terminal device, the process management service 11 registers the process and allocates a token for proving the identity of the process to the process after the process is successfully registered.

In one possible implementation, when the terminal device registers a process in the process management service 11, the terminal device may provide the process management service 11 with an identity of the process requesting registration. Illustratively, the identity of the process may include the name or address of the process, etc. Based on this, the token may be generated by the process management service 11 by using a preset encryption policy based on the identity of the process requesting registration and the validity period of the token.

The limited period of the token may be obtained by the process management service 11 according to the first time when the process registration is successful and the preset time length. The preset duration can be set according to actual requirements, and is not limited here. Specifically, the process management service 11 may use a first time as a start time, obtain an end time according to the first time and a preset time length, and describe the validity period of the token by the start time and the end time.

After the process registration is successful, the process management service 11 may monitor the process. E.g., whether the listening process initiated a data processing request, etc. For example, if it is monitored that a process initiates a data processing request, the process management service 11 may process the data to be processed based on the data processing request. Thereafter, the process management service 11 may return the data processing result to the process.

The data storage management service 12 is specifically for providing storage management services for shared data. Shared data refers to data that can be shared between different processes, and shared data can be created by different processes. The data storage management service 12 may store all the shared data created by different processes in the shared memory 13 for unified management, so that each process may obtain the required shared data from the shared memory 13. Illustratively, the shared memory 13 may be a physical memory in the terminal device.

To distinguish between shared data, the data storage management service 12 may identify each shared data stored in the shared memory 13, i.e., different shared data may have different identifications in the shared memory 13. When a process acquires certain shared data from the shared memory 13, the process may also identify the shared data, and different processes may identify the same shared data differently. That is, the same shared data has different identifications in the shared memory 13 and in different processes.

By way of example and not limitation, the identification of the shared data may be a Uniform Resource Identifier (URI) of the shared data.

In this embodiment, the terminal device may perform associated storage on the identifier of the shared data in each process and the identifier of the shared data in the shared memory 13. That is, the terminal device may store a corresponding relationship between the identifier of the shared data in the shared memory 13 and the identifier of the shared data in each process. For example, the terminal device may store a corresponding relationship between an identifier of the shared data in the shared memory 13 and an identifier of the shared data in the first process. Or the terminal device may store a corresponding relationship between the identifier of the shared data in the shared memory 13 and the identifier of the shared data in the second process.

Referring to fig. 2, fig. 2 is a schematic flowchart of a data cross-process sharing method according to an embodiment of the present application. The data cross-process sharing method can comprise S201 to S204, which are detailed as follows:

s201: receiving a data processing request from a first process, wherein the data processing request carries a first token, a first identifier of target shared data to be processed and a target data processing strategy of the target shared data.

In this embodiment of the application, the terminal device may invoke the process management service to execute S201, that is, the process management service may receive the data processing request from the first process.

The first process may be any process running in the terminal device.

When the first process needs to query or update the target shared data, the first process may initiate a data processing request for the target shared data to the process management service. The data processing request may carry a first token, a first identifier of the target shared data, and a target data processing policy for the target shared data.

The target shared data may be shared data created by the first process, or shared data created by other processes except the first process, and is not limited herein.

The first token may be assigned by the process management service to the first process after the registration is successful. Alternatively, the first token may be obtained by the first process from another place, which is not limited herein.

The first identifier of the target shared data refers to an identifier of the target shared data in the shared memory.

By way of example and not limitation, the first process may initiate a data processing request to the process management service by calling an Application Programming Interface (API).

In this embodiment of the application, the data processing request may include: data query requests, data update requests, and the like. The data update request may include: data modification requests, data deletion requests, data write requests, and the like.

In a possible implementation manner, when the data processing request is a data query read request, the target data processing policy carried in the data processing request may specifically be a data query policy. For example, the data query policy may be: querying the target shared data from the first process based on the first identification of the target shared data; and if the query target shared data does not exist in the first process, querying the target shared data from the shared memory based on the first identifier of the target shared data.

In another possible implementation manner, when the data processing request is a data modification request, the target data processing policy carried in the data processing request may specifically be a data modification policy. For example, the data modification policy may be: and modifying the value of the first field of the target shared data into the target value.

In another possible implementation manner, when the data processing request is a data deletion request, the target data processing policy carried in the data processing request may specifically be a data deletion policy. For example, the data deletion policy may be: deleting the target shared data; or delete the target field of the target shared data, etc.

In another possible implementation manner, when the data processing request is a data write request, the target data processing policy carried in the data processing request may specifically be a data write policy. For example, the data write strategy may be: writing the target shared data into the shared memory; or adding a target field in the target shared data, and the like.

S202: and performing identity verification on the first process based on the first token.

In this embodiment of the application, the terminal device may invoke the process management service to execute S202, that is, the process management service may perform identity verification on the first process based on the first token carried in the data processing request.

The token distributed by the process management service for the process is generated by adopting a preset encryption strategy based on the identity of the process and the validity period of the token. Therefore, in an embodiment of the present application, the data processing request may also carry an identity of the first process; s202 may specifically include the following steps:

analyzing the first token based on a preset decryption strategy to obtain the validity period of the first token and the identity of a process;

and if the current time is within the validity period and the identity of the process obtained by analysis is the same as the identity of the first process carried in the data processing request, confirming that the identity verification is successful.

The preset decryption strategy is a decryption strategy corresponding to the preset encryption strategy.

The current time refers to the time when the process management service receives a data processing request from the first process.

In this embodiment, after the process management service analyzes the first token, it may be determined whether the current time is within the validity period of the first token obtained through analysis.

In a possible implementation manner, if the current time is within the validity period of the first token, it indicates that the first token is currently valid, and at this time, the process management service determines whether the identity of the process obtained through the analysis is the same as the identity of the first process carried in the data processing request. In one case, if the identity of the process obtained through the analysis is the same as the identity of the first process carried in the data processing request, the process management service determines that the identity verification of the first process is successful, that is, the first process is a process registered in the process management service. In another case, if the identity of the process obtained through the analysis is different from the identity of the first process carried in the data processing request, the process management service determines that the identity verification of the first process fails, that is, the first process is not a process registered in the process management service.

In another possible manner, if the current time is not within the validity period of the first token, it indicates that the first token is expired currently, and at this time, the process management service determines that the identity check on the first process fails.

In this embodiment, if the identity verification of the first process is successful, the terminal device may execute S203.

S203: and if the identity verification is successful, searching the target shared data from the shared memory based on the first identifier, and processing the target shared data based on the target data processing strategy.

In this embodiment of the application, the terminal device may invoke the process management service and the data storage management service to execute S203.

Specifically, in an embodiment of the present application, if the identity verification of the first process is successful, the process management service may directly search the target shared data from the shared memory based on the first identifier of the target shared data. In one possible case, if the process management service can find the target shared data from the shared memory (i.e., the shared memory stores the target shared data), the data storage management service can process the target shared data based on the target data processing policy. In another possible case, if the process management service cannot find the target shared data from the shared memory (i.e., the shared memory does not store the target shared data), the process management service may return the first prompt message to the first process. The first prompt message is used for prompting that the first process target shared data does not exist.

In another embodiment of the present application, if the identity verification of the first process is successful, the terminal device may execute S2031 to S2033 shown in fig. 3, which are detailed as follows:

s2031: determining a second identification of the target shared data in the first process based on the first identification.

S2032: and judging whether the target shared data is included in the first process or not based on the second identification.

S2033: and if the first process comprises the target shared data, processing the target shared data in the first process based on the target data processing strategy, and synchronizing the processed target shared data into the shared memory.

In this embodiment, the terminal device may invoke the process management service to execute S2031 to S2032, and invoke the process management service and the data storage management service to execute S2033.

Specifically, if the identity of the first process is successfully checked by the process management service, the process management service may determine, based on a first identifier of the target shared data and a correspondence between an identifier of each piece of shared data, which is stored in advance in the terminal device, in the shared memory and an identifier of each piece of target shared data in the first process, a second identifier of the target shared data in the first process.

After the process management service determines the second identifier of the target shared data in the first process, it may determine whether the first process includes the target shared data based on the second identifier. In one possible case, if the process management service can find the target shared data from the first process based on the second identifier, the process management service determines that the target shared data is included in the first process. In another possible case, if the process management service cannot find the target shared data from the first process based on the second identifier, the process management service determines that the target shared data is not included in the first process.

In a possible implementation manner, if the first process includes the target shared data, the data storage management service may process the target shared data in the first process based on the target data processing policy, and synchronize the processed target shared data to the shared memory.

In another possible implementation manner, if the first process does not include the target shared data, the terminal device may execute S2034 to S2035 shown in fig. 3, that is, after S2032, the method for sharing data across processes may further include S2034 to S2035, which is detailed as follows:

s2034: and if the target shared data is not included in the first process, judging whether the shared memory stores the target shared data or not based on the first identifier.

S2035: and if the target shared data are stored in the shared memory, processing the target shared data stored in the shared memory based on the target data processing strategy.

S2036: and if the target shared data is not stored in the shared memory, returning first prompt information to the first process, wherein the first prompt information is used for prompting that the target shared data does not exist.

In this embodiment, if the first process does not include the target shared data, the process management service may determine whether the shared memory stores the target shared data based on the first identifier of the target shared data.

In a possible case, if the process management service determines that the target shared data is stored in the shared memory, the data storage management service may process the target shared data stored in the shared memory based on the target data processing policy. In another possible case, if the process management service determines that the target shared data is not stored in the shared memory, the process management service may return first prompt information to the first process to prompt that the target shared data does not exist in the first process.

S204: and synchronizing the processed target shared data to each target process, wherein the target process is a process which acquires the target shared data, and the target process comprises the first process.

In this embodiment of the application, the terminal device may invoke the data storage management service to execute S204, that is, the data storage management service may synchronize the processed target shared data to each process that has acquired the target shared data. The process of acquiring the target shared data may include the first process and any other process except the first process.

In a possible implementation manner, if the terminal device executes the step S2033 (i.e. processes the target shared data in the first process), the data storage management service may not synchronize the processed target shared data stored in the shared memory to the first process.

In another possible case, if the terminal device does not execute S2033, but directly processes the target shared data stored in the shared memory, the data storage management service needs to synchronize the processed target shared data stored in the shared memory to the first process.

As can be seen from the above, in the method for sharing data across processes provided in this embodiment, because the data processing request initiated by the first process carries the first token, and when the data processing request initiated by the first process is received, the identity of the first process is verified based on the first token, and after the identity is successfully verified, the target shared data stored in the shared memory is processed based on the target data processing policy carried in the data processing request, that is, the target shared data is processed only when the first process has the right to process the target shared data, so that the security of the shared data is improved; after the target shared data is processed, the processed target shared data is synchronized to each process which acquires the target shared data, so that the consistency of the target shared data in different processes is ensured, and the atomicity of the target shared data is improved.

Referring to fig. 4, fig. 4 is a schematic flowchart of a data cross-process sharing method according to another embodiment of the present application. As shown in fig. 4, the difference between this embodiment and the embodiment corresponding to fig. 2 is that this embodiment may further include S205 after S202, which is detailed as follows:

s205: and if the identity verification fails, returning second prompt information to the first process, wherein the second prompt information is used for prompting that the first process does not have the authority for processing the target shared data.

In this embodiment, the terminal device may invoke the process management service to execute S205, that is, if the identity verification of the first process fails, the process management service may return the second prompt message to the first process to prompt that the first process has no authority to process the target shared data.

As can be seen from the above, in the data cross-process sharing method provided in this embodiment, when the first process does not have the right to process the target shared data, the first process may be prompted, so that the first process may know the reason why the first process cannot process the target shared data.

Referring to fig. 4, in another embodiment of the present application, after S203, the method for data cross-process sharing may further include S206, which is detailed as follows:

s206: and storing the processed target shared data into a first database.

In this embodiment, the terminal device may invoke the data storage management service to execute S206, that is, the data storage management service may store the processed target shared data in the first database.

The first data may be a distributed database or a centralized database, and the type of the first database is not particularly limited herein.

It should be noted that, the terminal device may perform S205 first, and then perform S206; alternatively, the terminal device may perform S206 first, and then perform S205; alternatively, the terminal device may perform S205 and S206 simultaneously.

As can be seen from the above, in the method for sharing data across processes provided in this embodiment, since the shared data is backed up in the first database, when the shared data stored in the shared memory is lost, the terminal device may obtain the shared data from the first database and copy the shared data to the shared memory, so that it can be ensured that the shared data is recovered in time when the shared data in the shared memory has a problem.

It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.

Based on the method for data cross-process sharing provided by the above embodiment, the embodiment of the present invention further provides an embodiment of a terminal device implementing the above method embodiment. Referring to fig. 5, fig. 5 is a schematic structural diagram of a terminal device according to another embodiment of the present application. For convenience of explanation, only the portions related to the present embodiment are shown. As shown in fig. 5, the terminal device 50 may include: a request processing unit 51, an identity verification unit 52, a data processing unit 53 and a data synchronization unit 54. Wherein:

the request processing unit 51 is configured to receive a data processing request from a first process, where the data processing request carries a first token, a first identifier of target shared data to be processed, and a target data processing policy of the target shared data.

The identity verification unit 52 is configured to verify the identity of the first process based on the first token.

The data processing unit 53 is configured to, if the identity verification is successful, search the target shared data from the shared memory based on the first identifier, and process the target shared data based on the target data processing policy.

The data synchronization unit 54 is configured to synchronize the processed target shared data to each target process, where the target process is a process that has acquired the target shared data, and the target process includes the first process.

Optionally, the first identifier is an identifier of the target shared data in a shared memory. Correspondingly, the data processing unit 53 may specifically include: the device comprises a first determining unit, a first judging unit and a first processing unit. Wherein:

the first determination unit is used for determining a second identification of the target shared data in the first process based on the first identification.

The first judging unit is used for judging whether the target shared data is included in the first process or not based on the second identifier.

The first processing unit is configured to, if the first process includes the target shared data, process the target shared data in the first process based on the target data processing policy, and synchronize the processed target shared data to the shared memory.

Optionally, the first determining unit may specifically include: the device comprises a data judgment unit and a second processing unit. Wherein:

the data determining unit is configured to determine whether the shared memory stores the target shared data based on the first identifier if the first process does not include the target shared data.

The second processing unit is configured to, if the target shared data is stored in the shared memory, process the target shared data stored in the shared memory based on the target data processing policy.

Optionally, the first determining unit further includes a first prompting unit.

The first prompting unit is configured to return first prompting information to the first process if the target shared data is not stored in the shared memory, where the first prompting information is used to prompt that the target shared data does not exist.

Optionally, the terminal device further includes a data backup unit.

The data backup unit is used for storing the processed target shared data into a first database.

Optionally, the data processing request further carries an identity of the first process. Correspondingly, the identity verification unit 52 may specifically include: the device comprises an analysis unit and a verification unit. Wherein:

the analysis unit is used for analyzing the first token based on a preset decryption strategy to obtain the validity period of the first token and the identity of one process.

And the verification unit is used for confirming that the identity verification is successful if the current time is within the validity period and the identity of the process obtained by analysis is the same as the identity of the first process carried in the data processing request.

Optionally, the terminal device further includes a second prompting unit.

And the second prompting unit is used for returning second prompting information to the first process if the identity verification fails, wherein the second prompting information is used for prompting that the first process does not have the authority of processing the target shared data.

It should be noted that, because the contents of information interaction, execution process, and the like between the modules are based on the same concept as that of the embodiment of the method of the present application, specific functions and technical effects thereof may be referred to specifically in the embodiment of the method, and are not described herein again.

It is obvious to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional units and modules is merely used as an example, and in practical applications, the above function distribution may be performed by different functional units and modules as needed, that is, the internal structure of the terminal device is divided into different functional units or modules to perform all or part of the above described functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.

Referring to fig. 6, fig. 6 is a schematic structural diagram of a terminal device according to another embodiment of the present application. As shown in fig. 6, the terminal device 6 provided in this embodiment may include: a processor 60, a memory 61, and a computer program 62 stored in the memory 61 and operable on the processor 60, such as a program corresponding to a method of data cross-process sharing. The processor 60, when executing the computer program 62, implements the steps in the above-described method embodiments of data sharing across processes, such as S201 to S204 shown in fig. 2. Alternatively, the processor 60, when executing the computer program 62, implements the functions of the modules/units in the terminal device embodiments described above, such as the functions of the units 51-54 shown in fig. 5.

Illustratively, the computer program 62 may be divided into one or more modules/units, which are stored in the memory 61 and executed by the processor 60 to accomplish the present application. One or more of the modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 62 in the terminal device 6. For example, the computer program 62 may be divided into a request processing unit, an identity checking unit, a data processing unit and a data synchronization unit, and the specific functions of each unit are described with reference to the related description in the embodiment corresponding to fig. 5, which is not described herein again.

Those skilled in the art will appreciate that fig. 6 is merely an example of a terminal device 6 and does not constitute a limitation of terminal device 6, and may include more or less components than those shown, or some components in combination, or different components.

The processor 60 may be a Central Processing Unit (CPU), other general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.

The storage 61 may be an internal storage unit of the terminal device 6, such as a hard disk or a memory of the terminal device 6. The memory 61 may also be an external storage device of the terminal device 6, such as a plug-in hard disk, a Smart Memory Card (SMC), a Secure Digital (SD) card, or a flash memory card (flash card) provided on the terminal device 6. Further, the memory 61 may also include both an internal storage unit of the terminal device 6 and an external storage device. The memory 61 is used for storing computer programs and other programs and data required by the terminal device. The memory 61 may also be used to temporarily store data that has been output or is to be output.

The embodiments of the present application further provide a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

The embodiments of the present application provide a computer program product, which when running on a terminal device, enables the terminal device to implement the steps in the above method embodiments when executed.

In the above embodiments, the description of each embodiment has its own emphasis, and parts that are not described or illustrated in a certain embodiment may refer to the description of other embodiments.

Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.

The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

18页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:移动存储设备的管理方法、装置及电子设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类