예제 #1
0
    def run(self):
        redis = RedisUtils().get_connection()
        for i in range(1, 100):
            print("publish mychannel1 %s " % "mychannel1_" + str(i))
            redis.publish("mychannel1", "mychannel1_" + str(i))

            print("publish mychannel2 %s " % "mychannel2_" + str(i))
            redis.publish("mychannel2", "mychannel2_" + str(i))

            time.sleep(2)
        RedisUtils().release_connection(redis)
예제 #2
0
def pub():
    redis = RedisUtils().get_connection()
    redis.publish("mychannel1", "mychannel1_" + str(datetime.now()))
    redis.publish("mychannel2", "mychannel2_" + str(datetime.now()))
    RedisUtils().release_connection(redis)