lib/ohm/lua/delete.lua in ohm-2.0.0.alpha2 vs lib/ohm/lua/delete.lua in ohm-2.0.0.alpha3

- old
+ new

@@ -1,8 +1,8 @@ local model = cmsgpack.unpack(ARGV[1]) local uniques = cmsgpack.unpack(ARGV[2]) -local collections = cmsgpack.unpack(ARGV[3]) +local tracked = cmsgpack.unpack(ARGV[3]) local function remove_indices(model) local memo = model.key .. ":_indices" local existing = redis.call("SMEMBERS", memo) @@ -21,13 +21,13 @@ redis.call("HDEL", key, redis.call("HGET", memo, key)) redis.call("HDEL", memo, key) end end -local function remove_collections(model, collections) - for _, collection in ipairs(collections) do - local key = model.key .. ":" .. collection +local function remove_tracked(model, tracked) + for _, tracked_key in ipairs(tracked) do + local key = model.key .. ":" .. tracked_key redis.call("DEL", key) end end @@ -43,9 +43,9 @@ redis.call("DEL", unpack(keys)) end remove_indices(model) remove_uniques(model, uniques) -remove_collections(model, collections) +remove_tracked(model, tracked) delete(model) return model.id