def get_members(channel_id): key = id2channel_mem_key(channel_id) return list(r_db.smembers(key))
def bcast_msg(channel_id, msg): '''把这个消息广播到参与这个channel中的所有member里面''' key = id2channel_mem_key(channel_id) for nickname in r_db.smembers(key): mem_key = nickname2mem_key(nickname) r_db.lpush(mem_key, msg)