#-*- coding: utf8 -*-

import redis

pool = redis.ConnectionPool()

r = redis.Redis(connection_pool=pool)

# 支持事务
pipe = r.pipeline(transaction=True)
pipe.multi()
pipe.set("user", "egon")
pipe.set("role", "sb")

pipe.execute()