local function remove (key, lock_id) if is_locked_by_another_owner(key, lock_id) then return { "locked_by_other" } end local existing_entry = get_existing_entry(key) if not existing_entry then return { "not_found" } end local existing_additional_keys = existing_entry.additional_lock_keys if is_any_locked_by_another_owner(existing_additional_keys, lock_id) then return { "locked_by_other" } end remove_entry(key) return { "ok", existing_entry.value } end return scriptResult(remove(KEYS[1], ARGV[3]))