Home  >  Q&A  >  body text

mysql - 新手thinkphp商城设计问题

1、商城用户购买商品一旦生成订单就修改商城库存 这时候是直接修改数据库的数据还是先缓存商品的库存值 然后统一全局修改这个缓存值等到某一时间再写入数据库?
2、并发处理如何加锁

阿神阿神2732 days ago702

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2017-05-16 13:05:36

    When the amount of access is large, it is not good to perform frequent read and write operations on the database. It is recommended to use the cache layer and use the queue to update in batches at the same time.
    As for the locking issue (I don’t have any substantive suggestions), I generally adopt pessimistic locking. . .

    reply
    0
  • Cancelreply