If anyone has time for feedback, I could use a second set of eyes on this:
Instead of having the "A2B" and "B2A" lookups point to a single record under another index, I decided it would be lighter to just duplicate the payload in each lookup, as the value is tiny (a comma-separated string of two numbers; the first is at-most 1 character, the second number is at-most 5 characters).
# this deletes them by id_a
eval "local ids_b = redis.call('hkeys', 'a2b|' .. ARGV[1])\nfor i, id_b in ipairs(ids_b) do\n redis.call('hdel', 'b2a|' .. id_b, ARGV[1])\n end\n redis.call('del', 'a2b|' .. ARGV[1]) \nreturn 1" 0 10
# this deletes them by id_b
eval "local ids_a = redis.call('hkeys', 'b2a|' .. ARGV[1])\nfor i, id_a in ipairs(ids_a) do\n redis.call('hdel', 'a2b|' .. ids_a, ARGV[1])\n end\n redis.call('del', 'b2a|' .. ARGV[1]) \nreturn 1" 0 10
does this look decent/performant? does anyone have suggestions to maximize making things faster?
my primary concern is "what happens if the hkeys are too long?".