Data Reading and Writing Management Method, Device, Storage Medium, and Electronic Device

By managing the read and write operations of the browser page by preset threads, identifying and controlling the credential status information, the problem of local memory data exceptions under multiple processes is solved, and the accuracy and consistency of database data is achieved.

CN116842298BActive Publication Date: 2025-07-18HILLSTONE NETWORKS CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310935539.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-27
Publication Date
2025-07-18
Estimated Expiration
2043-07-27

AI Technical Summary

Technical Problem

In the case where multiple pages use multiple processes to read and write the local memory, data in the local memory abnormality occurs due to the random execution order between multiple processes.

Method used

By identifying stored credential status information through preset threads, the page can be allowed or blocked from reading and writing operations on the browser database, ensuring that only one process operates at the same time, using timers and levels to determine priority, and solving the problem of random execution order between multiple processes.

Benefits of technology

The accuracy of database data is achieved, data exceptions caused by multi-process randomness are avoided, and data integrity and consistency are ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116842298B_ABST
    Figure CN116842298B_ABST
Patent Text Reader

Abstract

The present application discloses a data reading and writing management method, device, storage medium, and electronic device. The method includes: when a preset thread receives a read / write operation request sent by a target page, identifying the status information of a credential stored in a preset thread file; when the status information is in a first state, sending the credential to the target page and changing the status information of the credential stored in the preset thread file from the first state to a second state; when the status information is in the second state, sending a prompt message to the target page. Through the present application, the problem in the related art that when multiple processes perform read / write operations on a local memory on multiple pages, the data in the local memory becomes abnormal due to the randomness of the execution order among the multiple processes is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and in particular, to a data reading and writing management method, device, storage medium, and electronic device. Background Art

[0002] LocalStorage is a storage device that can permanently store data on the local client browser. The data stored in LocalStorage will exist permanently unless manually cleared. Even after closing the browser, the previously saved data can still be read when the browser is opened again.

[0003] In a multi-page web browser application, there will be scenarios where multiple pages simultaneously respond to read and write operations on LocalStorage. For example, when the client receives a push message and stores the message in LocalStorage, each page monitors the change in the message field in LocalStorage and simultaneously retrieves the corresponding message from LocalStorage and responds. However, if there is a scenario where multiple pages simultaneously perform write operations on LocalStorage, there are two cases: the multi-page belongs to a single process and the multi-page belongs to multiple processes.

[0004] In the case where the multi-page belongs to a single process, even if multiple pages simultaneously perform read and write operations on LocalStorage, since multiple pages need to use the same process for read and write operations, multiple pages must perform read and write operations on LocalStorage in the execution order, thereby ensuring the accuracy of the data in LocalStorage. However, in the case where the multi-page belongs to multiple processes, since there is no execution order between multiple processes, when multiple pages perform read and write operations on LocalStorage, there will be a phenomenon that the data in LocalStorage becomes abnormal due to the randomness of the execution order, thus affecting the user's use of the browser.

[0005] In view of the problem that in the case where multiple pages use multiple processes to perform read and write operations on LocalStorage in the related art, the data in LocalStorage becomes abnormal due to the randomness of the execution order between multiple processes, no effective solution has been proposed yet. Summary of the Invention

[0006] This application provides a data reading and writing management method, device, storage medium, and electronic device to solve the problem that in the case where multiple pages use multiple processes to perform read and write operations on LocalStorage in the related art, the data in LocalStorage becomes abnormal due to the randomness of the execution order between multiple processes.

[0007] According to one aspect of the present application, a data read-write management method is provided. The method includes: when a preset thread receives a read-write operation request sent by a target page, identifying the status information of a credential stored in a preset thread file, where the target page sends the read-write operation request through a first process; when the status information is in a first state, sending the credential to the target page and changing the status information of the credential stored in the preset thread file from the first state to a second state, where the credential is used to represent that the target page is allowed to perform a modification operation on the data in the browser's database, the first state represents that the database is in an idle state, and the second state represents that a second process is performing a modification operation on the database, and the second process is associated with a different page from the first process; when the status information is in the second state, sending a prompt message to the target page, where the prompt message is used to prompt the target page to resend the read-write operation request after a preset time interval.

[0008] Optionally, after changing the status information of the credential stored in the preset thread file from the first state to the second state, the method further includes: initializing a timer corresponding to the preset thread and starting the timer, where the timer is used to time the read-write operation of the target page; when the preset thread receives feedback information sent by the target page and the duration recorded by the timer does not reach a preset duration, changing the status information of the credential stored in the preset thread file from the second state to the first state; when the duration recorded by the timer reaches the preset duration and the preset thread does not receive the feedback information sent by the target page, determining that the data modification operation performed by the target page on the browser's database is abnormal, and changing the status information of the credential stored in the preset thread file from the second state to the first state.

[0009] Optionally, before the preset thread receives the read-write operation request sent by the target page, the method further includes: when the preset thread receives a first request sent by a first page, determining whether a second request sent by a second page is received within a target time interval; when the second request sent by the second page is received within the target time interval, determining the levels of the first page and the second page to obtain a first level and a second level; when the first level is greater than the second level, determining the first page as the target page; when the first level is less than the second level, determining the second page as the target page; when the first level is equal to the second level, determining any one of the first page and the second page as the target page.

[0010] Optionally, determining the levels of the first page and the second page includes: obtaining the preset levels of the first page and the second page from a preset thread file to obtain a first level and a second level; or obtaining the historical request sending times of the first page from the preset thread file to obtain a first number, and obtaining the historical request sending times of the second page to obtain a second number; determining the first level according to the first number, and determining the second level according to the second number.

[0011] Optionally, obtaining the historical request sending times of the first page from the preset thread file to obtain a first number, and obtaining the historical request sending times of the second page to obtain a second number includes: for any page, when a read / write operation request sent by the page is received and the status information of the credential is the second status, incrementing by 1 the historical request sending times associated with the page in the preset thread file; when a read / write operation request sent by the page is received and the status information of the credential is the first status, clearing the historical request sending times associated with the page in the preset thread file.

[0012] Optionally, the method further includes: when the status information of the credential is the first status and the preset thread receives feedback information sent by a third page, determining that there is an abnormality in the modification operation performed on the data in the database by the third page, and sending an alarm message, where the alarm message is used to indicate that there is an abnormality in the data in the database.

[0013] Optionally, when the preset thread receives a read / write operation request sent by a target page, the method further includes: parsing the read / write operation request to obtain the operation content, and determining whether the operation content is included in a preset table, where the preset table includes various operation contents; when the operation content is included in the preset table, performing the step of identifying the status information of the credential stored in the preset thread file; when the operation content is not included in the preset table, sending instruction information to the target page, where the instruction information is used to instruct the target page to perform a modification operation on the data in the browser's database.

[0014] According to another aspect of the present application, a data reading and writing management device is provided. The device includes: an identification unit, configured to identify the status information of a credential stored in a preset thread file when a read / write operation request sent by a target page is received by a preset thread, where the target page sends the read / write operation request through a first process; a first change unit, configured to send the credential to the target page and change the status information of the credential stored in the preset thread file from a first status to a second status when the status information is the first status, where the credential is used to represent that the target page is allowed to perform a modification operation on data in the database of the browser, the first status represents that the database is in an idle state, and the second status represents that a second process is performing a modification operation on the database, and the second process is associated with a different page from the first process; a first sending unit, configured to send a prompt message to the target page when the status information is the second status, where the prompt message is used to prompt the target page to resend the read / write operation request after a preset time interval.

[0015] According to another aspect of the present invention, a computer storage medium is further provided. The computer storage medium is used to store a program, where the program, when running, controls a device where the computer storage medium is located to execute a data reading and writing management method.

[0016] According to another aspect of the present invention, an electronic device is further provided, including one or more processors and a memory; computer-readable instructions are stored in the memory, and the processors are configured to run the computer-readable instructions, where the computer-readable instructions, when running, execute a data reading and writing management method.

[0017] Through this application, the following steps are adopted: when a preset thread receives a read / write operation request sent by a target page, identify the status information of the credential stored in the preset thread file, where the target page sends the read / write operation request through a first process; when the status information is in the first state, send the credential to the target page and change the status information of the credential stored in the preset thread file from the first state to the second state, where the credential is used to represent that the target page is allowed to perform a modification operation on the data in the browser's database, the first state represents that the database is in an idle state, and the second state represents that a second process is performing a modification operation on the database, and the second process is associated with different pages from the first process; when the status information is in the second state, send a prompt message to the target page, where the prompt message is used to prompt the target page to resend the read / write operation request after a preset time interval. This solves the problem in the related art that when multiple pages use multiple processes to perform read / write operations on a local memory, due to the randomness of the execution order between multiple processes, the data in the local memory appears abnormal. By using a preset thread to intercept the read / write operations sent by the target page and determining whether there is another process performing read / write operations on the data in the database at the current moment according to the status information stored in the preset thread file after the interception, it is allowed for the target page to perform read / write operations when there is no other process performing read / write operations, and it is not allowed to perform read / write operations on the data in the database when there is another process performing read / write operations, so as to sort the read / write operations of multiple processes according to the status information in the preset thread file, and thus achieve the effect of ensuring the accuracy of the data in the database. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The accompanying drawings forming a part of this application are used to provide a further understanding of this application. The schematic embodiments of this application and their descriptions are used to explain this application and do not constitute an improper limitation to this application. In the drawings:

[0019] Figure 1 is a flowchart of a data read / write management method provided by an embodiment of this application;

[0020] Figure 2 is a flowchart of an optional read / write operation on a page provided by an embodiment of this application;

[0021] Figure 3 is a flowchart of an optional operation flow of a preset thread provided by an embodiment of this application;

[0022] Figure 4 is a flowchart of an optional data read / write operation provided by an embodiment of this application;

[0023] Figure 5 is a flowchart of an optional data read / write management method provided by an embodiment of this application;

[0024] Figure 6 It is a schematic diagram of a data reading and writing management device provided according to an embodiment of the present application;

[0025] Figure 7 It is a schematic diagram of an electronic device provided according to an embodiment of the present application. Detailed implementation manners

[0026] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments may be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.

[0027] In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so as to implement the embodiments of the present application described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or are inherent to these processes, methods, products or devices.

[0029] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in the present disclosure are all information and data that have been authorized by the user or fully authorized by all parties. For example, an interface is set between the present system and relevant users or institutions. Before obtaining relevant information, a request for acquisition needs to be sent to the aforementioned users or institutions through the interface, and after receiving the consent information feedback from the aforementioned users or institutions, the relevant information can be obtained.

[0030] It should be noted that the data reading and writing management methods, devices, storage media, and electronic devices determined in the present disclosure can be used in the field of data processing, and can also be used in any field other than the field of data processing. The application fields of the data reading and writing management methods, devices, storage media, and electronic devices determined in the present disclosure are not limited.

[0031] For ease of description, some nouns or terms related to the embodiments of the present application are described below:

[0032] Service Worker thread: It is a script that runs independently of the main thread in the browser and runs in the background of the browser. Essentially, it acts as a proxy server between the server and the browser, and can intercept requests and return information, thereby assisting the main thread to execute operations.

[0033] According to an embodiment of the present application, a data reading and writing management method is provided.

[0034] Figure 1 It is a flowchart of the data reading and writing management method provided according to an embodiment of the present application. As Figure 1 shown, the method includes the following steps:

[0035] Step S102, when a read / write operation request sent by a target page is received by a preset thread, identify the status information of a credential stored in a preset thread file, where the target page sends the read / write operation request through a first process.

[0036] Specifically, the preset thread is connected to multiple processes. When a target page in the browser needs to read and write data stored in the browser's local storage (LocalStorage, that is, the database), it needs to send a read / write operation request to the preset thread through the first process corresponding to the target page, and can perform read and write operations on the data in the database only when receiving the credential feedback from the preset thread.

[0037] It should be noted that the preset thread used in the present application can be a Service Worker thread, but in the data reading and writing management method provided according to an embodiment of the present application, the preset thread can also use other threads with the same function configured based on third-party Worer thread technology, such as Shared Worker threads, etc.

[0038] Furthermore, when the preset thread receives a read / write operation request sent by the first process, it needs to determine the status information of the pre-stored credential in the file corresponding to the preset thread, so as to determine whether the first process can perform read and write operations on the data in the database according to the status information of the credential.

[0039] Step S104, when the status information is the first status, send a credential to the target page, and change the status information of the credential stored in the preset thread file from the first status to the second status, where the credential is used to represent that the target page is allowed to perform a modification operation on the data in the browser's database, the first status represents that the database is in an idle state, and the second status represents that a second process is performing a modification operation on the database, and the second process is associated with a different page from the first process.

[0040] Specifically, when the status information of the voucher is in the first state, it indicates that the database is in an idle state. At this time, the first process is allowed to read and write data in the database, and at the same time, the status information is modified from the first state to the second state, thereby indicating that the first process is currently reading and writing data in the database. At this time, if a read / write operation request sent by another process is received, since the status information of the voucher is in the second state, the second process cannot read and write data in the database.

[0041] For example, the voucher can include two states, such as true and false. When the voucher status is true, it indicates that no process is currently reading and writing data in the database, that is, the database is in an idle state, which means that the first process can read and write data in the database. When the voucher status is false, it indicates that there is a second process currently reading and writing data in the database. At this time, to ensure the accuracy of the data in the database, other processes are not allowed to read and write the database.

[0042] Step S106, when the status information is in the second state, send a prompt message to the target page, where the prompt message is used to prompt the target page to resend the read / write operation request after a preset time interval.

[0043] Specifically, when the status information is in the second state, it indicates that there is another process currently reading and writing data in the database, such as the second process. At this time, a prompt message needs to be sent to the target page to inform the target page to start timing through the prompt message and resend the read / write operation request after a preset time interval, so as to ensure that only one process reads and writes data in the database at the same time, and further achieve the effect of ensuring the accuracy of the data in the database.

[0044] Figure 2 It is a flowchart of an optional page read / write operation provided according to an embodiment of the present application. As Figure 2 shown, when there is a read / write request for the local memory on the target page, the read / write operation request is sent to the service thread, and the information returned by the service thread is received. When the information returned by the service thread is true, it indicates that the target page can perform read / write operations on the local memory. After completing the read / write operations on the local memory, a message indicating the completion of the read / write operation is sent to the service thread, so that the service thread can modify the voucher status information. When the information returned by the service thread is false, the target page sets a timer and resends the read / write operation request after a preset time interval, so as to complete the read / write operations on the local memory.

[0045] The data read-write management method provided by the embodiment of the present application, when a preset thread receives a read-write operation request sent by a target page, identifies the status information of a credential stored in a preset thread file, where the target page sends the read-write operation request through a first process; when the status information is in a first state, sends the credential to the target page, and changes the status information of the credential stored in the preset thread file from the first state to a second state, where the credential is used to represent that the target page is allowed to perform a modification operation on the data in the browser's database, the first state represents that the database is in an idle state, and the second state represents that a second process is performing a modification operation on the database, and the second process is associated with different pages from the first process; when the status information is in the second state, sends a prompt message to the target page, where the prompt message is used to prompt the target page to resend the read-write operation request after a preset time interval. This solves the problem in the related art that when multiple pages use multiple processes to perform read-write operations on a local memory, due to the randomness of the execution order among multiple processes, the data in the local memory appears abnormal. By using a preset thread to intercept the read-write operations sent by the target page, and determining whether there is another process currently performing read-write operations on the data in the database according to the status information stored in the preset thread file after the interception, so that when there is no other process performing read-write operations, the target page is allowed to perform read-write operations, and when there is another process performing read-write operations, the data in the database is not allowed to be read or written, thereby sorting the read-write operations of multiple processes according to the status information in the preset thread file, and further achieving the effect of ensuring the accuracy of the data in the database.

[0046] To ensure the normal progress of the read-write operations on the database, optionally, in the data read-write management method provided by the embodiment of the present application, after changing the status information of the credential stored in the preset thread file from the first state to the second state, the method further includes: initializing a timer corresponding to the preset thread and starting the timer, where the timer is used to time the read-write operations of the target page; when the preset thread receives feedback information sent by the target page and the duration recorded by the timer does not reach the preset duration, changing the status information of the credential stored in the preset thread file from the second state to the first state; when the duration recorded by the timer reaches the preset duration and the preset thread does not receive the feedback information sent by the target page, determining that the data modification operation performed by the target page on the browser's database is abnormal, and changing the status information of the credential stored in the preset thread file from the second state to the first state.

[0047] Specifically, after the preset thread sends the voucher to the target page and changes the status information of the voucher stored in the preset thread file from the first state to the second state, since there are other pages that need to read and write data in the database, it is necessary to set and start a timer, which is used to record the time consumed by the target page for reading and writing data in the database.

[0048] When the preset thread receives the feedback information sent by the target page and the time recorded by the timer does not reach the preset time, it indicates that the target page has normally completed the read and write operations on the data in the database within the specified time. At this time, the status information of the voucher can be directly restored to the first state. At this time, the timer is reset to zero and starts timing again after sending the voucher to the next page.

[0049] Furthermore, in order to prevent the situation that the page that obtains the voucher cannot send the completed read and write information to the preset thread after encountering an unexpected error, resulting in all subsequent pages not being able to obtain the voucher, it is necessary that when the time recorded by the timer reaches the preset time and the preset thread does not receive the feedback information sent by the target page, it indicates that the target page has an exception during the read and write operation, or an exception occurs when sending the information of the completed operation to the preset thread, resulting in the preset thread being unable to receive the feedback information sent by the target page. At this time, in order not to affect the subsequent pages' read and write operations on the data in the database, it is necessary for the preset thread to automatically change the status information of the voucher from the second state to the first state to prevent the situation that all subsequent pages cannot obtain the voucher.

[0050] Figure 3 It is an optional flowchart of the operation of the preset thread provided by the embodiment of the present application. As Figure 3 shown, after the preset thread receives the message sent by the page through the process, it first determines whether the content of the message is a read and write operation request or a notification of the completion of the read and write. In the case of a notification of the completion of the read and write, the timer is cleared and the status information of the voucher is changed from the second state to the first state, so that it can wait for the message sent by the page again. In the case where the content of the message is a read and write operation request, it first determines the status information of the voucher in the preset thread file. In the case where the status information of the voucher is the first state, the status information is changed to the second state and the timer is started. If the notification of the completion of the read and write is not received after the preset time, the status information of the voucher is restored to the first state. In the case where the status information of the voucher is the second state, a prompt message is sent to the target page, so as to control the read and write operations of the database by controlling the status information of the voucher, and thus achieve the effect of making the disordered read and write operations become ordered read and write operations.

[0051] Optionally, in the data reading and writing management method provided in the embodiments of the present application, before the preset thread receives the read / write operation request sent by the target page, the method further includes: when the preset thread receives the first request sent by the first page, determining whether the second request sent by the second page is received within the target time interval; when the second request sent by the second page is received within the target time interval, determining the levels of the first page and the second page to obtain the first level and the second level; when the first level is greater than the second level, determining the first page as the target page; when the first level is less than the second level, determining the second page as the target page; when the first level is equal to the second level, determining any one of the first page and the second page as the target page.

[0052] It should be noted that in a certain scenario, it may occur that two pages using different processes send read / write operation requests to the preset thread within a very short time interval. At this time, since the requests can be regarded as being sent at the same moment within a very short time interval, therefore, the order of execution of the two requests can be determined by determining the levels of the pages sending the two read / write operation requests, so as to ensure the normal execution of the read / write operations while giving priority to the requests of the page with a higher level.

[0053] Specifically, when the first request sent by the first page and the second request sent by the second page are received within the target time interval, it is necessary to determine the levels of the first page and the second page, and send a voucher to the page with a higher level first, so as to avoid a certain page waiting for too long. When the levels of the two pages are the same, any one of the pages can be selected to send the voucher, so as to determine the execution order of the read / write operations through the levels.

[0054] For example, the target time interval can be 100 ms. After receiving the first request, if the second request is received within 100 ms, the first request and the second request can be regarded as requests received simultaneously. At this time, the request sent by the page with a higher level among the first page and the second page can be executed. If no other requests are received within 100 ms, the first request is executed.

[0055] To accurately determine the level of the page, optionally, in the data reading and writing management method provided in the embodiments of the present application, determining the levels of the first page and the second page includes: obtaining the preset levels of the first page and the second page from the preset thread file to obtain the first level and the second level; or obtaining the historical request sending times of the first page from the preset thread file to obtain the first number, and obtaining the historical request sending times of the second page to obtain the second number; determining the first level according to the first number, and determining the second level according to the second number.

[0056] Specifically, when determining the page level, the following two methods can be used for accurate determination:

[0057] 1) Determine the page level by the preset level of each page in the preset thread file, that is, determine the page level through the initial attributes of the page, and the page level is not affected by other factors.

[0058] 2) Determine the level by the number of times of obtaining vouchers for each page. The more times of obtaining vouchers, the higher the level. The page level can be stored in the preset thread file. Thus, the page level can be accurately determined through the above two methods.

[0059] To accurately determine the number of times of obtaining vouchers, optionally, in the data reading and writing management method provided in the embodiment of the present application, obtain the historical request sending times of the first page from the preset thread file to obtain the first number, and obtain the historical request sending times of the second page to obtain the second number, including: for any page, when receiving a read / write operation request sent by the page and the status information of the voucher is the second status, increment by 1 the historical request sending times associated with the page in the preset thread file; when receiving a read / write operation request sent by the page and the status information of the voucher is the first status, clear to zero the historical request sending times associated with the page in the preset thread file.

[0060] Specifically, to ensure the accuracy and reasonableness of the number of times of obtaining vouchers, a record can be made in the preset thread file after the page fails to obtain a voucher, that is, increment by 1 the number of times of obtaining vouchers. If the page still fails to obtain a voucher the next time, increment by 1 again until the page successfully obtains a voucher, and after successfully obtaining a voucher, clear to zero the number of times of obtaining vouchers recorded for the page in the preset thread file, so as to ensure that there will be no phenomenon that a certain page has a large number of times of obtaining vouchers.

[0061] Optionally, in the data reading and writing management method provided in the embodiment of the present application, the method further includes: when the status information of the voucher is the first status and the preset thread receives feedback information sent by the third page, determine that there is an abnormality in the modification operation performed on the data in the database by the third page, and send an alarm message, where the alarm message is used to indicate that there is an abnormality in the data in the database.

[0062] Specifically, when the status information of the voucher is in the first state, it indicates that the voucher has not been sent to the page at the current moment. However, if feedback information sent by the third page is received at this time, it indicates that an exception occurred during the data read / write operation after the third page received the voucher, resulting in the operation timing out. At this time, due to the operation timing out, the preset thread will change the thread status from the second state to the first state, and after receiving read / write requests sent by other pages subsequently, the voucher will be sent to other pages for database data read / write operations. Therefore, when the feedback information sent by the third page is received, it is impossible to determine when the third page performs the database data read / write operation, and the data in the database may be abnormal. At this time, an alarm message needs to be sent to the operation and maintenance personnel to inform the operation and maintenance personnel that the database may be abnormal and needs to be processed in a timely manner.

[0063] Figure 4 is a flowchart of an optionally data read / write operation provided according to an embodiment of the present application. As Figure 4 shown, it is set that the operations performed by Process 1 and Process 2 are both write operations of incrementing the target field in the local memory. The initial value of the target field is 0. Process 1 first sends a voucher application to the preset thread, that is, the service thread. When the voucher status is in the first state, the service thread issues the voucher to Process 1 and starts timing with a timer. At this time, when the voucher application sent by Process 2 is received, since the voucher status changes to the second state, Process 2 needs to send the voucher application again after a preset time interval. At this time, since Process 1 has an exception and cannot send information indicating the completion of the read / write operation to the service thread, after the duration recorded by the timer reaches the preset duration, the service thread automatically changes the status information of the voucher from the second state to the first state. At this time, when the voucher application sent by Process 2 is received, since the voucher status changes to the first state, the voucher is issued to Process 2. Process 2 performs the read / write operation on the data in the local memory, and the target field changes from 0 to 1, and after the operation is completed, feedback information is sent to return the voucher.

[0064] At this time, if Process 1 performs a voucher return operation after Process 2 returns the voucher, it indicates that Process 1 has completed the write operation on the target field. However, at this time, it is impossible to know when Process 1 completed the write operation on the target field. If it is completed before Process 2 performs the write operation on the target field, since Process 1 changes the target field from 0 to 1 and the value of the target field in the local memory is 1, the initial value of the target field read by Process 2 in the local memory is 1, and the value of the target field obtained after changing the target field is 2. However, if Process 1 completes the write operation after Process 2 performs the write operation on the target field, since the initial value of the target field read by Process 1 in the local memory is 0, the value of the target field modified by Process 1 is 1. When Process 1 adds the target field obtained from this write operation to the local memory, the value of the target field in the local memory has been changed to 1 by Process 2. At this time, the change operation of the value of the target field in the local memory by Process 1 is to change from 1 to 1, resulting in the value of the target field in the local memory finally being 1 instead of 2, thus causing an error in the data in the database. Therefore, when the read and write volume of the process is large and it is impossible to simply determine how the data goes wrong, it is necessary to send an alarm message to the operation and maintenance personnel to inform the occurrence of this exception, and then process the database in a timely manner.

[0065] Optionally, in order to accurately determine the read and write operations that need to control the execution order, in the data read and write management method provided in the embodiment of the present application, when a preset thread receives a read and write operation request sent by a target page, the method further includes: parsing the read and write operation request to obtain the operation content, and determining whether the operation content is included in a preset table, where the preset table includes various operation contents; when the operation content is included in the preset table, performing the step of identifying the status information of the voucher stored in the preset thread file; when the operation content is not included in the preset table, sending instruction information to the target page, where the instruction information is used to instruct the target page to perform a modification operation on the data in the database of the browser.

[0066] Specifically, after receiving the read and write operation request, since some read and write operations do not need to control the execution order, it is possible to determine whether this read and write operation needs to control the execution order according to the preset table. When the operation content of this read and write operation is located in the preset table, it indicates that this read and write operation needs to control the execution order, and then perform the step of identifying the status information of the voucher stored in the preset thread file. When the operation content of this read and write operation is not located in the preset table, it indicates that this read and write operation does not need to control the execution order, and then directly send instruction information to the target page to instruct the page to perform read and write operations on the data in the database.

[0067] Figure 5 is the flowchart of the optional data read and write management method provided in the embodiment of the present application, asFigure 5 As shown, the operations performed on pages 1 - 3 are all write operations that increment the target field in the local memory by 1. The initial value of the target field is 0. Page 1 first sends a credential application to a preset thread, i.e., the service thread, through Process 1. When the credential status is in the first state, the service thread issues the credential to Process 1 and starts timing using a timer. At this time, when receiving the credential application sent by Process 2 for Page 2, since the credential status changes to the second state, Process 2 needs to send another credential application after a preset time interval. At this time, Process 1 performs a write operation that increments the target field in the local memory by 1, changing the value of the target field in the local memory from 0 to 1, and returns the credential to the service thread. The service thread changes the credential status to the first state.

[0068] At this time, after the service thread receives the credential application sent by Process 2, since the credential status is in the first state, it issues the credential to Process 2 and starts timing using a timer. At this time, when receiving the credential application sent by Process 1 for Page 3, since the credential status is in the second state, Process 1 needs to send another credential application after a preset time interval. At this time, Process 2 performs a write operation that increments the target field in the local memory by 2, changing the value of the target field in the local memory from 1 to 2, and returns the credential to the service thread. The service thread changes the credential status to the first state.

[0069] At this time, after the service thread receives the credential application sent by Process 1, since the credential status is in the first state, it issues the credential to Process 1 and starts timing using a timer. Process 1 performs a write operation that increments the target field in the local memory by 1, changing the value of the target field in the local memory from 2 to 3, and returns the credential to the service thread, thus completing the ordered read and write operations on the data in the database for pages 1 - 3.

[0070] Since Process 1 encounters an exception and is unable to send information indicating the completion of the read and write operation to the service thread, after the duration recorded by the timer reaches the preset duration, the service thread automatically changes the status information of the credential from the second state to the first state. At this time, when receiving the credential application sent by Process 2, since the credential status changes to the first state, it issues the credential to Process 2. Process 2 performs the read and write operation on the data in the local memory, changing the target field from 0 to 1, and sends feedback information to return the credential after completing the operation.

[0071] Intercept the read and write operations sent by the target page using a preset thread in the above process, and after interception, determine whether there is any other process reading and writing the data in the database at the current moment according to the status information stored in the preset thread file. Thus, when there is no other process reading and writing, allow the target page to perform read and write operations, and when there is another process reading and writing, do not allow reading and writing the data in the database, so as to sort the read and write operations of multiple processes according to the status information in the preset thread file, and then achieve the effect of ensuring the accuracy of the data in the database.

[0072] It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.

[0073] The embodiment of the present application also provides a data read and write management device. It should be noted that the data read and write management device of the embodiment of the present application can be used to execute the data read and write management method provided by the embodiment of the present application. The following introduces the data read and write management device provided by the embodiment of the present application.

[0074] Figure 6 is a schematic diagram of the data read and write management device provided by the embodiment of the present application. As Figure 6 shown, the device includes: an identification unit 61, a first change unit 62, and a first sending unit 63.

[0075] The identification unit 61 is used to identify the status information of the voucher stored in the preset thread file when the preset thread receives a read and write operation request sent by the target page, where the target page sends the read and write operation request through the first process.

[0076] Specifically, the preset thread (Service Worker thread) is connected to multiple processes. When the target page in the browser needs to read and write the data stored in the browser's local storage (LocalStorage, that is, the database), it needs to send a read and write operation request to the preset thread through the first process corresponding to the target page, and can read and write the data in the database only when receiving the voucher feedback from the preset thread.

[0077] Furthermore, when the preset thread receives the read and write operation request sent by the first process, it needs to determine the status information of the voucher pre-stored in the file corresponding to the preset thread, so as to determine whether the first process can read and write the data in the database according to the status information of the voucher.

[0078] The first change unit 62 is configured to send a credential to the target page when the status information is in the first state, and change the status information of the credential stored in the preset thread file from the first state to the second state. The credential is used to represent that the target page is allowed to perform a modification operation on the data in the browser's database. The first state represents that the database is in an idle state, and the second state represents that the second process is performing a modification operation on the database. The second process is associated with a different page from the first process.

[0079] Specifically, when the status information of the credential is in the first state, it represents that the database is in an idle state. At this time, the first process is allowed to read and write the data in the database, and at the same time, the status information is changed from the first state to the second state, thereby representing that the first process is reading and writing the data in the database at the current moment. At this time, if a read / write operation request sent by another process is received, since the status information of the credential is in the second state, the second process cannot read and write the data in the database.

[0080] For example, the credential can include two states, such as true and false. When the credential status is true, it represents that no process is currently reading and writing the data in the database, that is, the database is in an idle state, which means that the first process can read and write the data in the database. When the credential status is false, it represents that there is a second process currently reading and writing the data in the database. At this time, to ensure the accuracy of the data in the database, other processes are not allowed to read and write the database.

[0081] The first sending unit 63 is configured to send a prompt message to the target page when the status information is in the second state. The prompt message is used to prompt the target page to resend a read / write operation request after a preset time interval.

[0082] Specifically, when the status information is in the second state, it represents that there is another process currently reading and writing the data in the database, such as the second process. At this time, a prompt message needs to be sent to the target page. The target page is informed to start timing through the prompt message and resend a read / write operation request after a preset time interval, so as to ensure that only one process reads and writes the data in the database at the same moment, and thus achieve the effect of ensuring the accuracy of the data in the database.

[0083] Figure 2 It is a flowchart of performing read / write operations on an optional page provided by an embodiment of the present application, as Figure 2As shown, when there are read / write requests for the local memory on the target page, the read / write operation request is sent to the service thread, and the information returned by the service thread is received. When the information returned by the service thread is true, it indicates that the target page can perform read / write operations on the local memory. After completing the read / write operations on the local memory, a message indicating the completion of the read / write operations is sent to the service thread, so that the service thread can modify the voucher status information. When the information returned by the service thread is false, the target page sets a timer and resends the read / write operation request after a preset time interval, so as to complete the read / write operations on the local memory.

[0084] The data read / write management device provided by the embodiments of the present application, when the recognition unit 61 receives a read / write operation request sent by the target page in a preset thread, recognizes the status information of the voucher stored in the preset thread file, where the target page sends the read / write operation request through the first process. The first change unit 62, when the status information is the first status, sends a voucher to the target page and changes the status information of the voucher stored in the preset thread file from the first status to the second status, where the voucher is used to indicate that the target page is allowed to perform modification operations on the data in the browser's database, the first status indicates that the database is in an idle state, and the second status indicates that the second process is performing modification operations on the database, and the second process is associated with a different page from the first process. The first sending unit 63, when the status information is the second status, sends a prompt message to the target page, where the prompt message is used to prompt the target page to resend the read / write operation request after a preset time interval. It solves the problem that in the case of multiple pages using multiple processes to perform read / write operations on the local memory in the related art, due to the randomness of the execution order between multiple processes, the data in the local memory appears abnormal. By using a preset thread to intercept the read / write operations sent by the target page, and after the interception, determining whether there are other processes performing read / write operations on the data in the database at the current moment according to the status information stored in the preset thread file, so that when there are no other processes performing read / write operations, the target page is allowed to perform read / write operations, and when there are other processes performing read / write operations, the data in the database is not allowed to be read / written, so as to sort the read / write operations of multiple processes according to the status information in the preset thread file, and further achieve the effect of ensuring the accuracy of the data in the database.

[0085] Optionally, in the data reading and writing management device provided in the embodiments of the present application, the device further includes: an initialization unit, configured to initialize a timer corresponding to a preset thread and start the timer, where the timer is used to time the reading and writing operations of a target page; a second change unit, configured to change the status information of a certificate stored in the preset thread file from a second state to a first state when the preset thread receives feedback information sent by the target page and the duration recorded by the timer does not reach a preset duration; a first determination unit, configured to determine that the data modification operation performed by the target page on the database of the browser is abnormal and change the status information of the certificate stored in the preset thread file from a second state to a first state when the duration recorded by the timer reaches the preset duration and the preset thread does not receive the feedback information sent by the target page.

[0086] Specifically, after the preset thread sends the certificate to the target page and changes the status information of the certificate stored in the preset thread file from the first state to the second state, since there are other pages that need to perform reading and writing operations on the data in the database, it is necessary to set and start a timer, which is used to record the duration consumed by the target page for reading and writing the data in the database.

[0087] When the preset thread receives the feedback information sent by the target page and the duration recorded by the timer does not reach the preset duration, it indicates that the target page has normally completed the reading and writing operations on the data in the database within the specified time. At this time, the status information of the certificate can be directly restored to the first state. At this time, the timer is reset to zero and starts timing again after sending the certificate to the next page.

[0088] Furthermore, to prevent the situation where the page that obtains the certificate cannot send the completed reading and writing information to the preset thread due to an unexpected error, resulting in all subsequent pages not being able to obtain the certificate, it is necessary to determine that the target page has an abnormality during the reading and writing operation or an abnormality occurs when sending the information of the completed operation to the preset thread, resulting in the preset thread being unable to receive the feedback information sent by the target page when the duration recorded by the timer reaches the preset duration and the preset thread does not receive the feedback information sent by the target page. At this time, to prevent all subsequent pages from not being able to obtain the certificate, it is necessary for the preset thread to automatically change the status information of the certificate from the second state to the first state.

[0089] Optionally, in the data reading and writing management device provided in the embodiments of the present application, the device further includes: a judgment unit, configured to judge whether a second request sent by a second page is received within a target time interval when a preset thread receives a first request sent by a first page; a second determination unit, configured to determine the levels of the first page and the second page to obtain a first level and a second level when a second request sent by the second page is received within the target time interval; a third determination unit, configured to determine the first page as the target page when the first level is greater than the second level; a fourth determination unit, configured to determine the second page as the target page when the first level is less than the second level; a fifth determination unit, configured to determine any one of the first page and the second page as the target page when the first level is equal to the second level.

[0090] It should be noted that in a certain scenario, it is possible that two pages using different processes send read and write operation requests to a preset thread within a very short time interval. At this time, since the requests can be regarded as being sent at the same moment within a very short time interval, the order of execution of the two requests can be determined by determining the levels of the pages sending the two read and write operation requests, so as to give priority to the request of the page with a higher level while ensuring the normal execution of the read and write operations.

[0091] Specifically, when a first request sent by a first page and a second request sent by a second page are received within the target time interval, it is necessary to determine the levels of the first page and the second page, and send a voucher to the page with a higher level first, so as to avoid a page waiting for too long. When the levels of the two pages are the same, any one of the pages can be selected to send the voucher, so as to determine the execution order of the read and write operations through the levels.

[0092] For example, the target time interval can be 100 ms. After receiving the first request, if the second request is received within 100 ms, the first request and the second request can be regarded as requests received at the same time. At this time, the request sent by the page with a higher level among the first page and the second page can be executed. If no other request is received within 100 ms, the first request is executed.

[0093] Optionally, in the data reading and writing management device provided in the embodiments of the present application, the second determination unit includes: a first obtaining module, configured to obtain the preset levels of the first page and the second page from a preset thread file to obtain a first level and a second level; or a second obtaining module, configured to obtain the historical request sending times of the first page from a preset thread file to obtain a first number, and obtain the historical request sending times of the second page to obtain a second number; a determining module, configured to determine the first level according to the first number and determine the second level according to the second number.

[0094] Specifically, when determining the page level, the following two methods can be used for accurate determination:

[0095] 1) Determine the page level by the preset level in the preset thread file for each page, that is, determine the page level through the initial attributes of the page, and the page level is not affected by other factors.

[0096] 2) Determine the level by the number of times of obtaining vouchers for each page. The more times of obtaining vouchers, the higher the level. The page level can be stored in the preset thread file. Thus, the page level can be accurately determined through the above two methods.

[0097] Optionally, in the data reading and writing management device provided in the embodiment of the present application, the second obtaining module includes: a calculation sub-module, configured to, for any page, when receiving a read / write operation request sent by the page and the status information of the voucher is the second status, increment by 1 the historical request sending times associated with the page in the preset thread file; a clearing sub-module, configured to, when receiving a read / write operation request sent by the page and the status information of the voucher is the first status, clear the historical request sending times associated with the page in the preset thread file.

[0098] Specifically, in order to ensure the accuracy and reasonableness of the number of times of obtaining vouchers, a record can be made in the preset thread file after the page fails to obtain a voucher, that is, the number of times of obtaining vouchers is incremented by 1. If the page still fails to obtain a voucher the next time, it is incremented by 1 again until the page successfully obtains a voucher. After successfully obtaining a voucher, the number of times of obtaining vouchers recorded for the page in the preset thread file is cleared, so as to ensure that there will be no phenomenon that a certain page has a large number of times of obtaining vouchers.

[0099] Optionally, in the data reading and writing management device provided in the embodiment of the present application, the device further includes: an alarm unit, configured to, when the status information of the voucher is the first status and the preset thread receives feedback information sent by a third page, determine that the modification operation performed by the third page on the data in the database is abnormal and send an alarm message, where the alarm message is used to indicate that the data in the database is abnormal.

[0100] Specifically, when the status information of the voucher is in the first state, it indicates that the voucher has not been sent to the page at the current moment. However, if feedback information sent by the third page is received at this time, it indicates that an exception occurred during the data reading and writing operation after the third page received the voucher, resulting in the operation timing out. At this time, due to the operation timing out, the preset thread will change the thread status from the second state to the first state, and after receiving read and write requests sent by other pages subsequently, the voucher will be sent to other pages for database data reading and writing operations. Therefore, when receiving the feedback information sent by the third page, it is impossible to determine when the third page performs the database data reading and writing operation, and the data in the database may be abnormal. At this time, an alarm message needs to be sent to the operation and maintenance personnel to inform the operation and maintenance personnel that the database may be abnormal and needs to be processed in a timely manner.

[0101] Optionally, in the data reading and writing management device provided in the embodiment of the present application, the device further includes: a parsing unit, configured to parse the read and write operation request to obtain the operation content, and determine whether the operation content is included in a preset table, where the preset table includes various operation contents; an execution unit, configured to execute the step of identifying the status information of the voucher stored in the preset thread file when the operation content is included in the preset table; a second sending unit, configured to send instruction information to the target page when the operation content is not included in the preset table, where the instruction information is used to instruct the target page to perform a modification operation on the data in the browser's database.

[0102] Specifically, after receiving the read and write operation request, since some read and write operations do not require controlling the execution order, it is possible to determine whether the read and write operation needs to control the execution order according to the preset table. When the operation content of the read and write operation is in the preset table, it indicates that the read and write operation needs to control the execution order, and then the step of identifying the status information of the voucher stored in the preset thread file is executed. When the operation content of the read and write operation is not in the preset table, it indicates that the read and write operation does not need to control the execution order, and then the instruction information can be directly sent to the target page to instruct the page to perform read and write operations on the data in the database.

[0103] The above data reading and writing management device includes a processor and a memory. The above recognition unit 61, the first change unit 62, the first sending unit 63, etc. are all stored in the memory as program units, and the corresponding functions are implemented by the processor executing the above program units stored in the memory.

[0104] The processor contains a kernel, which retrieves the corresponding program units from the memory. One or more kernels can be set. By adjusting the kernel parameters, the problem in the related art that in the case of multiple processes reading and writing to the local memory on multiple pages, the data in the local memory becomes abnormal due to the randomness of the execution order between multiple processes is solved.

[0105] The memory may include non-permanent memory in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.

[0106] An embodiment of the present invention provides a computer-readable storage medium, on which a program is stored, and when the program is executed by a processor, the data reading and writing management method is implemented.

[0107] An embodiment of the present invention provides a processor, which is used to run a program, and when the program runs, the data reading and writing management method is executed.

[0108] As Figure 7 As shown, an embodiment of the present invention provides an electronic device. The electronic device 70 includes a processor, a memory, and a program stored on the memory and executable on the processor. When the processor executes the program, the steps of the above data reading and writing management method are implemented. The device herein can be a server, a PC, a PAD, a mobile phone, etc.

[0109] The present application also provides a computer program product, which is adapted to execute a program initialized with the steps of the above data reading and writing management method when executed on a data processing device.

[0110] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.

[0111] This application is described with reference to the flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, as well as the combination of flows and / or blocks in the flowchart and / or block diagram. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing device produce means for implementing the specified functions in one or more of the flows Figure 1 one or more of the flows and / or blocks Figure 1 or means for implementing the specified functions in one or more of the blocks.

[0112] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufactured article including instruction means for implementing the specified functions in one or more of the flows Figure 1 one or more of the flows and / or blocks Figure 1 or means for implementing the specified functions in one or more of the blocks.

[0113] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the specified functions in one or more of the flows Figure 1 one or more of the flows and / or blocks Figure 1 or means for implementing the specified functions in one or more of the blocks.

[0114] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.

[0115] The memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM), and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM). The memory is an example of computer-readable media.

[0116] A computer-readable medium includes both permanent and non-permanent, removable and non-removable media and can implement information storage by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic tape disk storage or other magnetic storage devices, or any other non-transitory medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer-readable medium does not include transitory computer-readable media such as modulated data signals and carrier waves.

[0117] It should also be noted that the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or apparatus comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or apparatus. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising the element.

[0118] The above are only embodiments of the present application and are not used to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.

Claims

1. A data reading and writing management method, characterized in that, Including: When a preset thread receives a read / write operation request sent by a target page, identify the status information of a credential stored in a preset thread file, where the target page sends the read / write operation request through a first process; When the status information is in a first state, send the credential to the target page, and change the status information of the credential stored in the preset thread file from the first state to a second state, where the credential is used to represent that the target page is allowed to perform a modification operation on data in a browser database, the first state represents that the database is in an idle state, and the second state represents that a second process is performing a modification operation on the database, and the second process is associated with a different page from the first process; When the status information is in the second state, send a prompt message to the target page, where the prompt message is used to prompt the target page to resend the read / write operation request after a preset time interval; After changing the status information of the credential stored in the preset thread file from the first state to the second state, the method further includes: initializing a timer corresponding to the preset thread and starting the timer, where the timer is used to time the read / write operation of the target page; when the preset thread receives a feedback message sent by the target page and the duration recorded by the timer does not reach a preset duration, change the status information of the credential stored in the preset thread file from the second state to the first state; when the duration recorded by the timer reaches the preset duration and the preset thread does not receive a feedback message sent by the target page, determine that the data modification operation performed by the target page on the browser database is abnormal, and change the status information of the credential stored in the preset thread file from the second state to the first state.

2. The method according to claim 1, wherein Before the preset thread receives a read / write operation request sent by a target page, the method further includes: When the preset thread receives a first request sent by a first page, determine whether a second request sent by a second page is received within a target time interval; When the second request sent by the second page is received within the target time interval, determine the levels of the first page and the second page, obtaining a first level and a second level; When the first level is greater than the second level, determine the first page as the target page; When the first level is less than the second level, determine the second page as the target page; When the first level is equal to the second level, determine any one of the first page and the second page as the target page.

3. The method according to claim 2, wherein Determining the levels of the first page and the second page includes: Obtaining the first level and the second level by acquiring the preset levels of the first page and the second page from the preset thread file; or Obtain the historical request sending times of the first page from the preset thread file to get a first count, and obtain the historical request sending times of the second page to get a second count; Determine the first level according to the first count, and determine the second level according to the second count.

4. The method according to claim 3, wherein Obtaining the historical request sending times of the first page from the preset thread file to get a first count, and obtaining the historical request sending times of the second page to get a second count includes: For any page, when a read / write operation request sent by the page is received and the status information of the credential is the second status, increment by 1 the historical request sending times associated with the page in the preset thread file; When a read / write operation request sent by the page is received and the status information of the credential is the first status, clear to zero the historical request sending times associated with the page in the preset thread file.

5. The method according to claim 1, wherein The method further includes: When the status information of the credential is the first status and the preset thread receives feedback information sent by a third page, determine that there is an abnormality in the modification operation performed on the data in the database by the third page, and send an alarm message, where the alarm message is used to indicate that there is an abnormality in the data in the database.

6. The method according to claim 1, wherein When the preset thread receives a read / write operation request sent by a target page, the method further includes: Parse the read / write operation request to obtain the operation content, and determine whether the operation content is included in a preset table, where the preset table includes various operation contents; When the operation content is included in the preset table, perform the step of identifying the status information of the credential stored in the preset thread file; When the operation content is not included in the preset table, send instruction information to the target page, where the instruction information is used to instruct the target page to perform a modification operation on the data in the browser's database.

7. A data reading and writing management device, characterized in that, Includes: An identification unit, configured to, when the preset thread receives a read / write operation request sent by a target page, identify the status information of the credential stored in the preset thread file, where the target page sends the read / write operation request through a first process; A first change unit, configured to, when the status information is the first status, send the credential to the target page, and change the status information of the credential stored in the preset thread file from the first status to the second status, where the credential is used to represent that the target page is allowed to perform a modification operation on the data in the browser's database, the first status represents that the database is in an idle state, the second status represents that a second process is performing a modification operation on the database, and the second process is associated with different pages from the first process; A first sending unit, configured to, when the status information is the second status, send prompt information to the target page, where the prompt information is used to prompt the target page to resend the read / write operation request after a preset time interval; The device further includes: an initialization unit, configured to initialize a timer corresponding to the preset thread and start the timer, where the timer is used to time the read and write operations on the target page; a second change unit, configured to, when the preset thread receives feedback information sent by the target page and the duration recorded by the timer does not reach a preset duration, change the status information of the certificate stored in the preset thread file from the second state to the first state; a first determination unit, configured to, when the duration recorded by the timer reaches the preset duration and the preset thread does not receive feedback information sent by the target page, determine that the data modification operation performed by the target page on the database of the browser is abnormal, and change the status information of the certificate stored in the preset thread file from the second state to the first state.

8. A computer storage medium, characterized in that, The computer storage medium is used to store a program, where the program, when running, controls the device where the computer storage medium is located to execute the data read and write management method according to any one of claims 1 to 6.

9. An electronic device, characterized in that, It includes one or more processors and a memory, where the memory is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the data read and write management method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method for controlling database safety access

    CN101030242A

  • Data processing method and device

    CN110533503A