问题
Why does Redis, a datastore, have Pub/Sub features? My first thought is that it's the wrong layer to implement such a thing. But maybe I need to think outside the box.
回答1:
Redis is defined as data structure server. Redis provides multiple functionality like memcache, queue, pubsub etc. This is very useful for a cloudapp/webstack where 3 components RabbitMQ(queuing) + XMPP(pubsub) + Memcache can be currently replaced with redis. Queuing is not as feature rich as RabbitMQ though.
回答2:
That would be true if it was about feeds for end users to subscribe to. Actually it's closer to the concept of events or database triggers - a process that knows the internals of the datastore keeps a connection open and does something when a change happens.
来源:https://stackoverflow.com/questions/4938520/why-does-redis-have-pub-sub-capabilities