CN111858640A - Data management method, data management device, electronic equipment and storage medium - Google Patents

Data management method, data management device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111858640A
CN111858640A CN202010754374.8A CN202010754374A CN111858640A CN 111858640 A CN111858640 A CN 111858640A CN 202010754374 A CN202010754374 A CN 202010754374A CN 111858640 A CN111858640 A CN 111858640A
Authority
CN
China
Prior art keywords
data
edited
editing
queue
account
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010754374.8A
Other languages
Chinese (zh)
Other versions
CN111858640B (en
Inventor
周先花
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Ping An Smart Healthcare Technology Co ltd
Original Assignee
Ping An International Smart City Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An International Smart City Technology Co Ltd filed Critical Ping An International Smart City Technology Co Ltd
Priority to CN202010754374.8A priority Critical patent/CN111858640B/en
Publication of CN111858640A publication Critical patent/CN111858640A/en
Application granted granted Critical
Publication of CN111858640B publication Critical patent/CN111858640B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application is applicable to the technical field of big data, and provides a data management method and device, electronic equipment and a computer-readable storage medium. Wherein, the method comprises the following steps: when an editing instruction sent by a specified account is received, editing a database based on the editing instruction; after the database is successfully edited, determining data to be edited related to cache; acquiring a mark code of the data to be edited, and detecting whether the data to be edited exists in a preset queue or not according to the mark code, wherein the mark code is used for uniquely representing the data to be edited and the editing operation indicated by the editing instruction; and if the data to be edited does not exist in the queue, adding the data to be edited into the queue so as to edit the cache through the queue. The method and the device for cache synchronization can guarantee the consistency of the database and the cache, and avoid the problem of dirty reading when high-concurrency requests occur.

Description

Data management method, data management device, electronic equipment and storage medium
Technical Field
The present application relates to the field of big data technologies, and in particular, to a data management method, a data management apparatus, an electronic device, and a computer-readable storage medium.
Background
With the development of the internet, internet applications are used by more and more people, and the traditional relational database has been unconscious to the super-large scale and high concurrent requests, so more and more non-relational databases are used as caches to improve the system throughput, but the problem of inconsistency of the databases and the cached data is brought along. The currently common database and Cache synchronization scheme is a bypass Cache (Cache above Pattern), however, the synchronization scheme still has the possibility of failure in updating the Cache, which may cause the dirty read problem.
Disclosure of Invention
In view of this, embodiments of the present application provide a data management method, a data management apparatus, an electronic device, and a computer-readable storage medium, which can ensure consistency between a database and a cache and avoid a dirty read problem when a high-concurrency request occurs.
A first aspect of an embodiment of the present application provides a data management method, including:
when an editing instruction sent by a specified account is received, editing the database based on the editing instruction;
after the database is successfully edited, determining data to be edited related to cache;
acquiring a mark code of the data to be edited, and detecting whether the data to be edited exists in a preset queue or not according to the mark code, wherein the mark code is used for uniquely representing the data to be edited and the editing operation indicated by the editing instruction;
and if the data to be edited does not exist in the queue, adding the data to be edited into the queue so as to edit the cache through the queue.
A second aspect of an embodiment of the present application provides a data management apparatus, including:
the database editing unit is used for editing the database based on an editing instruction sent by a specified account when the editing instruction is received;
the data to be edited determining unit is used for determining the data to be edited related to the cache after the database is successfully edited;
a flag code acquiring unit, configured to acquire a flag code of the to-be-edited data, where the flag code is used to uniquely indicate the to-be-edited data and an editing operation indicated by the editing instruction;
a data detection unit, configured to detect whether the data to be edited already exists in a preset queue according to the flag code;
and the buffer editing unit is used for adding the data to be edited into the queue if the data to be edited does not exist in the queue so as to edit the buffer through the queue.
A third aspect of the embodiments of the present application provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the electronic device, where the processor implements the steps of the data management method provided in the first aspect when executing the computer program.
A fourth aspect of embodiments of the present application provides a computer-readable storage medium, which stores a computer program that, when executed by a processor, implements the steps of the data management method provided by the first aspect.
The data management method, the data management device, the electronic equipment and the computer readable storage medium provided by the embodiment of the application have the following beneficial effects: on one hand, after the database is successfully edited, namely after the database is updated, the cache is edited through the queue, so that the synchronous operation of the original unreliable cache and the database becomes reliable by means of a consumption retry mechanism of the queue, and the orderliness of the editing operation is improved; on the other hand, before the data to be edited is added into the queue, the mark code for uniquely representing the data to be edited and the editing operation indicated by the editing instruction is obtained, preliminary screening is performed based on the mark code, the same editing operation is prevented from being executed for multiple times, and therefore the efficiency of data caching 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 flowchart of an implementation of a data management method provided in an embodiment of the present application;
fig. 2 is a flowchart of another implementation of a data management method provided in an embodiment of the present application;
FIG. 3 is a flowchart of another implementation of a data management method according to an embodiment of the present application;
fig. 4 is a block diagram of a data management apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The data management method according to the embodiment of the present application may be applied to electronic devices, such as an electronic device, a desktop computer, a mobile phone, a tablet computer, a wearable device, an in-vehicle device, an Augmented Reality (AR)/Virtual Reality (VR) device, a notebook computer, a super-mobile personal computer (UMPC), a netbook, and a Personal Digital Assistant (PDA), and the embodiment of the present application does not limit the specific type of the electronic device.
Referring to fig. 1, fig. 1 is a flowchart illustrating an implementation of a data management method according to an embodiment of the present application. As shown in fig. 1, the data management method provided in this embodiment may include:
step 101, when an editing instruction sent by a specified account is received, editing a database based on the editing instruction;
in the embodiment of the application, an operator can log in an account of the operator and edit data stored in the database and the cache. Taking any account as a specific account as an example, the embodiment of the present application is described as follows: generally, the operator refers to the data in the cache by the specified account, and therefore, the editing instruction is also sent by the specified account based on the data in the cache; when the electronic device receives an editing instruction sent by a specified account, since the cache needs to be synchronized with the database, the electronic device will first edit the data in the database based on the editing instruction to update the database. Specifically, the electronic device may invoke a preset service (service) through a preset service interface, where the service may perform each step of the embodiment of the present application. The service can be regarded as a type of application, and the service provided by the embodiment of the application is used for realizing the updating and synchronization of data.
For example, if the edit instruction modifies the data a at the position P1 in the cache, the service will find the corresponding data in the database and modify the corresponding data in the database first; if the modification fails, the electronic equipment can output a database editing failure reminding message to the specified account so as to remind an operator of the current database editing failure.
In some embodiments, the service of the electronic device may preset a threshold of failure times; when the database is edited unsuccessfully, the service can repeatedly edit the database and record the failure times; if repeated editing of the database fails all the time, and the failure times reach the failure time threshold value, outputting a database editing failure reminding message to the specified account; and if the editing is successful before the failure times reach the failure time threshold value, stopping repeatedly editing the database and executing the subsequent steps.
In some embodiments, the editing operation that can be indicated by the editing instruction includes, but is not limited to, the following types: new, deleted or modified.
It should be noted that, since the database is edited after the editing instruction is received, the data in the cache is not updated; therefore, even if the editing of the database fails, the data synchronization of the database and the cache is not affected.
Step 102, after the database is successfully edited, determining data to be edited related to cache;
in the embodiment of the application, after the database is successfully edited, the service of the electronic device can continuously determine the data to be edited related to the cache based on the editing instruction; that is, it is determined which data needs to be edited in the cache, including the location of the data in the cache, the value before editing, the value after editing, and the like. The cache may be a redis cache, which is not limited herein.
103, acquiring a mark code of the data to be edited, and detecting whether the data to be edited exists in a preset queue or not according to the mark code;
in the embodiment of the application, the electronic device creates a queue in advance, and the queue stores data to be edited, which have not yet performed editing operation on the cache, that is, past data to be edited. For convenience of explanation, the data to be edited stored in the queue is recorded as history data to be edited. The service determines the sequence of the editing operation of the cache based on the data to be edited in each history according to the sequence of the data to be edited in each history entering the queue, and the sequence is represented as first-in first-out.
After the current data to be edited is obtained, considering that there may be more than one operator editing the data through the service (that is, there may be a situation of a high concurrent request), in order to avoid performing multiple read-write operations on the cache by the service, the embodiment of the present application obtains the mark code of the data to be edited, where the mark code is used to uniquely represent the data to be edited and the editing operation indicated by the editing instruction. Obviously, each historical data to be edited in the queue also has a corresponding mark code; therefore, whether the data to be edited already exists in the queue can be detected according to the mark code, which is specifically represented as: detecting whether the mark code of the current data to be edited is the same as the mark code of any historical data to be edited in the queue; if the mark code of the current data to be edited is the same as the mark code of any historical data to be edited in the queue, determining that the current data to be edited exists in the queue; and if the mark code of the current data to be edited is different from the mark codes of all the historical data to be edited in the queue, determining that the current data to be edited does not exist in the queue.
And 104, if the data to be edited does not exist in the queue, adding the data to be edited into the queue so as to edit the cache through the queue.
In the embodiment of the present application, as long as the current data to be edited does not exist in the queue, the current editing instruction may be considered as a new editing instruction, and at this time, the data to be edited may be added to the queue. Otherwise, when the current data to be edited already exists in the queue, the current data to be edited can be ignored in order to avoid repeated operation. Through the process, repeated execution of the same editing instruction can be avoided, and multiple times of reading and writing of the cache can be avoided.
The service of the electronic equipment can periodically scan whether the data to be edited (namely historical data to be edited) exists in the queue or not through the timing task. When historical data to be edited exist, taking out the historical data to be edited from the queue based on a first-in first-out principle, and editing the cache based on the taken-out historical data to be edited; if the edit to the cache fails (i.e., the update cache fails), the queue-based consumption retry mechanism retries the edit until the edit to the cache succeeds (i.e., the update cache succeeds).
As can be seen from the above, in the embodiment of the present application, on one hand, the cache is edited through the queue, and the original unreliable cache and the database synchronous operation become reliable by means of the consumption retry mechanism of the queue, and the ordering of the editing operation is improved; on the other hand, before the data to be edited is added into the queue, preliminary screening is performed, and the same editing operation is prevented from being executed for multiple times, so that the efficiency of data caching is improved.
Based on the above-described embodiments, the flag code may be generated according to a Cyclic Redundancy Check (CRC) algorithm. Referring to fig. 2, fig. 2 is a flowchart illustrating an implementation of another data management method according to an embodiment of the present application. As shown in fig. 2, the data management method provided in this embodiment may include:
step 201, when receiving an editing instruction sent by a specified account, editing a database based on the editing instruction;
step 202, after the database is successfully edited, determining data to be edited related to cache;
in the embodiment of the present application, steps 201 and 202 are the same as or similar to steps 101 and 102, respectively, and reference may be specifically made to the description related to steps 101 and 102, which is not repeated herein.
Step 203, generating a cyclic redundancy check code as a mark code of the data to be edited according to the data to be edited and the editing operation indicated by the editing instruction;
in this embodiment, the service of the electronic device may perform CRC check on the current data to be edited to generate a CRC check code. Of course, other check codes, such as hash check codes, may be generated alternatively, and are not limited herein. It should be noted that, in order to accurately locate which data needs to be edited, the data to be edited specifically includes the following information: data location and data related to editing operations; wherein, the data related to the editing operation comprises the edited data and/or the data before editing. Besides, the editing operation indicated by the editing instruction can be represented by the editing code; each editing code corresponds to an editing operation, and the operations corresponding to different editing codes are different. That is, the service of the electronic device may splice the editing code and the data to be edited in a preset order, and generate a CRC check code of the spliced data as a mark code of the data to be edited. For example, the preset sequence may be edit code-data position-data before editing-data after editing. For the case that the data before editing or the data after editing is empty, the splicing of the empty data can be directly skipped.
For example, for a modification operation, the corresponding edit code may be 1; the data before editing is A, and the data after editing is A'; the data location is at P1 in the cache (which may be a line or a column of a form in the cache); that is, the modify operation is: modifying the data A at P1 into data A'; when performing CRC check, the edit code 1, the data position P1, the data a before editing, and the data a ' after editing can be spliced to obtain 1-P1-a ', and generate a CRC check code corresponding to 1-P1-a '.
For a delete operation, its corresponding edit code may be 2; if the deleted data is B, the data before editing is B; the data location is in the cache at P2; that is, the delete operation is: delete data B at P2; when performing CRC check, the edit code 2, the data position P2, and the data B before editing may be spliced to obtain 2-P2-B, and generate a CRC check code corresponding to 2-P2-B.
For the new operation, the corresponding edit code may be 3; if the newly added data is C, the edited data is C; the data location is in the cache at P3; namely, the new adding operation is as follows: newly adding data C at P3; when performing CRC check, the edit code 3, the data position P3 and the edited data C can be spliced to obtain 3-P3-C, and a CRC check code corresponding to 3-P3-C is generated.
Step 204, respectively detecting whether the mark code contained in each task object in the queue is the same as the mark code of the data to be edited;
in the embodiment of the present application, the data to be edited (i.e., the historical data to be edited) stored in the queue is not simply the data to be edited for which the editing operation on the cache has not been performed yet, but is a task object; each task object is obtained by packaging historical data to be edited and a corresponding CRC check code. Based on this, after the CRC check code of the current data to be edited is obtained, the CRC check code may be sequentially compared with CRC check codes included in each task object in the queue to detect whether there is a repetition, that is, whether there is the same CRC check code.
Step 205, if the mark code included in each task object is different from the mark code of the data to be edited, determining that the data to be edited does not exist in the queue;
in this embodiment of the present application, if a CRC check code included in a task object already exists in a queue and is the same as a CRC check code of the current data to be edited, it may be considered that the data to be edited included in the task object is the same as the current data to be edited. In order to avoid repeated operations, the current data to be edited and the corresponding CRC check code may be discarded (i.e., ignored). On the contrary, if the CRC check code included in each task object is different from the CRC check code of the current data to be edited, it may be determined that the current data to be edited does not exist in the queue.
Step 206, if the data to be edited does not exist in the queue, packaging the data to be edited and the mark code of the data to be edited into a new task object;
in the embodiment of the present application, when it is determined that the current data to be edited does not exist in the queue, the current data to be edited and the corresponding CRC check code may be packaged as a new task object.
Step 207, store the new task object into the tail of the queue.
In this embodiment, the new task object may be stored at the tail of the queue, and wait for the service of the electronic device to perform a corresponding editing operation on the buffer for the new task object according to a first-in first-out principle. Meanwhile, the new task object is stored at the tail of the queue, so that a comparison basis can be provided for judging whether the same editing operation exists in the subsequent comparison.
As can be seen from the above, in the embodiment of the present application, the efficiency of performing the presence check on the queue is improved by the CRC check technology; and the buffer is edited by combining the queue, so that the data consistency of the buffer and the database is ensured.
On the basis of the embodiments described above, the data can be further managed according to the rights possessed by the operator. Referring to fig. 3, fig. 3 is a flowchart illustrating an implementation of another data management method according to an embodiment of the present application. As shown in fig. 3, the data management method provided in this embodiment may include:
step 301, when receiving a lookup request sent by the specified account, acquiring the authority of the specified account;
in the embodiment of the present application, considering that the number of operators facing the database and the cache is large, the account of each operator may have different permissions. For example, an enterprise defines that certain accounts can only access data of the department; some account numbers can only refer to data and cannot edit the data; accounts under certain governing bodies can access all data and the like. Therefore, when receiving a data reference request sent by a specific account, the electronic device may first acquire the authority of the specific account. For example, the electronic device may be obtained by looking up in a configured account-permission table according to the specified account.
In some embodiments, in order to enhance flexibility of the permission usage, the specified account may be granted with a temporary permission, and the data lookup request may carry the permission range of the temporary permission and the issuing account of the temporary permission (i.e. which account grants the temporary permission), and record the permission range and the issuing account of the temporary permission in the permission change log.
Step 302, determining the accessible data and editable data of the specified account in the cache based on the authority;
in the embodiment of the application, according to the authority of the specified account, the accessible data and the editable data of the specified account in the cache can be determined; accessible data, namely data which can be referred by an operator, and has a reference authority; the editable data, namely the data which can be consulted and edited by an operator, has editing authority. Typically, the range of editable data is necessarily less than or equal to the range of accessible data.
Step 303, pushing the accessible data to the specified account;
in the embodiment of the application, if the reference request sent by the specified account does not indicate the data to be referred, all accessible data can be directly pushed to the specified account; on the contrary, if the reference request sent by the specified account already indicates the data to be referred to, that is, if the specified account is a reference request sent for specific data, the electronic device may first detect whether the data to be referred to belongs to accessible data; if so, pushing the data to be consulted to the specified account; if not, an authority prompt is output to the specified account number to prompt that an operator operating the specified account number does not have the operation authority.
Step 304, when receiving an editing instruction input by the specified account based on the accessible data, detecting whether data pointed by the editing instruction is editable data;
in the embodiment of the application, when the electronic device receives again an editing instruction input by the specified account based on the accessible data, considering that the range of editable data and the range of accessible data are often different, the electronic device may detect whether the data pointed by the editing instruction is editable data; that is, it is detected whether the data to be edited by the edit instruction is editable data.
In step 305, if the data pointed by the editing instruction is editable data, the database is edited based on the editing instruction.
In the embodiment of the present application, if the data pointed by the editing instruction is editable data, the corresponding data in the database can be found based on the editing instruction, and the database is edited based on the corresponding data, and then the subsequent steps are executed. On the contrary, if the data pointed by the editing instruction is not editable data, an authority prompt is output to the specified account number to prompt an operator operating the specified account number not to have the operation authority.
Step 306, after the database is successfully edited, determining data to be edited related to the cache;
step 307, acquiring a mark code of the data to be edited, and detecting whether the data to be edited already exists in a preset queue according to the mark code;
step 308, if the data to be edited does not exist in the queue, adding the data to be edited into the queue, so as to edit the cache through the queue.
In the embodiment of the present application, steps 306, 307, and 308 are the same as or similar to steps 102, 103, and 104, respectively, and reference may be specifically made to the related descriptions of steps 102, 103, and 104, which are not repeated herein.
In some embodiments, the electronic device may preset a number threshold N, where N is a positive integer, for example, N may be 5. When the electronic device receives an editing instruction sent by the specified account for data without editing authority, updating the editing times (specifically, adding 1 to the editing times) based on the specified account and the editing instruction; if the editing instruction sent by the specified account aiming at the data without the editing authority is received for N times, namely if the editing times reach N, packaging the editing instruction and the data pointed by the editing instruction into a temporary authority request, sending the temporary authority request to a higher-level account of the specified account, and confirming whether to issue temporary authority to the specified account by an operator of the higher-level account; generally, the operator of the higher-level account is considered as a supervisor or leader of the operator of the specified account; if the upper-level account is confirmed, that is, if the upper-level account feeds back an authorization confirmation message to the electronic device based on the temporary authorization request, the electronic device may receive an editing instruction of the specified account and perform the subsequent steps (i.e., steps 305 to 308); on the contrary, if the upper-level account rejects, that is, if the upper-level account requests the electronic device to feed back an authorization reject message based on the temporary authorization request, the electronic device may output an authorization prompt to the specified account, and may pull the specified account into a blacklist within a preset time period (e.g., within 3 hours). And after the electronic equipment receives the feedback of the superior account, the editing times can be reset and cleared.
In some embodiments, the data management method further includes:
marking the edited data in the cache;
and if a consulting request aiming at the edited data is received, pushing the marked edited data.
In order to avoid frequently editing the same data in a short time due to problems such as information lag between different operators, the edited data of the current time can be marked in the cache after the database and the cache are updated each time. The electronic device may first obtain edit time, an edit initiation account, and comparison content of the edited data, where the comparison content includes data before editing and data after editing (i.e., the edited data itself), and then mark, such as a highlight mark, the edited data according to the edit time, the edit initiation account, and the comparison content; when a query request of any account for edited data is received, the marked edited data is pushed to the account, that is, the editing time, the editing initiating account and the comparison content of the edited data are pushed to the account. For the query request of the edited data, there are two application scenarios: one is that the refer request does not indicate data to be referred to; the other is that the reference request has specified data to be referred to, and the data to be referred to includes the edited data. Of course, in the case of authority management, it is also necessary that the account has a reference authority for the edited data, so that the marked edited data can be pushed to the account. It should be noted that the data before editing corresponding to the new adding operation is empty, and the data after editing corresponding to the deleting operation is empty. Therefore, the operator can see the previous editing records of the data by other operators, so as to measure whether the data still needs to be edited or not, and the problem that the data is frequently edited due to the asynchronous information among different operators can be reduced.
Therefore, in the embodiment of the application, the data in the database and the cache are managed more orderly in combination with the permission, and the data security of the database and the cache can be guaranteed while the data consistency of the database and the cache is guaranteed. And the superior account can issue temporary authority to the subordinate account if necessary, so that the flexibility of data management is improved.
In some embodiments, after the electronic device successfully edits the cache and the database, the electronic device may record the editing operation of the cache and the database into the data update log, and notify a backend person to check the cache and the database based on the data update log at a specified time, so as to further ensure the synchronization of the data.
In some embodiments, the electronic device may chain store the database in a Blockchain (Blockchain).
In order to ensure the safety of data and the fairness and transparency to operators, the database can be stored through a block chain. The background personnel can then consult the database from the blockchain through the respective device to verify that the database has been tampered with. The blockchain in this embodiment is a novel application mode that uses computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, and an encryption algorithm. The block chain, which is essentially a decentralized database, is a string of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, which is used for verifying the validity (anti-counterfeiting) of the information and generating a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Referring to fig. 4, fig. 4 is a block diagram of a data management apparatus according to an embodiment of the present disclosure. In this embodiment, each unit included in the data management apparatus is configured to execute each step in the data management method embodiment, and refer to the relevant description in the embodiment corresponding to the data management method. For convenience of explanation, only the portions related to the present embodiment are shown.
Referring to fig. 4, the data management apparatus 4 includes:
a database editing unit 401, configured to, when receiving an editing instruction sent by a specific account, edit a database based on the editing instruction;
a to-be-edited data determining unit 402, configured to determine to-be-edited data related to the cache after the database is successfully edited;
a flag code obtaining unit 403, configured to obtain a flag code of the data to be edited, where the flag code is used to uniquely indicate the data to be edited and an editing operation indicated by the editing instruction;
a data detecting unit 404, configured to detect whether the data to be edited already exists in a preset queue according to the flag code;
a buffer editing unit 405, configured to add the data to be edited into the queue to edit the buffer through the queue if the data to be edited does not exist in the queue.
As an embodiment of the present application, the mark code obtaining unit 403 is specifically configured to generate a cyclic redundancy check code as a mark code of the data to be edited according to the data to be edited and the editing operation indicated by the editing instruction;
accordingly, the data detection unit 404 includes:
a first detecting subunit, configured to detect whether a flag code included in each task object in the queue is the same as a flag code of the data to be edited;
a determining subunit, configured to determine that the data to be edited does not exist in the queue if the flag code included in each task object is different from the flag code of the data to be edited;
accordingly, the cache editing unit 405 includes:
a packing subunit, configured to pack, if the to-be-edited data does not exist in the queue, the to-be-edited data and the marker code of the to-be-edited data as a new task object;
and the storage subunit is used for storing the new task object into the tail part of the queue.
As an embodiment of the present application, the data management apparatus 4 further includes:
the authority acquisition unit is used for acquiring the authority of the specified account when receiving a reference request sent by the specified account;
the data determining unit is used for determining the accessible data and the editable data of the specified account in the cache based on the authority;
a data pushing unit, configured to push the accessible data to the specified account;
accordingly, the database editing unit 401 includes:
a second detecting subunit, configured to detect, when an editing instruction input by the designated account based on the accessible data is received, whether data pointed by the editing instruction is editable data;
and the database editing subunit is used for editing the data in the database based on the editing instruction if the data pointed by the editing instruction is editable data.
As an embodiment of the present application, the database editing unit 401 further includes:
a request packaging subunit, configured to package, if the data pointed by the editing instruction is not editable data, the account information of the specified account and the editing instruction as a temporary permission request;
a request sending subunit, configured to send the temporary permission request to a higher-level account of the specified account;
and the prompt output subunit is used for outputting a permission prompt to the specified account if receiving a permission rejection message fed back by the superior account based on the temporary permission request.
As an embodiment of the present application, the temporary permission request packing subunit further includes:
an edit frequency updating subunit, configured to update the edit frequency according to the specified account and the edit instruction if the data pointed by the edit instruction is not editable data;
and a temporary permission request packaging subunit, configured to package, if the editing times reach a preset time threshold, the account information of the specified account and the editing instruction into a temporary permission request.
As an embodiment of the present application, the data management apparatus 4 further includes:
a marking unit, configured to mark the edited data in the cache;
and the pushing unit is used for pushing the marked edited data to the account if a consulting request of any account for the edited data is received.
As an embodiment of the present application, the marking unit includes:
an information obtaining subunit, configured to obtain editing time of the edited data, an editing initiation account, and comparison content, where the comparison content includes data before editing and data after editing;
and a data marking subunit, configured to mark the edited data according to the editing time, the editing initiation account, and the comparison content.
As an embodiment of the present application, the database is stored in a block chain.
As can be seen from the above, in the embodiment of the present application, on one hand, the data management apparatus edits the cache through the queue, and can make the synchronous operation between the originally unreliable cache and the database become reliable by means of the consumption retry mechanism of the queue, and improve the ordering of the editing operation; on the other hand, the data management device performs preliminary screening before adding the data to be edited into the queue, so as to prevent the same editing operation from being executed for multiple times, thereby improving the efficiency of data caching. Furthermore, the data management device also improves the efficiency of performing existence check on the queue through a CRC (cyclic redundancy check) technology; and moreover, the data in the database and the cache are managed more orderly in combination with the authority, so that the data consistency of the database and the cache can be guaranteed, and the data safety of the database and the cache can be guaranteed.
It should be noted that, because the contents of information interaction, execution process, and the like between the above units are based on the same concept, specific functions and technical effects thereof may be referred to in the method embodiment section, and are not described herein again.
Fig. 5 is a schematic structural diagram of an electronic device according to another embodiment of the present application. As shown in fig. 5, the electronic apparatus 5 of this embodiment includes: a processor 51, a memory 52 and a computer program 53, such as a program of a data management method, stored in the memory 52 and executable on the processor 51. The processor 51 implements the steps in the embodiments of the data management methods described above, such as the steps 101 to 104 shown in fig. 1, when executing the computer program 53 described above. Alternatively, when the processor 51 executes the computer program 53, the functions of the units in the embodiment corresponding to fig. 4, for example, the functions of the units 401 to 405 shown in fig. 4, are implemented, for which reference is specifically made to the relevant description in the embodiment corresponding to fig. 4, which is not repeated herein.
Illustratively, the computer program 53 may be divided into one or more units, and the one or more units are stored in the memory 52 and executed by the processor 51 to complete the present application. The one or more units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 53 in the electronic device 50. For example, the computer program 53 may be divided into a database editing unit, a data to be edited determining unit, a flag code acquiring unit, a data detecting unit, and a cache editing unit, each of which functions as described above.
The electronic device may include, but is not limited to, a processor 51 and a memory 52. It will be appreciated by those skilled in the art that fig. 5 is merely an example of the electronic device 5 and does not constitute a limitation of the electronic device 5 and may include more or less components than shown, or combine certain components, or different components, e.g. the above-described turntable device may also include input-output devices, network access devices, buses, etc.
The Processor 51 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 52 may be an internal storage unit of the electronic device 5, such as a hard disk or a memory of the electronic device 5. The memory 52 may be an external storage device of the electronic device 5, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device 5. Further, the memory 52 may include both an internal storage unit and an external storage device of the electronic device 5. The memory 52 is used to store the computer program and other programs and data required by the turntable device. The memory 52 described above may also be used to temporarily store data that has been output or is to be output.
As can be seen from the above, in the embodiment of the application, on one hand, the electronic device edits the cache through the queue, and by means of a consumption retry mechanism of the queue, the original unreliable cache and the database synchronous operation become reliable, and the ordering of the editing operation is improved; on the other hand, the electronic device performs preliminary screening before adding the data to be edited into the queue, so as to prevent the same editing operation from being executed for multiple times, thereby improving the efficiency of data caching. Furthermore, the electronic equipment also improves the efficiency of performing existence check on the queue through a CRC (cyclic redundancy check) technology; and moreover, the data in the database and the cache are managed more orderly in combination with the authority, so that the data consistency of the database and the cache can be guaranteed, and the data safety of the database and the cache can be guaranteed.
An embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program can implement the steps in the data management method embodiments.
The embodiments of the present application provide a computer program product, which, when running on an electronic device, enables the electronic device to implement the steps in the above-mentioned data management method embodiments when executed.
The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit 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.

Claims (10)

1. A method for managing data, comprising:
when an editing instruction sent by a specified account is received, editing a database based on the editing instruction;
after the database is successfully edited, determining data to be edited related to cache;
acquiring a mark code of the data to be edited, and detecting whether the data to be edited exists in a preset queue or not according to the mark code, wherein the mark code is used for uniquely representing the data to be edited and the editing operation indicated by the editing instruction;
and if the data to be edited does not exist in the queue, adding the data to be edited into the queue so as to edit the cache through the queue.
2. The data management method according to claim 1, wherein the obtaining of the flag code of the data to be edited and the detecting of whether the data to be edited already exists in a preset queue according to the flag code comprise:
generating a cyclic redundancy check code as a mark code of the data to be edited according to the data to be edited and the editing operation indicated by the editing instruction;
respectively detecting whether the mark codes contained in each task object in the queue are the same as the mark codes of the data to be edited;
if the mark code contained in each task object is different from the mark code of the data to be edited, determining that the data to be edited does not exist in the queue;
correspondingly, if the data to be edited does not exist in the queue, adding the data to be edited into the queue, including:
if the data to be edited does not exist in the queue, packaging the data to be edited and the mark code of the data to be edited into a new task object;
and storing the new task object into the tail part of the queue.
3. The data management method of claim 1, wherein the database is stored in a block chain, the data management method further comprising:
when a reference request sent by the specified account is received, acquiring the authority of the specified account;
determining accessible data and editable data of the specified account in the cache based on the permission;
pushing the accessible data to the specified account;
correspondingly, when an editing instruction sent by a specified account is received, the editing of the database based on the editing instruction includes:
when an editing instruction input by the specified account based on the accessible data is received, detecting whether data pointed by the editing instruction is editable data;
and if the data pointed by the editing instruction is editable data, editing the database based on the editing instruction.
4. The data management method according to claim 3, wherein after said detecting whether the data pointed to by the edit instruction is editable data, the data management method further comprises:
if the data pointed by the editing instruction is not editable data, packaging the account information of the specified account and the editing instruction into a temporary permission request;
sending the temporary permission request to a superior account of the specified account;
and if an authority rejection message fed back by the superior account based on the temporary authority request is received, an authority prompt is output to the specified account.
5. The data management method according to claim 4, wherein if the data pointed to by the edit instruction is not editable data, packaging the account information of the specified account and the edit instruction as a temporary permission request, including:
if the data pointed by the editing instruction is not editable data, updating the editing times according to the specified account and the editing instruction;
and if the editing times reach a preset time threshold value, packaging the account information of the specified account and the editing instruction into a temporary permission request.
6. The data management method of claim 1, wherein the data management method further comprises:
marking the edited data in the cache;
and if a query request of any account for the edited data is received, pushing the marked edited data to the account.
7. The data management method of claim 6, wherein marking the edited data in the cache comprises:
acquiring the editing time, the editing initiating account and comparison content of the edited data, wherein the comparison content comprises data before editing and data after editing;
and marking the edited data according to the editing time, the editing initiating account and the comparison content.
8. A data management apparatus, comprising:
the database editing unit is used for editing the database based on an editing instruction sent by a specified account when the editing instruction is received;
the data to be edited determining unit is used for determining the data to be edited related to the cache after the database is successfully edited;
a flag code acquiring unit, configured to acquire a flag code of the data to be edited, where the flag code is used to uniquely represent the data to be edited and an editing operation indicated by the editing instruction;
the data detection unit is used for detecting whether the data to be edited exists in a preset queue or not according to the mark code;
and the cache editing unit is used for adding the data to be edited into the queue if the data to be edited does not exist in the queue so as to edit the cache through the queue.
9. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the steps of the method according to any of claims 1 to 7 are implemented when the computer program is executed by the processor.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
CN202010754374.8A 2020-07-30 2020-07-30 Data management method, data management device, electronic equipment and storage medium Active CN111858640B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010754374.8A CN111858640B (en) 2020-07-30 2020-07-30 Data management method, data management device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010754374.8A CN111858640B (en) 2020-07-30 2020-07-30 Data management method, data management device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111858640A true CN111858640A (en) 2020-10-30
CN111858640B CN111858640B (en) 2024-05-10

Family

ID=72945290

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010754374.8A Active CN111858640B (en) 2020-07-30 2020-07-30 Data management method, data management device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111858640B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009151585A (en) * 2007-12-21 2009-07-09 Duaxes Corp Database access control device
CN102591855A (en) * 2012-01-13 2012-07-18 广州从兴电子开发有限公司 Data identification method and data identification system
CN108804464A (en) * 2017-05-03 2018-11-13 中兴通讯股份有限公司 Data consistency detection, device, distributed data base and storage medium
CN109857812A (en) * 2019-02-27 2019-06-07 珠海天燕科技有限公司 A kind of method and apparatus handling data in caching
CN109871705A (en) * 2017-12-01 2019-06-11 中国移动通信集团广东有限公司 A kind of database update method and system
CN111131076A (en) * 2019-12-09 2020-05-08 深圳震有科技股份有限公司 Multipurpose data receiving method and system based on message queue and computer equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009151585A (en) * 2007-12-21 2009-07-09 Duaxes Corp Database access control device
CN102591855A (en) * 2012-01-13 2012-07-18 广州从兴电子开发有限公司 Data identification method and data identification system
CN108804464A (en) * 2017-05-03 2018-11-13 中兴通讯股份有限公司 Data consistency detection, device, distributed data base and storage medium
CN109871705A (en) * 2017-12-01 2019-06-11 中国移动通信集团广东有限公司 A kind of database update method and system
CN109857812A (en) * 2019-02-27 2019-06-07 珠海天燕科技有限公司 A kind of method and apparatus handling data in caching
CN111131076A (en) * 2019-12-09 2020-05-08 深圳震有科技股份有限公司 Multipurpose data receiving method and system based on message queue and computer equipment

Also Published As

Publication number Publication date
CN111858640B (en) 2024-05-10

Similar Documents

Publication Publication Date Title
KR102444033B1 (en) Commit protocol for synchronizing content items
US20190372769A1 (en) Blockchain-universal document identification
US20220075900A1 (en) Tracing objects across different parties
US20230289336A1 (en) Systems, devices, and methods for tracking creation and modification of digital records
CN109359283B (en) Summarizing method of form data, terminal equipment and medium
CN108667917B (en) Method and device for realizing data storage, computer storage medium and terminal
Burri et al. Chronological independently verifiable electronic chain of custody ledger using blockchain technology
US20010039545A1 (en) Method of managing an electronic file and a computer program product
US20110185136A1 (en) Moving large dynamic datasets via incremental change synchronization
CN106020858A (en) Method, terminal and system for downloading and installation of application program
CN111984601A (en) Log file deleting method and device, electronic equipment and storage medium
CN112329043A (en) Information encryption processing method, device, computer equipment and medium
CN115185967A (en) Data processing method and device, electronic equipment and storage medium
CN107316176A (en) The control method and device of declaration form processing
CN110032834B (en) System authorization control method, terminal equipment and storage medium
CN111858640B (en) Data management method, data management device, electronic equipment and storage medium
CN111930890A (en) Information sending method and device, terminal equipment and storage medium
US20080155352A1 (en) Method and system for carrying out an operation based on a log record of a computer program
US20070174571A1 (en) Binding a protected application program to shell code
CN112835854A (en) File storage method and device, electronic equipment and storage medium
JP2010061200A (en) Document management system and operation history display method
EP2945109A1 (en) Method and apparatus for handling digital assets in an assets-based workflow
US20240160702A1 (en) Method for managing document to be cleaned based on metadata of secure document, apparatus for the same, computer program for the same, and recording medium storing computer program thereof
CN117236889A (en) Method, device and equipment for processing resources
CN107659539A (en) Method for auditing safely and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20220921

Address after: Room 2601 (Unit 07), Qianhai Free Trade Building, No. 3048, Xinghai Avenue, Nanshan Street, Qianhai Shenzhen-Hong Kong Cooperation Zone, Shenzhen, Guangdong 518000

Applicant after: Shenzhen Ping An Smart Healthcare Technology Co.,Ltd.

Address before: 1-34 / F, Qianhai free trade building, 3048 Xinghai Avenue, Mawan, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong 518000

Applicant before: Ping An International Smart City Technology Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant