2
Aerospike记录UDF是原子的吗?Aerospike记录UDF是原子性的吗?
function increment_and_expire(rec, incValue, expireThreshold, currentTime)
if aerospike:exists(rec) then
local timesUsed = rec['timesUsed']
if timesUsed == expireThreshold or rec['validUpto'] < currentTime then
rec['expired'] = true
else
rec['timesUsed'] = timesUsed + incValue
end
aerospike:update(rec)
return 1
else
warn("record doesn't exists")
return -1
end
end
上面的Lua函数增加了令牌的使用,如果它不再有效,它会将其标记为过期。 现在我的疑问是,如果并发请求来自同一条记录,并且此函数正在同时执行,是否会导致任何问题?