Inventory Information Processing Method and System, Computer System, and Readable Storage Medium

By storing inventory information in relational databases and in-memory databases, the efficiency of inventory information update and transaction operation response in high concurrency scenarios is solved, and the system's high concurrency processing capability is achieved.

CN111292028BActive Publication Date: 2025-05-27BEIJING JINGDONG SHANGKE INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN201811490672.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-12-06
Publication Date
2025-05-27
Estimated Expiration
2038-12-06

AI Technical Summary

Technical Problem

In the high concurrent trading scenario, it is difficult for the existing technology to update inventory information in a timely manner, resulting in insufficient system processing capabilities and inability to respond to trading operations in a timely manner.

Method used

The method of storing inventory information in a relational database and an in-memory database is adopted. The relational database is used to update the original inventory information, and the in-memory database is used to respond to transaction operations to avoid resource competition.

Benefits of technology

It realizes timely updates inventory information and responds to transaction operations in high concurrency scenarios, and improves the system's concurrency processing capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111292028B_ABST
    Figure CN111292028B_ABST
Patent Text Reader

Abstract

The present disclosure provides an inventory information processing method, including: obtaining an update operation; in response to the update operation, updating the original inventory information of a target product stored in a first type of database to obtain the updated inventory information of the target product; and transmitting the updated inventory information of the target product to a second type of database so as to update the inventory information of the target product stored in the second type of database, wherein the second type of database is used to respond to a transaction operation when trading the target product. The present disclosure also provides an inventory information processing system, a computer system, and a computer-readable storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technologies, and more particularly, to an inventory information processing method and system, a computer system, and a computer-readable storage medium. Background Art

[0002] With the continuous development of technologies, users can trade different products through online trading platforms. To ensure a relatively sufficient inventory, product providers on trading platforms generally need to know the actual specific inventory of products. Generally, they also need to disclose the corresponding inventory information on the trading platform. However, since transactions are constantly in progress, especially in high-concurrency trading scenarios such as 618 and Double Eleven, the inventory information on the trading platform is also constantly changing, and the change rate of inventory information is generally at the second level.

[0003] In the process of implementing the present invention, the inventors found that: when updating the original inventory information using related technologies, resource competition will occur with response to trading operations, making the system processing capacity unable to meet high-concurrency scenarios, resulting in the inability to change the inventory information in a timely and effective manner. Summary of the Invention

[0004] In view of this, the present disclosure provides an inventory information processing method and system, a computer system, and a computer-readable storage medium.

[0005] One aspect of the present disclosure provides an inventory information processing method, including: obtaining an update operation; in response to the update operation, updating the original inventory information of a target product stored in a first type of database to obtain the updated inventory information of the target product; and transmitting the updated inventory information of the target product to a second type of database to update the inventory information of the target product stored in the second type of database, where the second type of database is used to respond to trading operations when trading the target product.

[0006] According to an embodiment of the present disclosure, the first type of database is a relational database, and the second type of database is a memory database.

[0007] According to an embodiment of the present disclosure, the method further includes: obtaining a trading operation for trading the target product; in response to the trading operation, generating a trading order and determining the trading quantity of the target product in the trading order; and subtracting the trading quantity from the inventory quantity of the target product stored in the second type of database.

[0008] According to an embodiment of the present disclosure, after subtracting the transaction quantity from the inventory quantity of the target product stored in the second type of database, the method further includes: determining whether the transaction operation is successful; in the case of a successful transaction, transmitting the transaction quantity to the first type of database to update the current inventory quantity of the target product in the first type of database; and in the case of a failed transaction, restoring the current inventory quantity of the target product in the second type of database to the inventory quantity before subtracting the transaction quantity.

[0009] According to an embodiment of the present disclosure, wherein: when the first type of database is a relational database, the relational database stores the inventory information of the target product in the form of table fields, where the table fields at least include product identification information, inventory type, and inventory quantity; when the second type of database is a memory database, the memory database stores the inventory information of the target product in the form of a hash table and / or an ordered set type, where the hash table at least includes product identification information, order identification information, and inventory quantity, and the ordered set type at least includes product identification information, order identification information, and the timestamp information of order generation.

[0010] Another aspect of the present disclosure provides an inventory information processing system, including: a first acquisition module, configured to acquire an update operation; a first response module, configured to update the original inventory information of the target product stored in the first type of database in response to the update operation to obtain the updated inventory information of the target product; and a first transmission module, configured to transmit the updated inventory information of the target product to the second type of database to update the inventory information of the target product stored in the second type of database, where the second type of database is used to respond to the transaction operation when trading the target product.

[0011] According to an embodiment of the present disclosure, the first type of database is a relational database, and the second type of database is a memory database.

[0012] According to an embodiment of the present disclosure, the system further includes: a second acquisition module, configured to acquire a transaction operation for trading the target product; a second response module, configured to generate a transaction order in response to the transaction operation and determine the transaction quantity of the target product in the transaction order; and a first calculation module, configured to subtract the transaction quantity from the inventory quantity of the target product stored in the second type of database.

[0013] According to an embodiment of the present disclosure, the above system further includes: a judgment module, configured to judge whether the above transaction operation is successful after subtracting the above transaction quantity from the inventory quantity of the above target product stored in the above second type database; a second transmission module, configured to transmit the above transaction quantity to the above first type database to update the current inventory quantity of the above target product in the above first type database in case of a successful transaction; and a second calculation module, configured to restore the current inventory quantity of the above target product in the above second type database to the inventory quantity before subtracting the above transaction quantity in case of a failed transaction.

[0014] According to an embodiment of the present disclosure, wherein: when the above first type database is a relational database, the relational database stores the inventory information of the above target product in the form of table fields, where the table fields at least include product identification information, inventory type, and inventory quantity; when the above second type database is a memory database, the memory database stores the inventory information of the above target product in the form of a hash table and / or an ordered set type, where the hash table at least includes product identification information, order identification information, and inventory quantity, and the ordered set type at least includes product identification information, order identification information, and the timestamp information of order generation.

[0015] Another aspect of the present disclosure provides a computer system, including: one or more processors; a memory, configured to store one or more programs, wherein when the above one or more programs are executed by the above one or more processors, the above one or more processors implement the inventory information processing method as described above.

[0016] Another aspect of the present disclosure provides a computer-readable storage medium, on which executable instructions are stored, and when the instructions are executed by a processor, the processor implements the inventory information processing method as described above.

[0017] Another aspect of the present disclosure provides a computer program, the computer program includes computer-executable instructions, and the instructions are used to implement the inventory information processing method as described above when executed.

[0018] Through the embodiments of the present disclosure, the inventory information of products is stored separately in two different types of databases. The first type of database is used to update the original inventory information and transmit the updated inventory information of the products to the second type of database. The second type of database is used to respond to the transaction operations when trading products. By using this technical means, the update of the original inventory information and the response to the transaction operations are carried out in different databases respectively, so the situation of resource competition will not occur, and the system processing capacity can meet the high-concurrency scenario. Therefore, at least partially, the technical problem that the system processing capacity cannot meet the high-concurrency scenario, resulting in the inability to change the inventory information in a timely and effective manner, is overcome. Furthermore, the purpose of changing the inventory information in a timely manner is achieved, and the technical effect of improving the system concurrency processing capacity is obtained. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Through the following description of the embodiments of the present disclosure with reference to the drawings, the above and other objects, features, and advantages of the present disclosure will become clearer. In the drawings:

[0020] Figure 1 Schematically shows an exemplary system architecture to which the inventory information processing method and system according to the embodiments of the present disclosure can be applied;

[0021] Figure 2 Schematically shows a flowchart of the inventory information processing method according to the embodiments of the present disclosure;

[0022] Figure 3 Schematically shows a flowchart of the inventory information processing method according to another embodiment of the present disclosure;

[0023] Figure 4 Schematically shows a flowchart of the inventory information processing method according to another embodiment of the present disclosure;

[0024] Figure 5 Schematically shows a flowchart of the inventory information processing method according to another embodiment of the present disclosure;

[0025] Figure 6 Schematically shows a block diagram of the inventory information processing system according to the embodiments of the present disclosure;

[0026] Figure 7 Schematically shows a block diagram of the inventory information processing system according to another embodiment of the present disclosure;

[0027] Figure 8 Schematically shows a block diagram of the inventory information processing system according to another embodiment of the present disclosure; and

[0028] Figure 9 Schematically shows a block diagram of a computer system suitable for implementing the method described above according to the embodiments of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0029] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present disclosure. In the following detailed description, for the sake of explanation, numerous specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, obviously, one or more embodiments can also be implemented without these specific details. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily confusing the concepts of the present disclosure.

[0030] The terms used herein are merely for describing specific embodiments and are not intended to limit the present disclosure. The terms "including", "comprising", etc. used herein indicate the presence of the described features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0031] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those of ordinary skill in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

[0032] In cases where expressions similar to "at least one of A, B, and C, etc." are used, generally, it should be interpreted according to the meaning commonly understood by those of ordinary skill in the art (for example, "a system having at least one of A, B, and C" should include, but is not limited to, a system having only A, only B, only C, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.). In cases where expressions similar to "at least one of A, B, or C, etc." are used, generally, it should be interpreted according to the meaning commonly understood by those of ordinary skill in the art (for example, "a system having at least one of A, B, or C" should include, but is not limited to, a system having only A, only B, only C, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.).

[0033] Embodiments of the present disclosure provide an inventory information processing method, including obtaining an update operation; in response to the update operation, updating the original inventory information of a target product stored in a first type of database to obtain the updated inventory information of the target product; and transmitting the updated inventory information of the target product to a second type of database so as to update the inventory information of the target product stored in the second type of database, wherein the second type of database is used to respond to a transaction operation when trading the target product. The present disclosure also provides an inventory information processing system, a computer system, and a computer-readable storage medium.

[0034] Figure 1Schematically shown is an exemplary system architecture to which the inventory information processing method and system according to embodiments of the present disclosure can be applied. It should be noted that Figure 1 What is shown is only an example of the system architecture to which embodiments of the present disclosure can be applied, to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.

[0035] As Figure 1 shown, the system architecture 100 according to this embodiment may include a first type of database 101 and a second type of database 102.

[0036] Among them, the first type of database 101 can obtain inventory information of different products through an external interface, and by monitoring operations of whether the first type of database obtains updated inventory information, for example, a new inventory operation for adding inventory quantity, or a reduced inventory operation for reducing inventory quantity. The first type of database 101 can update the original inventory information of the target product stored in the first type of database 101 in response to the update operation.

[0037] The second type of database 102 is mainly used to respond to transaction operations when trading target products. For example, after a user places an order, determine the quantity of products included in the order, and then subtract the quantity of products required in the order from the inventory quantity stored in the second type of database 102.

[0038] According to an embodiment of the present invention, information can be transmitted between the first type of database 101 and the second type of database 102. For example, when a product is prepared for transaction, synchronize the original inventory information in the first type of database 101 to the second type of database 102. When there is new inventory in the first type of database 101, it can be asynchronously updated to the second type of database 102 through a scheduled task. When an order transaction in the second type of database 102 is successful, it can be asynchronously updated to the first type of database 101 through a scheduled task.

[0039] Through the embodiments of the present disclosure, the technical means of storing the inventory information of products in two different types of databases respectively is adopted, and the first type of database is used to update the original inventory information and transmit the updated inventory information of the product to the second type of database, and the second type of database is used to respond to transaction operations when trading products, so that the update of the original inventory information and the response to transaction operations are carried out in different databases respectively, so there will be no resource competition situation, enabling the system processing ability to meet high-concurrency scenarios, so at least partially overcoming the technical problem that the system processing ability cannot meet high-concurrency scenarios, resulting in the inability to change inventory information in a timely and effective manner, and thus achieving the purpose of changing inventory information in a timely manner and improving the technical effect of the system concurrency processing ability.

[0040] It should be understood that Figure 1 the numbers of the first type of database, the second type of database, and the network in

[0041] Figure 2 FIG. schematically shows a flowchart of an inventory information processing method according to an embodiment of the present disclosure.

[0042] As Figure 2 shown, the method includes operations S210 to S230.

[0043] In operation S210, an update operation is obtained.

[0044] In operation S220, in response to the update operation, the original inventory information of the target product stored in the first type of database is updated to obtain the updated inventory information of the target product.

[0045] According to an embodiment of the present disclosure, the update operation may be a new inventory operation for adding the inventory quantity, or a reduce inventory operation for reducing the inventory quantity. For example, the number of thermos cups stored in the first type of database is increased from 100 to 200, or the number of thermos cups stored in the first type of database is reduced from 500 to 250.

[0046] In operation S230, the updated inventory information of the target product is transmitted to the second type of database so as to update the inventory information of the target product stored in the second type of database, where the second type of database is used to respond to the transaction operation when trading the target product.

[0047] According to an embodiment of the present disclosure, after the first type of database updates the original inventory information of the target product, it can be asynchronously updated to the second type of database through a scheduled task.

[0048] According to an embodiment of the present disclosure, the first type of database is a relational database, and the second type of database is a memory database.

[0049] According to an embodiment of the present disclosure, the second type of database uses a memory database, such as a redis cache database. Since the transaction operation when trading the target product generally occurs in a high-concurrency scenario, the performance of operating redis in a concurrent scenario is higher than that of a relational database, and the increm operation of redis supports atomic transactions. Therefore, on the premise of ensuring data security, the processing efficiency of operating inventory information can be effectively improved.

[0050] Through the embodiments of the present disclosure, the inventory information of products is stored in two different types of databases respectively. The first type of database is used to update the original inventory information and transmit the updated inventory information of the products to the second type of database. The second type of database is used to respond to the transaction operations when trading products. By this technical means, the update of the original inventory information and the response to the transaction operations are carried out in different databases respectively, so the situation of resource competition will not occur, and the system processing capacity can meet the high-concurrency scenario. Therefore, at least partially, the technical problem that the system processing capacity cannot meet the high-concurrency scenario, resulting in the inability to change the inventory information in a timely and effective manner, is overcome. Furthermore, the purpose of changing the inventory information in a timely manner is achieved, and the technical effect of improving the system concurrency processing capacity is obtained.

[0051] The following refers to Figures 3 to 5 and further describes the Figure 2 method shown in combination with specific embodiments.

[0052] Figure 3 FIG. schematically shows a flowchart of an inventory information processing method according to another embodiment of the present disclosure.

[0053] As Figure 3 shown, the method further includes operations S240 to S260.

[0054] In operation S240, obtain the transaction operation for trading the target product.

[0055] In operation S250, in response to the transaction operation, generate a transaction order and determine the transaction quantity of the target product in the transaction order.

[0056] In operation S260, subtract the transaction quantity from the inventory quantity of the target product stored in the second type of database.

[0057] According to the embodiments of the present disclosure, for example, when a user places an order and 5 pieces of clothes are traded in the order, if the original inventory quantity of clothes in the second type of database is 10 pieces, after subtracting the transaction quantity of 5 pieces, the current inventory quantity of clothes in the second type of database is 5 pieces.

[0058] According to the embodiments of the present disclosure, taking the second type of database as a redis cache database as an example, because the operation performance of the redis cache database is much higher than that of the relational database in the concurrent scenario, and the operation of the in-memory database supports atomic transactions, the efficiency of operating the inventory information is greatly improved on the premise of ensuring data security.

[0059] Figure 4 FIG. schematically shows a flowchart of an inventory information processing method according to another embodiment of the present disclosure.

[0060] As Figure 4As shown, after subtracting the transaction quantity from the inventory quantity of the target product stored in the second type of database, the method includes operations S270 to S290.

[0061] In operation S270, it is determined whether the transaction operation is successful.

[0062] In operation S280, when the transaction is successful, the transaction quantity is transmitted to the first type of database to update the current inventory quantity of the target product in the first type of database.

[0063] According to an embodiment of the present disclosure, the indication of a successful transaction may be that the user has completed the order placement, or that the user has completed the online payment, etc.

[0064] According to an embodiment of the present disclosure, when the transaction is successful, the quantity of the successfully traded products can be transmitted to the first type of database in a multi-threaded processing manner to update the current inventory quantity of the target product in the first type of database. Since the transmission to the first type of database is in a multi-threaded processing manner and the processing time is short, the amount of data processed each time will be much smaller, which can improve the database response efficiency.

[0065] In operation S290, when the transaction fails, the current inventory quantity of the target product in the second type of database is restored to the inventory quantity before subtracting the transaction quantity.

[0066] According to an embodiment of the present disclosure, the indication of a failed transaction may be that the user has not paid within the time limit, or that the user has cancelled the order, reducing the transaction volume, etc.

[0067] According to an embodiment of the present disclosure, when the transaction fails, the current inventory quantity of the target product in the second type of database can be directly restored to the inventory quantity before subtracting the transaction quantity. For example, when the user places an order and 2 pairs of trousers are traded in the order, if the original inventory quantity of trousers in the second type of database is 20 pairs, after subtracting the transaction volume of 2 pairs, the current inventory quantity of trousers in the second type of database is 18 pairs. When the transaction fails, such as the user not paying within the time limit, the current inventory quantity of trousers in the second type of database, which is 18 pairs, is restored to 20 pairs. In this case, there is no need to send the information about the inventory change caused by the order placement to the first type of database, reducing the number of responses of the first type of database.

[0068] According to an embodiment of the present disclosure, when the first type of database is a relational database, the relational database stores the inventory information of the target product in the form of table fields, where the table fields at least include product identification information, inventory type, and inventory quantity.

[0069] According to an embodiment of the present disclosure, in the relational database, the table structure design may be in the form of Table 1 below.

[0070] Table 1

[0071]

[0072] According to an embodiment of the present disclosure, the product identification information may be a product ID, and the inventory types include unsynchronized inventory and synchronized inventory. Among them, the unsynchronized inventory refers to the situation where the updated inventory information is not synchronously or asynchronously transmitted to the second type of database.

[0073] According to an embodiment of the present disclosure, when the second type of database is an in-memory database, the in-memory database stores the inventory information of the target product in the form of a hash table and / or a sorted set type. Among them, the hash table at least includes product identification information, order identification information, and inventory quantity, and the sorted set type at least includes product identification information, order identification information, and the timestamp information of the order generation.

[0074] According to an embodiment of the present disclosure, the hash table form (hash type) may be in the following form:

[0075] key: product ID + "_" + order number; value: inventory quantity.

[0076] According to an embodiment of the present disclosure, the sorted set type (sortedSet type) may be in the following form:

[0077] Key: product ID; Value: order number, timestamp 1 of the order generation, orderId1, timestamp 2, orderId2...

[0078] According to an embodiment of the present disclosure, when reducing the inventory quantity, the inventory quantity in the hash structure can be deleted according to the wareId and order number, the order number in the sortedSet structure can be deleted, and the inventory information in the hash structure can be written into the sold inventory information. When recycling the inventory quantity, all orders with score < current timestamp - 10 minutes in the sortedSet structure can be polled and deleted; according to the order numbers deleted from the sortedSet, the inventory information in the hash structure can be deleted and recycled to the for-sale inventory in the second type of database.

[0079] Figure 5 Schematically shows a flowchart of an inventory information processing method according to another embodiment of the present disclosure.

[0080] As Figure 5 shown, the first type of database is a relational database, and the second type of database is an in-memory database. In the relational database, the original inventory may be the total amount of all unsold inventory, including the inventory that has been synchronized to the in-memory database and the inventory that has not been synchronized to the in-memory database.

[0081] According to an embodiment of the present disclosure, the product inventory status can be divided into three states: available, locked, and sold. Among them, the locked inventory and the sold inventory can be divided into several parts, each part is associated with a corresponding order number, and the available inventory is associated with a certain commodity type (SKU) in the in-memory database. In the initial state, the locked inventory and the sold inventory are empty.

[0082] According to an embodiment of the present disclosure, when unsynchronized inventory information is detected in the relational database, an operation of adding new inventory is performed, and the inventory information can be added to the available inventory. Then, the inventory information is deleted from the unsynchronized inventory and added to the synchronized inventory.

[0083] According to an embodiment of the present disclosure, when placing an order, inventory can be locked in the in-memory database, and the inventory information bound by the order is deleted from the available inventory and added to the locked inventory.

[0084] According to an embodiment of the present disclosure, in the case of a successful transaction, for example, after payment, the inventory bound to the order is deleted from the locked inventory and added to the sold inventory (in-memory database).

[0085] According to an embodiment of the present disclosure, in the case of a failed transaction, for example, timeout without payment, the inventory is recovered, and the inventory bound to the timeout order is deleted from the locked inventory and added to the available inventory, that is, it is restored to the inventory information before the transaction.

[0086] According to an embodiment of the present disclosure, the sold inventory (in-memory database) in the cache can be synchronized to the relational database at regular intervals, that is, the sold inventory is deleted from the in-memory database, and at the same time, two other operations are performed: adding the corresponding sold inventory to the sold inventory (relational database), and subtracting the corresponding sold inventory from the synchronized inventory of the original inventory.

[0087] Through the embodiment of the present disclosure, a technical means is adopted in which the inventory information of the product is stored in two different types of databases respectively, and the first type of database is used to update the original inventory information and transmit the updated inventory information of the product to the second type of database. The second type of database is used to respond to the transaction operations when trading products. In this way, the update of the original inventory information and the response to the transaction operations are carried out in different databases respectively, so there will be no resource competition situation, and the system processing capacity can meet the high-concurrency scenario. Therefore, at least partially, the technical problem that the system processing capacity cannot meet the high-concurrency scenario, resulting in the inability to change the inventory information in a timely and effective manner, is overcome, and the purpose of changing the inventory information in a timely manner is achieved, and the technical effect of improving the system concurrency processing capacity is achieved.

[0088] Figure 6 A block diagram of an inventory information processing system according to an embodiment of the present disclosure is schematically shown.

[0089] As Figure 6 shown, the inventory information processing system 500 includes a first acquisition module 510, a first response module 520, and a first transmission module 530.

[0090] The first acquisition module 510 is used to acquire an update operation.

[0091] The first response module 520 is used to update the original inventory information of the target product stored in the first type of database in response to the update operation, and obtain the updated inventory information of the target product.

[0092] The first transmission module 530 is used to transmit the updated inventory information of the target product to the second type of database, so as to update the inventory information of the target product stored in the second type of database, where the second type of database is used to respond to the transaction operation when trading the target product.

[0093] Through the embodiments of the present disclosure, the technical means of storing the inventory information of products in two different types of databases respectively is adopted, and the first type of database is used to update the original inventory information and transmit the updated inventory information of the product to the second type of database, and the second type of database is used to respond to the transaction operation when trading the product, so that the update of the original inventory information and the response to the transaction operation are carried out in different databases respectively, so that the situation of resource competition will not occur, and the system processing capacity can meet the high-concurrency scenario. Therefore, at least partially, the technical problem that the system processing capacity cannot meet the high-concurrency scenario and cause the inventory information to be changed in a timely and effective manner is overcome, and the purpose of changing the inventory information in a timely manner is achieved, and the technical effect of improving the system concurrency processing capacity is achieved.

[0094] According to the embodiments of the present disclosure, the first type of database is a relational database, and the second type of database is a memory database.

[0095] According to the embodiments of the present disclosure, the second type of database adopts a memory database, such as a redis cache database. Since the transaction operation when trading the target product generally occurs in a high-concurrency scenario, the performance of operating redis in a concurrent scenario is higher than that of a relational database, and the increm operation of redis supports atomic transactions. Therefore, on the premise of ensuring data security, the processing efficiency of operating inventory information can be effectively improved.

[0096] Figure 7 Schematically shows a block diagram of an inventory information processing system according to another embodiment of the present disclosure.

[0097] As Figure 7 shown, the inventory information processing system 500 further includes a second acquisition module 540, a second response module 550, and a first calculation module 560.

[0098] The second acquisition module 540 is configured to acquire a transaction operation for trading a target product.

[0099] The second response module 550 is configured to generate a transaction order in response to the transaction operation, and determine the transaction quantity of the target product in the transaction order. And

[0100] The first calculation module 560 is configured to subtract the transaction quantity from the inventory quantity of the target product stored in the second type database.

[0101] According to an embodiment of the present disclosure, taking the second type database as a redis cache database as an example, since the operation performance of the redis cache database in a concurrent scenario is much higher than that of a relational database, and the operation of the in-memory database supports atomic transactions, the efficiency of operating inventory information is greatly improved on the premise of ensuring data security.

[0102] Figure 8 Schematically shows a block diagram of an inventory information processing system according to another embodiment of the present disclosure.

[0103] As Figure 8 shown, the inventory information processing system 500 further includes a judgment module 570, a second transmission module 580, and a second calculation module 590.

[0104] The judgment module 570 is configured to judge whether the transaction operation is successful after subtracting the transaction quantity from the inventory quantity of the target product stored in the second type database.

[0105] The second transmission module 580 is configured to transmit the transaction quantity to the first type database in the case of a successful transaction to update the current inventory quantity of the target product in the first type database.

[0106] The second calculation module 590 is configured to restore the current inventory quantity of the target product in the second type database to the inventory quantity before subtracting the transaction quantity in the case of a failed transaction.

[0107] According to an embodiment of the present disclosure, in the case of a successful transaction, the quantity of the successfully traded products can be transmitted to the first type database in a multi-threaded processing manner to update the current inventory quantity of the target product in the first type database. Since the transmission to the first type database in a multi-threaded processing manner has a short processing time, the amount of data processed each time will be much smaller, and the database response efficiency can be improved.

[0108] According to an embodiment of the present disclosure, in the case where the first type database is a relational database, the relational database stores the inventory information of the target product in the form of table fields, where the table fields at least include product identification information, inventory type, and inventory quantity.

[0109] According to an embodiment of the present disclosure, when the second type of database is an in-memory database, the in-memory database stores the inventory information of the target product in the form of a hash table and / or an ordered set type, wherein the hash table at least includes product identification information, order identification information, and inventory quantity, and the ordered set type at least includes product identification information, order identification information, and the timestamp information generated by the order.

[0110] According to an embodiment of the present disclosure, when reducing the inventory quantity and recycling the inventory quantity, it is possible to process according to the information in different data formats, reduce or recycle the inventory to the for-sale inventory of the second type of database, thereby improving the information processing efficiency.

[0111] According to an embodiment of the present disclosure, any plurality of modules, sub-modules, units, and sub-units, or at least part of the functions of any of them can be implemented in one module. Any one or more of the modules, sub-modules, units, and sub-units according to the embodiments of the present disclosure can be split into multiple modules for implementation. Any one or more of the modules, sub-modules, units, and sub-units according to the embodiments of the present disclosure can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging the circuit, or can be implemented in any one of the three implementation manners of software, hardware, and firmware, or in an appropriate combination of any several of them. Alternatively, one or more of the modules, sub-modules, units, and sub-units according to the embodiments of the present disclosure can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding functions can be executed.

[0112] For example, any combination of the first acquisition module 510, the first response module 520, the first transmission module 530, the second acquisition module 540, the second response module 550, the first calculation module 560, the judgment module 570, the second transmission module 580, and the second calculation module 590 may be combined and implemented in one module / unit / sub-unit, or any one of the modules / units / sub-units may be split into multiple modules / units / sub-units. Alternatively, at least part of the functions of one or more of these modules / units / sub-units may be combined with at least part of the functions of other modules / units / sub-units and implemented in one module / unit / sub-unit. According to an embodiment of the present disclosure, at least one of the first acquisition module 510, the first response module 520, the first transmission module 530, the second acquisition module 540, the second response module 550, the first calculation module 560, the judgment module 570, the second transmission module 580, and the second calculation module 590 may be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or may be implemented by any other reasonable means of integrating or packaging circuits, etc., in hardware or firmware, or implemented in any one of the three implementation manners of software, hardware, and firmware, or in an appropriate combination of any several of them. Alternatively, at least one of the first acquisition module 510, the first response module 520, the first transmission module 530, the second acquisition module 540, the second response module 550, the first calculation module 560, the judgment module 570, the second transmission module 580, and the second calculation module 590 may be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding functions may be executed.

[0113] Figure 9 Schematically shows a block diagram of a computer system suitable for implementing the method described above according to an embodiment of the present disclosure. Figure 9 The computer system shown is only an example and should not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.

[0114] As Figure 9As shown, the computer system 600 according to an embodiment of the present disclosure includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage section 608 into a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., CPU), an instruction set processor, and / or a related chipset, and / or a dedicated microprocessor (e.g., an application-specific integrated circuit (ASIC)), and so on. The processor 601 may also include on-board memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.

[0115] In the RAM 603, various programs and data required for the operation of the system 600 are stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. The processor 601 performs various operations of the method flow according to an embodiment of the present disclosure by executing the program in the ROM 602 and / or the RAM 603. It should be noted that the program may also be stored in one or more memories other than the ROM 602 and the RAM 603. The processor 601 may also perform various operations of the method flow according to an embodiment of the present disclosure by executing the program stored in the one or more memories.

[0116] According to an embodiment of the present disclosure, the system 600 may further include an input / output (I / O) interface 605, and the input / output (I / O) interface 605 is also connected to the bus 604. The system 600 may further include one or more of the following components connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including, for example, a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed so that a computer program read from it can be installed into the storage section 608 as needed.

[0117] According to an embodiment of the present disclosure, the method flow according to the embodiments of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program includes program codes for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, the above functions defined in the system according to the embodiments of the present disclosure are executed. According to an embodiment of the present disclosure, the above-described systems, devices, apparatuses, modules, units, etc. can be implemented by computer program modules.

[0118] The present disclosure also provides a computer-readable storage medium, which may be included in the device / device / system described in the above embodiments; or may exist alone without being assembled into the device / device / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiments of the present disclosure is implemented.

[0119] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include but is not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program, and the program can be used by or in combination with an instruction execution system, device, or device.

[0120] For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the above-described ROM 602 and / or RAM 603 and / or one or more memories other than ROM 602 and RAM 603.

[0121] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a portion of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks may occur in a different order than noted in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and combinations of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0122] Those skilled in the art will appreciate that the features recited in the various embodiments and / or claims of the present disclosure may be combined and / or combined in various ways, even if such combinations or combinations are not explicitly recited in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features recited in the various embodiments and / or claims of the present disclosure may be combined and / or combined in various ways. All such combinations and / or combinations fall within the scope of the present disclosure.

[0123] The embodiments of the present disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments have been described separately above, this does not mean that the measures in the respective embodiments cannot be used advantageously in combination. The scope of the present disclosure is defined by the appended claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art can make various substitutions and modifications, and all such substitutions and modifications should fall within the scope of the present disclosure.

Claims

1. An inventory information processing method, comprising: Obtaining an update operation; In response to the update operation, updating the original inventory information of the target product stored in the first type of database to obtain the updated inventory information of the target product; and Based on the asynchronous update method of the timed task, transmitting the updated inventory information of the target product to the second type of database, so as to update the inventory information of the target product stored in the second type of database, wherein the first type of database is a relational database, and the second type of database is a memory database, and the second type of database is used to respond to the transaction operation when trading the target product; Subtracting the transaction quantity of the target product from the inventory quantity of the target product stored in the second type of database, wherein the transaction quantity is determined based on the transaction order, and the transaction order is generated in response to the transaction operation; Judging whether the transaction operation is successful; In the case of a successful transaction, transmitting the transaction quantity to the first type of database based on the multi-threaded processing method to update the current inventory quantity of the target product in the first type of database; In the case of a failed transaction, restoring the current inventory quantity of the target product in the second type of database to the inventory quantity before subtracting the transaction quantity, and not sending the information on the inventory change caused by placing an order to the first type of database.

2. The method according to claim 1, wherein, The method further comprises: Obtaining a transaction operation for trading the target product; In response to the transaction operation, generating a transaction order and determining the transaction quantity of the target product in the transaction order.

3. The method according to claim 1, wherein: The relational database stores the inventory information of the target product in the form of table fields, wherein the table fields at least include product identification information, inventory type and inventory quantity; The memory database stores the inventory information of the target product in the form of a hash table and / or an ordered set type, wherein the hash table at least includes product identification information, order identification information and inventory quantity, and the ordered set type at least includes product identification information, order identification information and the timestamp information of the order generation.

4. An inventory information processing system, comprising: A first obtaining module, configured to obtain an update operation; A first response module, configured to update the original inventory information of the target product stored in the first type of database in response to the update operation to obtain the updated inventory information of the target product; and A first transmission module, configured to transmit the updated inventory information of the target product to the second type of database based on the asynchronous update method of the timed task, so as to update the inventory information of the target product stored in the second type of database, wherein the second type of database is used to respond to the transaction operation when trading the target product; wherein the first type of database is a relational database, and the second type of database is a memory database; A first calculation module, configured to subtract the transaction quantity of the target product from the inventory quantity of the target product stored in the second type of database, where the transaction quantity is determined based on a transaction order, and the transaction order is generated in response to the transaction operation; A judgment module, configured to judge whether the transaction operation is successful after subtracting the transaction quantity from the inventory quantity of the target product stored in the second type of database; A second transmission module, configured to, when the transaction is successful, transmit the transaction quantity to the first type of database based on a multi-threaded processing method to update the current inventory quantity of the target product in the first type of database; A second calculation module, configured to, when the transaction fails, restore the current inventory quantity of the target product in the second type of database to the inventory quantity before subtracting the transaction quantity, and not send information about inventory changes caused by placing an order to the first type of database.

5. The system according to claim 4, wherein, the system further includes: A second acquisition module, configured to acquire a transaction operation for trading the target product; A second response module, configured to generate a transaction order in response to the transaction operation and determine the transaction quantity of the target product in the transaction order.

6. The system according to claim 4, wherein: The relational database stores the inventory information of the target product in the form of table fields, where the table fields at least include product identification information, inventory type, and inventory quantity; The in-memory database stores the inventory information of the target product in the form of a hash table and / or an ordered set type, where the hash table at least includes product identification information, order identification information, and inventory quantity, and the ordered set type at least includes product identification information, order identification information, and timestamp information of order generation.

7. A computer system, including: One or more processors; A memory, configured to store one or more programs, wherein, when the one or more programs are executed by the one or more processors, the one or more processors implement the inventory information processing method according to any one of claims 1 to 3.

8. A computer-readable storage medium, on which executable instructions are stored, and when the instructions are executed by a processor, the processor implements the inventory information processing method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Inventory operation method and system

    CN106599018A