This invention discloses an
inventory management method and
system for a cloud-synchronized Netman shopping
cart management system. The method creates a pre-occupancy
pool in a Redis in-memory
database, containing total inventory, available inventory,
cart-occupied inventory, and order-locked inventory. Atomic inventory pre-occupancy operations are implemented using Lua scripts. When a user adds an item to their
cart, the
system reads available inventory, queries existing occupancy records, calculates the additional occupancy quantity, atomically updates the inventory
pool fields, and writes the occupancy information. The
system uses a Workerman
timer to implement an automatic release mechanism after 1800 seconds, dynamically adjusting the
release time based on the inventory
occupancy rate. During checkout, the system uses Lua scripts to convert cart occupancy into order locks. This invention solves the performance
bottleneck problem of inventory
verification in high-
concurrency scenarios, avoids overselling and inventory inconsistencies, reduces
response time to milliseconds compared to traditional solutions, increases
concurrency processing capacity by five times, and improves inventory utilization by 30%.