`
_M.del = function(self, id)
local database = self.database
local baseLibrary = self.baseLibrary
local policyLib = baseLibrary .. ':' .. id
local divdata = policyLib .. ':divdata'
local divtype = policyLib .. ':divtype'
--local keys, err = database:keys(policyLib..'*')
--if not keys then
-- error{ERRORINFO.REDIS_ERROR, err}
--end
database:init_pipeline()
--for _i, key in pairs(keys) do
-- database:del(key)
--end
database:del(divdata)
database:del(divtype)
local ok, err = database:commit_pipeline()
if not ok then error{ERRORINFO.REDIS_ERROR, err} end
abtesting/adapter/policy.lua 文件
_M.del 方法
local policyLib = baseLibrary .. ':' .. id local keys, err = database:keys(policyLib..'*')
当id=1 时,keys匹配到得是 ab:policies:1* ,实际上会删除 10、11、12、13.....等开头得方法
实际想删除的方法只有两个: "ab:policies:1:divdata" "ab:policies:1:divtype"
` _M.del = function(self, id) local database = self.database local baseLibrary = self.baseLibrary local policyLib = baseLibrary .. ':' .. id local divdata = policyLib .. ':divdata' local divtype = policyLib .. ':divtype'
end`