In my nodejs app, I'm using Redis keys as channel names. I want a client to subscribe a channel only if the corresponding key exists. The problem is between a EXISTS command and a SUBSCRIBE command, another client may remove an existing key. I can't use WATCH-MULTI-EXEC to make it atomic because I can't use SUBSCRIBE within a MULTI-EXEC block. I can't use Lua script either.
If there any way to maintain atomicity in this case?
It seems impossible with current version of Redis. I switched to a different approach that do not require atomic subscribe.