安装 pip install redis 实例 import redis r = redis.StrictRedis(host='localhost', port=6379, db=0[, password='foo']) # 连接池 pool = redis.ConnectionPool(host='localhost', port=6379, db=0, password='foo') r = redis.Redis(connection_pool=poo
pip install redis
import redis
r = redis.StrictRedis(host='localhost', port=6379, db=0[, password='foo'])
# 连接池
pool = redis.ConnectionPool(host='localhost', port=6379, db=0, password='foo')
r = redis.Redis(connection_pool=pool)
r.set('foo', 'bar')
r.get('foo')
来源:https://pypi.python.org/pypi/redis