CN113377792A - Data write-back method and device, electronic equipment and storage medium - Google Patents

Data write-back method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113377792A
CN113377792A CN202110648654.5A CN202110648654A CN113377792A CN 113377792 A CN113377792 A CN 113377792A CN 202110648654 A CN202110648654 A CN 202110648654A CN 113377792 A CN113377792 A CN 113377792A
Authority
CN
China
Prior art keywords
current
message
delay message
time
delay
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.)
Pending
Application number
CN202110648654.5A
Other languages
Chinese (zh)
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.)
Shanghai Mengju Information Technology Co ltd
Original Assignee
Shanghai Weimeng Enterprise Development 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 Shanghai Weimeng Enterprise Development Co ltd filed Critical Shanghai Weimeng Enterprise Development Co ltd
Priority to CN202110648654.5A priority Critical patent/CN113377792A/en
Publication of CN113377792A publication Critical patent/CN113377792A/en
Pending legal-status Critical Current

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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/08Logistics, e.g. warehousing, loading or distribution; Inventory or stock management
    • G06Q10/087Inventory or stock management, e.g. order filling, procurement or balancing against orders
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Economics (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Finance (AREA)
  • Marketing (AREA)
  • Computational Linguistics (AREA)
  • Development Economics (AREA)
  • Computer Security & Cryptography (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Human Resources & Organizations (AREA)
  • Accounting & Taxation (AREA)
  • Operations Research (AREA)
  • Quality & Reliability (AREA)
  • Strategic Management (AREA)
  • Tourism & Hospitality (AREA)
  • General Business, Economics & Management (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a data write-back method, a data write-back device, electronic equipment and a storage medium, wherein the method comprises the following steps: when the stock data in the cache is detected to be deducted, judging whether the time interval between the current time and the sending time of the last delay message exceeds a preset time threshold value or not; if yes, generating a delay message at the current moment, and sending the delay message at the current moment to a delay message queue; and when the delay message at the current moment in the delay message queue is consumed by the database, checking the residual inventory data in the current cache, and writing the residual inventory data back to the database. According to the method, only when the time interval between the current time and the last delay message exceeds a preset time threshold value, a new delay message, namely the current time is generated, the number of times of writing the message can be reduced, accumulated data in a period of time is written back to the database once based on the delay message, and the competition pressure of database lock resources can be reduced.

Description

Data write-back method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer network storage technologies, and in particular, to a data write-back method and apparatus, an electronic device, and a storage medium.
Background
Currently, in the inventory deduction process, the system performance is usually improved by using a cache, and when the inventory in the cache is deducted, the inventory quantity in the database is updated, that is, the final consistency between the quantity in the cache and the data in the database is maintained.
In the related art, when the stock in the cache is reduced, a message is written, and the database updates the stock data according to the message, so that the cache and the database are synchronous and consistent. The method does not reduce database operation, and the information is written to the database every time inventory deduction occurs, so that information accumulation is easily caused, the competition pressure of database lock resources is increased, and the database layer reduces the system performance due to the competition of the lock resources.
Disclosure of Invention
The application aims to provide a data write-back method, a data write-back device, an electronic device and a storage medium, which can reduce the number of times of writing messages, write back accumulated data in a period of time to a database once based on delay messages, and reduce the resource competition pressure of a database lock. The specific scheme is as follows:
in a first aspect, the present application discloses a data write-back method, including:
when the stock data in the cache is detected to be deducted, judging whether the time interval between the current time and the sending time of the last delay message exceeds a preset time threshold value or not;
if yes, generating the delay message of the current moment, and sending the delay message of the current moment to a delay message queue;
and after the database consumes the delay message at the current moment in the delay message queue, checking the residual inventory data in the current cache, and writing back the residual inventory data to the database.
Optionally, the determining whether the time interval between the current time and the sending time of the previous delay message exceeds a preset time threshold includes:
detecting whether a message identifier exists in a current service system; the existing duration of the message identifier is the preset time threshold;
if the message identifier is not detected in the current service system, the time interval between the current time and the sending time of the last delay message exceeds the preset time threshold;
if the message identifier is detected in the current service system, the time interval between the current time and the sending time of the last delay message does not exceed the preset time threshold.
Optionally, after the sending the delay message at the current time to the delay message queue, the method further includes:
and refreshing the message identifier to generate an updated message identifier.
Optionally, before the checking the remaining inventory data in the current cache, the method further includes:
judging whether the current cache has residual inventory data;
if not, writing back the residual inventory quantity in the delay message of the current moment to the database according to the residual inventory quantity in the delay message of the current moment.
In a second aspect, the present application discloses a data write-back apparatus, including:
the first judgment module is used for judging whether the time interval between the current moment and the sending moment of the last delay message exceeds a preset time threshold value or not when the reduction of the inventory data in the cache is detected;
a generating module, configured to generate the delay message at the current time and send the delay message at the current time to a delay message queue if the delay message at the current time is the same as the delay message at the current time;
a first write-back module, configured to, after the database consumes the delayed message at the current time in the delayed message queue,
checking the residual inventory data in the current cache and writing the residual inventory data back to the database.
Optionally, the first determining module includes:
the detection unit is used for detecting whether a message identifier exists in the current service system; the existing duration of the message identifier is the preset time threshold;
a first determining unit, configured to determine that a time interval between the current time and the sending time of the previous delay message exceeds the preset time threshold if the message identifier is not detected in the current service system;
a second determining unit, configured to determine that a time interval between the current time and the sending time of the previous delay message does not exceed the preset time threshold if the message identifier is detected in the current service system.
Optionally, the method further includes:
and the refreshing module is used for refreshing the message identifier and generating an updated message identifier.
Optionally, the method further includes:
the second judgment module is used for judging whether the current cache has residual inventory data;
and the second write-back module is used for writing back the residual inventory number in the delay message of the current moment to the database according to the residual inventory number in the delay message of the current moment if the delay message of the current moment is not the same as the delay message of the current moment.
In a third aspect, the present application discloses an electronic device, comprising:
a memory for storing a computer program;
and the processor is used for realizing the steps of the data write-back method when executing the computer program.
In a fourth aspect, the present application discloses a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the data write-back method as described above.
The application provides a data write-back method, which comprises the following steps: when the stock data in the cache is detected to be deducted, judging whether the time interval between the current time and the sending time of the last delay message exceeds a preset time threshold value or not; if yes, generating the delay message of the current moment, and sending the delay message of the current moment to a delay message queue; and after the database consumes the delay message at the current moment in the delay message queue, checking the residual inventory data in the current cache, and writing back the residual inventory data to the database.
It can be seen that, when detecting that the stock data in the cache is subtracted, the method does not immediately send a message to the database for write back, but only when the time interval between the current time and the last delay message exceeds a preset time threshold, generates and sends the delay message at the current time to the delay message queue, and the database consumes the delay message at the current time in the delay message queue, checks the remaining stock data in the current cache, and writes back the remaining stock data to the database; the method and the device have the advantages that only when the time interval between the current moment and the last delay message exceeds the preset time threshold value, the new delay message which is the current moment is generated, the times of writing the message can be reduced, the accumulated data in a period of time are written back to the database once based on the delay message, the competition pressure of the lock resources of the database can be reduced, the defects that the message can be written when the stock is reduced in the related technology, the operation of the database is frequent, the message accumulation is easy to cause, and the competition pressure of the lock resources of the database is increased are overcome. The application also provides a data write-back device, an electronic device and a computer readable storage medium, which have the beneficial effects and are not repeated herein.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a data write-back method according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of a data write-back method in a ticket issuing scenario according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a data write-back device according to an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
One of the current methods for synchronously writing back data to a database is to write back the stock in the cache to the database periodically by adding the cache and by timing tasks. The method can reduce database operation, but a timing task is required to run all the time, and no matter whether inventory deduction action exists or not, all cached data must be scanned during data synchronization, and especially, all database table data needs to be scanned under the scene that the database is divided into a plurality of databases. And the other is to write the message after adding the cache and reducing the cache stock and write the message back to the database asynchronously. This approach improves the issuing performance through caching, but does not reduce database operations and does not improve database bottlenecks. Based on the above technical problem, the present embodiment provides a data write-back method, where only when a time interval between a current time and a previous delay message exceeds a preset time threshold, a new delay message, that is, the current time, is generated, so that the number of times of writing the message can be reduced, and accumulated data in a period of time is written back to a database once based on the delay message, so that the contention pressure of a database lock resource can be reduced, specifically referring to fig. 1, where fig. 1 is a flowchart of a data write-back method provided in the embodiment of the present application, and specifically includes:
s101, when the reduction of the inventory data in the cache is detected, whether the time interval between the current time and the sending time of the last delay message exceeds a preset time threshold value or not is judged.
It is understood that reducing the inventory directly in the database reduces the performance of the database; therefore, by using the cache to improve the performance of the system, it can be understood that the inventory data in the cache is a mapping of the inventory data in the database, and when the inventory data in the cache is reduced, the inventory data needs to be written back to the database, so as to keep the database consistent with the inventory data in the cache. The embodiment does not limit the application scenario of deduction of stock data, and the reduction of the stock quantity of the coupons can be realized when the coupons (coupons) are issued; it may also be a new order for the goods, a decrease in the number of goods in stock, or other scenarios. It can be further understood that, in the present embodiment, the last delay message is a delay message for the current time, and a new delay message, that is, the current time, is generated only when the time interval between the current time and the sending time of the last delay message is greater than the preset time threshold. The specific size of the preset time threshold is not limited in this embodiment, and may be 1s, or 10s, and may be set according to actual conditions. In this embodiment, when it is detected that the stock data is subtracted, the message is not directly generated and written back to the database, but the delay message is generated only when the time interval between the current time and the sending time of the previous delay message exceeds the preset time threshold, so that the number of times of writing the message can be effectively reduced.
In this embodiment, a specific determination manner for determining whether a time interval between the current time and the sending time of the previous delay message exceeds a preset time threshold is not limited. In a specific embodiment, the determining whether the time interval between the current time and the sending time of the last delayed message exceeds a preset time threshold may include:
detecting whether a message identifier exists in a current service system; the existing duration of the message identifier is a preset time threshold;
if no message identification is detected in the current service system, the time interval between the current time and the sending time of the last delay message exceeds a preset time threshold;
if the message identification is detected in the current service system, the time interval between the current time and the sending time of the last delay message does not exceed the preset time threshold.
In this embodiment, by detecting whether a message identifier exists in the current service system, where the maximum survival time of the message identifier is a preset time threshold, that is, if a time interval between the current time and the sending time of the last delayed message does not exceed the preset time threshold, the message identifier can be detected; if the preset time threshold is exceeded, the message identification disappears. That is, in this embodiment, whether the time interval between the current time and the sending time of the last delayed message exceeds the preset time threshold is determined by detecting the existence of the message identifier.
And S102, if yes, generating a delay message at the current moment, and sending the delay message at the current moment to a delay message queue.
And if the time interval between the current time and the sending time of the last delay message exceeds a preset time threshold, generating a new delay message at the current time, and sending the new delay message to the delay message queue. It will be appreciated that after a producer sends a message to a message queue, it is not expected to be consumed immediately, but rather waits a specified time before it can be consumed by a consumer, such messages being commonly referred to as delayed messages. Accordingly, a queue for delaying message transmission, i.e., a queue having a delay function, is referred to as a delay message queue. The embodiment does not limit the specific content of the delay message, and may include the remaining stock quantity and the current stock deduction quantity, and may further include others.
Based on the foregoing embodiment, in a specific embodiment, after sending the delay message at the current time to the delay message queue, the method may further include:
and refreshing the message identifier to generate an updated message identifier.
That is, in this embodiment, after the delay message at the current time is sent to the delay message queue, the message identifier is refreshed, a new updated message identifier is generated, the message identifier disappears after exceeding the preset time threshold, and when the reduction of the stock quantity in the cache is detected, the next delay message can be generated.
S103, after the delay message of the current moment in the delay message queue is consumed by the database, the remaining stock data in the current cache is checked, and the remaining stock data is written back to the database.
It can be understood that after the delay message queue reaches the specified time threshold, the delay message queue can push the delay message at the current moment to the database for the database to consume the delay message, then look up the remaining inventory data in the current cache, and write back the remaining inventory data to the database, so as to keep the inventory quantity of the cache after the inventory deduction and the inventory quantity in the database consistent. In the embodiment, the accumulated inventory deduction amount within a certain time period, namely within the preset time threshold, is written into the delay message and is written back to the database at one time, so that frequent write-back operation of the database is avoided, and resource competition of database locks can be effectively reduced.
It can be understood that when the capacity of the cache reaches the maximum, the remaining stock data may be cleared, or when the network is abnormal, there may be a case where the remaining stock data in the cache cannot be viewed. Therefore, in order to perform write back on the database when the cache is abnormal and reduce the error between the inventory quantity of the database and the inventory quantity remaining in the cache, in this embodiment, before looking up the inventory data remaining in the current cache, the method may further include:
judging whether the current cache has residual inventory data;
and if not, writing back the residual inventory quantity in the delay message at the current moment to the database according to the residual inventory quantity in the delay message at the current moment.
In this embodiment, when the remaining inventory data is not checked in the current cache, the remaining inventory data is written back and forth to the database according to the remaining inventory amount in the delay message at the current time. That is, in this embodiment, when the cache anomaly is not obtained, the remaining inventory number is directly obtained from the message body, that is, the delay message at the current time, so that the number in the database only differs from the actual number by the delay time period, that is, the data amount within the specified time threshold, and the error can be effectively reduced.
Based on the technical scheme, the embodiment generates a new delay message, namely the current delay message, only when the time interval between the current time and the last delay message exceeds the preset time threshold, the number of times of writing the message can be reduced through the recorded message identifier based on the message reliability, and the accumulated data in a certain time period is written back to the database once regularly based on the delay message, so that the data synchronization efficiency is improved, the competition pressure of database lock resources is reduced, and the database data can be ensured to be kept consistent with the cache data as soon as possible.
The following provides a specific embodiment applied to a coupon issuing scenario. Fig. 2 is a schematic flow chart of a data write-back method in a ticket issuing scenario provided in this embodiment. The method comprises the following specific steps:
1. sending a coupon;
2. deducting the stock quantity of the coupons in the cache;
3. checking whether a write message identifier (or a message identifier) exists in a current service system;
4. if the message identification exists, ending the process; if no message identifier exists, generating a delay message, namely the delay message at the current moment, sending the delay message to a delay message queue, and refreshing the message identifier;
5. the ticket issuing is successful;
6. if the delay message in the delay message queue is consumed by the database, if the residual inventory quantity in the cache is checked, directly writing the residual inventory quantity back to the database; and if the cache exception does not obtain the quantity of the remaining stock, writing the remaining stock data in the delay message back to the database.
Based on the technical scheme, the operation times of the database can be obviously reduced, the higher the concurrency scene is, the better the effect is, and the performance problem of the database layer caused by the resource lock competition is reduced; the stock quantity of all the coupons is not required to be regularly scanned by a timing task, and only the stock quantity of the coupons with stock change is synchronized to the database; and a large amount of messages are not generated, message accumulation is not easy to cause, and excessive resources cannot be occupied for a message system.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a data write-back device according to an embodiment of the present disclosure, which includes:
in some specific embodiments, the method specifically includes:
a first determining module 301, configured to determine, when it is detected that the stock data in the cache is subtracted, whether a time interval between a current time and a sending time of a previous delay message exceeds a preset time threshold;
a generating module 302, configured to generate a delay message at the current time and send the delay message at the current time to a delay message queue if the delay message is positive;
the first write-back module 303 is configured to check remaining inventory data in the current cache and write back the remaining inventory data to the database after the database consumes the delay message at the current time in the delay message queue.
In some specific embodiments, the first determining module 301 includes:
the detection unit is used for detecting whether a message identifier exists in the current service system; the existing duration of the message identifier is a preset time threshold;
the first judging unit is used for judging whether the time interval between the current moment and the sending moment of the last delay message exceeds a preset time threshold value if the message identifier in the current service system is not detected;
and the second judging unit is used for judging that the time interval between the current time and the sending time of the last delay message does not exceed the preset time threshold if the message identifier is detected in the current service system.
In some specific embodiments, the method further comprises:
and the refreshing module is used for refreshing the message identifier and generating an updated message identifier.
In some specific embodiments, the method further comprises:
the second judgment module is used for judging whether the current cache has residual inventory data;
and the second write-back module is used for writing back the residual inventory quantity in the delay message at the current moment to the database according to the residual inventory quantity in the delay message at the current moment if the delay message is not delayed.
Since the embodiment of the data write-back apparatus portion and the embodiment of the data write-back method portion correspond to each other, please refer to the description of the embodiment of the data write-back method portion for the embodiment of the data write-back apparatus portion, which is not repeated here.
In the following, an electronic device provided by an embodiment of the present application is introduced, and the electronic device described below and the data write-back method described above may be referred to correspondingly.
The application also discloses an electronic device, including:
a memory for storing a computer program;
and the processor is used for realizing the steps of the data write-back method when executing the computer program.
Since the embodiment of the electronic device portion and the embodiment of the data write-back method portion correspond to each other, please refer to the description of the embodiment of the data write-back method portion for the embodiment of the electronic device portion, which is not repeated here.
The following describes a computer-readable storage medium provided by embodiments of the present application, and the computer-readable storage medium described below and the method described above may be referred to correspondingly.
The application also discloses a computer readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the above data write-back method.
Since the embodiment of the computer-readable storage medium portion and the embodiment of the method portion correspond to each other, please refer to the description of the embodiment of the method portion for the embodiment of the computer-readable storage medium portion, which is not repeated here.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above details are provided for a data write-back method, apparatus, electronic device and computer-readable storage medium provided by the present application. The principles and embodiments of the present application are explained herein using specific examples, which are provided only to help understand the method and the core idea of the present application. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.

Claims (10)

1. A method for data write back, comprising:
when the stock data in the cache is detected to be deducted, judging whether the time interval between the current time and the sending time of the last delay message exceeds a preset time threshold value or not;
if yes, generating the delay message of the current moment, and sending the delay message of the current moment to a delay message queue;
and after the database consumes the delay message at the current moment in the delay message queue, checking the residual inventory data in the current cache, and writing back the residual inventory data to the database.
2. The data write-back method according to claim 1, wherein the determining whether the time interval between the current time and the sending time of the last delayed message exceeds a preset time threshold includes:
detecting whether a message identifier exists in a current service system; the existing duration of the message identifier is the preset time threshold;
if the message identifier is not detected in the current service system, the time interval between the current time and the sending time of the last delay message exceeds the preset time threshold;
if the message identifier is detected in the current service system, the time interval between the current time and the sending time of the last delay message does not exceed the preset time threshold.
3. The data write-back method according to claim 2, wherein after the sending the delay message of the current time to a delay message queue, further comprising:
and refreshing the message identifier to generate an updated message identifier.
4. The data write-back method according to any one of claims 1 to 3, wherein before said checking said remaining inventory data in the current cache, further comprising:
judging whether the current cache has residual inventory data;
if not, writing back the residual inventory quantity in the delay message of the current moment to the database according to the residual inventory quantity in the delay message of the current moment.
5. A data write back apparatus, comprising:
the first judgment module is used for judging whether the time interval between the current moment and the sending moment of the last delay message exceeds a preset time threshold value or not when the reduction of the inventory data in the cache is detected;
a generating module, configured to generate the delay message at the current time and send the delay message at the current time to a delay message queue if the delay message at the current time is the same as the delay message at the current time;
and the first write-back module is used for checking the residual inventory data in the current cache and writing back the residual inventory data to the database after the database consumes the delay message at the current moment in the delay message queue.
6. The data write back device of claim 5, wherein the first determining module comprises:
the detection unit is used for detecting whether a message identifier exists in the current service system; the existing duration of the message identifier is the preset time threshold;
a first determining unit, configured to determine that a time interval between the current time and the sending time of the previous delay message exceeds the preset time threshold if the message identifier is not detected in the current service system;
a second determining unit, configured to determine that a time interval between the current time and the sending time of the previous delay message does not exceed the preset time threshold if the message identifier is detected in the current service system.
7. The data write back apparatus of claim 6, further comprising:
and the refreshing module is used for refreshing the message identifier and generating an updated message identifier.
8. The data write back apparatus of claim 5, further comprising:
the second judgment module is used for judging whether the current cache has residual inventory data;
and the second write-back module is used for writing back the residual inventory number in the delay message of the current moment to the database according to the residual inventory number in the delay message of the current moment if the delay message of the current moment is not the same as the delay message of the current moment.
9. An electronic device, comprising:
a memory for storing a computer program;
processor for implementing the steps of the data write-back method according to any one of claims 1 to 4 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the data write-back method according to any one of claims 1 to 4.
CN202110648654.5A 2021-06-10 2021-06-10 Data write-back method and device, electronic equipment and storage medium Pending CN113377792A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110648654.5A CN113377792A (en) 2021-06-10 2021-06-10 Data write-back method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110648654.5A CN113377792A (en) 2021-06-10 2021-06-10 Data write-back method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113377792A true CN113377792A (en) 2021-09-10

Family

ID=77573680

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110648654.5A Pending CN113377792A (en) 2021-06-10 2021-06-10 Data write-back method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113377792A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114710369A (en) * 2022-06-06 2022-07-05 山东云天安全技术有限公司 Abnormal data detection method and device, computer equipment and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104850556A (en) * 2014-02-17 2015-08-19 阿里巴巴集团控股有限公司 Method and device for data processing
WO2017201968A1 (en) * 2016-05-25 2017-11-30 乐视控股(北京)有限公司 Verification method and verification system for merchandise inventory
CN108334505A (en) * 2017-01-19 2018-07-27 阿里巴巴集团控股有限公司 A kind of data processing method, device, server and inventory system
WO2018161881A1 (en) * 2017-03-09 2018-09-13 腾讯科技(深圳)有限公司 Structuralized data processing method, data storage medium, and computer apparatus
JP2018181314A (en) * 2017-04-05 2018-11-15 Line株式会社 Data transmitting/receiving method and system
CN109191233A (en) * 2018-07-31 2019-01-11 上海哔哩哔哩科技有限公司 A kind of second kills lower single request processing method, device and storage medium
CN110633320A (en) * 2018-05-30 2019-12-31 北京京东尚科信息技术有限公司 Processing method, system, equipment and storage medium of distributed data service
CN111930786A (en) * 2020-08-14 2020-11-13 中国工商银行股份有限公司 Resource acquisition request processing system, method and device
US20210055976A1 (en) * 2019-08-20 2021-02-25 International Business Machines Corporation Processing of a message stream
CN112527844A (en) * 2020-12-22 2021-03-19 北京明朝万达科技股份有限公司 Data processing method and device and database architecture

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104850556A (en) * 2014-02-17 2015-08-19 阿里巴巴集团控股有限公司 Method and device for data processing
WO2017201968A1 (en) * 2016-05-25 2017-11-30 乐视控股(北京)有限公司 Verification method and verification system for merchandise inventory
CN108334505A (en) * 2017-01-19 2018-07-27 阿里巴巴集团控股有限公司 A kind of data processing method, device, server and inventory system
WO2018161881A1 (en) * 2017-03-09 2018-09-13 腾讯科技(深圳)有限公司 Structuralized data processing method, data storage medium, and computer apparatus
JP2018181314A (en) * 2017-04-05 2018-11-15 Line株式会社 Data transmitting/receiving method and system
CN110633320A (en) * 2018-05-30 2019-12-31 北京京东尚科信息技术有限公司 Processing method, system, equipment and storage medium of distributed data service
CN109191233A (en) * 2018-07-31 2019-01-11 上海哔哩哔哩科技有限公司 A kind of second kills lower single request processing method, device and storage medium
US20210055976A1 (en) * 2019-08-20 2021-02-25 International Business Machines Corporation Processing of a message stream
CN111930786A (en) * 2020-08-14 2020-11-13 中国工商银行股份有限公司 Resource acquisition request processing system, method and device
CN112527844A (en) * 2020-12-22 2021-03-19 北京明朝万达科技股份有限公司 Data processing method and device and database architecture

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114710369A (en) * 2022-06-06 2022-07-05 山东云天安全技术有限公司 Abnormal data detection method and device, computer equipment and storage medium
CN114710369B (en) * 2022-06-06 2022-08-16 山东云天安全技术有限公司 Abnormal data detection method and device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
EP3258396A1 (en) Data synchronization method, device and system
CN109614377A (en) File delet method, device, equipment and the storage medium of distributed file system
CN109240836B (en) Method and device for configuring messages of message queue
CN111857589A (en) SSD cache down-flushing speed control method and system in distributed storage system
US9558091B2 (en) Information processing device, fault avoidance method, and program storage medium
CN101102281A (en) Data processing method for reporting a large number of data in mobile communication system
CN107608627B (en) Remote data hierarchical storage method, electronic equipment and storage medium
CN110737388A (en) Data pre-reading method, client, server and file system
CN113377792A (en) Data write-back method and device, electronic equipment and storage medium
CN106055281B (en) Data writing method and device
US7660964B2 (en) Windowing external block translations
EP3588913A1 (en) Data caching method and apparatus
CN109167690A (en) A kind of restoration methods, device and the relevant device of the service of distributed system interior joint
CN111309548A (en) Timeout monitoring method and device and computer readable storage medium
CN112035353A (en) Log recording method, device, equipment and computer readable storage medium
CN110888739B (en) Distributed processing method and device for delayed tasks
CN110659132B (en) Request processing optimization method and computer-readable storage medium
CN112084264A (en) Log data synchronization method and device and server
CN111966511A (en) Message queue data read-write processing method and device
CN109819000A (en) Methods, devices and systems and machine readable storage medium for PUSH message
CN114157717B (en) System and method for dynamic current limiting of micro-service
CN106357557A (en) Message processing method and device
CN113568891B (en) Distributed ID generation method, device, server and readable storage medium
CN113536034A (en) Data writing method and data reading method based on bloom filter
CN112860746B (en) Cache reduction-based method, equipment and system

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
TA01 Transfer of patent application right

Effective date of registration: 20231108

Address after: 200441 Room B1-7001, Building 3, No. 258 Changjiang Road, Baoshan District, Shanghai

Applicant after: Shanghai Mengju Information Technology Co.,Ltd.

Address before: Room b1-8008, building 3, 258 Changjiang Road, Baoshan District, Shanghai 200441

Applicant before: Shanghai Weimeng Enterprise Development Co.,Ltd.