23

redis 分布式锁的 5个坑,真是又大又深-程序员内点事

 4 years ago
source link: https://blog.51cto.com/14787961/2489251
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
引言最近项目上线的频率颇高,连着几天加班熬夜,身体有点吃不消精神也有些萎靡,无奈业务方催的紧,工期就在眼前只能硬着头皮上了。脑子浑浑噩噩的时候,写的就不能叫代码,可以直接叫做Bug。我就熬夜写了一个bug被骂惨了。由于是做商城业务,要频繁的对商品库存进行扣减,应用是集群部署,为避免并发造成库存超买超卖等问题,采用redis分布式锁加以控制。本以为给扣库存的代码加上锁lock.tryLock就万事大

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK