秒杀机制优化

image

lua脚本保证代码执行的原子性(两种操作同时执行)

image

 

redis执行lua脚本先用RedisScript.of ()快速把lua脚本实例化构造为对象,同时构造为常量方便复用

在用stringRedisTemplate.execute()执行lua脚本

image

 

image

 

为什么要异步执行操作

image

image

 

 

 

 

 

posted @ 2026-06-21 16:08  jokercheems  阅读(5)  评论(0)    收藏  举报