lua和redis之电商库存的处理
代码先来看lua核销的代码
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889local userId = ARGV[1]local type = tostring(ARGV[2])local invalid = {}-- 循环所有的活动判断库存for kIndex = 1, #KEYS do repeat local kName = KEYS[kIndex] -- 不存在则忽略此key,并记录 if (redis.call('exists', kName) == 0) then invalid[kName] = true break end ...