Giter Club home page Giter Club logo

Comments (4)

bootsrc avatar bootsrc commented on July 28, 2024

我的代码里并没有更新DB里的库存。 这个有待开发者自己去完成。
因为在redis里减库存,属于并发比较高的操作。

后面真正付款的人,去见库存,数量相对少,并发相对少。开发者可以自行去完成。😄

from jseckill.

afuchrisma avatar afuchrisma commented on July 28, 2024

嗯 支付成功扣减库存没有问题。
我意思是 未支付的订单记录什么时候入库 也是在支付的时候跟减库存一起操作了是吗。
还是说未支付的订单 只查询redis里面的数据。

from jseckill.

afuchrisma avatar afuchrisma commented on July 28, 2024

另外 还有30分钟未支付过期 没看到代码哪里有体现呢

    jedis.decr(inventoryKey);
    jedis.sadd(boughtKey, String.valueOf(userPhone));

from jseckill.

afuchrisma avatar afuchrisma commented on July 28, 2024

订单过期单独设置了1个key 设置过期时间
jedis.decr(inventoryKey);
jedis.sadd(boughtKey, String.valueOf(userPhone));
jedis.set(expiredKey, "","NX", "EX", 180);
然后加监听更新库存
图片

from jseckill.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.