PLEASE add another type of pubsub list to use as an ignore/blacklist so a client can subscribe to a channel pattern like news:* but can also filter/ignore other channels like news:boring or news:bad, etc.
SUBSCRIBE news:*
FEATURE REQUEST:
SUBIGNORE news:bad SUBIGNORE news:boring
I understand the * pattern could be slow so for performance it could be a hash fast lookup and instead just check the last X characters of the channel name and if the client's ignorelist matches, just have Redis skip publishing to that client:
SUBIGNORE ":123456"
Now anything with the last X chars of ":123456" in the channel name would be ignored for that specific client. No pattern matching and should be very quick.
This could also be used as a server id/time/whatever (just a simple string) to identify and know which client/server sent the payload and would prevent echoing to not receive the published payload it just sent and would save alot of bandwidth/cpu usage.
This might be pretty specific but MY use case:
I'm using a nodejs client and a remote Redis server that subscribes to pattern "news:*" Let's assume 123456 was the name/server id/whatever that was already declared on the nodejs server as it's own unique ID.
SUBSCRIBE news:foo:* SUBIGNORE *:123456
When publishing a payload, it sends the payload as expected, but also gets echoed and triggers the publish event, but if there was the ignore list feature, the Redis server would never send it in the first place so no echo, no extra bandwidth, cpu usage, etc.
PUBLISH news:foo:123456 data
My current work around involves a few extra steps, and working as is but if this feature was included it would be great.
My work around is to generate a unique ID and store the payload instead of publishing it, and then compare what server the message is from (check for 123456) :
SET news:foo:msgid data EX 60 PUBLISH "news:foo:123456" msgid -- instead of data
then the nodejs server simply checks the last characters in the channel name and just ignore the event if it is its own (123456), otherwise process the message as normal as it's from another server/nodejs instance.
GET news:foo:msgid -- for completeness
I think I [over?] explained this pretty well, but if not I'm happy to clarify as much as needed as I really think this feature would be very useful (especially in my own use case) and I would try to add this myself but I don't know C/C++ or Redis internals :-/
I think this is similar to @MasahikoSawada PR from 2015: https://github.com/antirez/redis/pull/2394/commits