开发者

Redis Sub/Pub - Get latest published content?

Using nodejs and redis sub/pub system. When I log into my web app I want to get the latest published content once I subscribe to it via nodejs. Is this possible? When I login I want the user to see the content from the channel they subscribed t开发者_如何学编程o. Right now when I login there is no data, but when I publish content to the channel it shows up, I refresh the page and the content does not show again.

EDIT

When the person logs into the system would I instead just load the results from the db via php then from there subscribe to the channel via nodejs and update the rows via redis sub/pub? Is that how it would work?


I think the best answer is anytime data is published to the channel to at the same time store that data in redis using the channel name as the key. Then when a user logs in it then grabs that data in redis, displays it then subscribe to the channel waiting for updated information. Do you agree or is there a better way?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜