import redis # 简单连接 r = redis.Redis() print(r.get("name"))r.set("age",9000) # 基于连接池 pool = redis.ConnectionPool() r = redis.Redis(connection_pool=pool) r.set('foo', 'bar') print(r.get('foo'))
import redis # 简单连接 r = redis.Redis() print(r.get("name"))r.set("age",9000) # 基于连接池 pool = redis.ConnectionPool() r = redis.Redis(connection_pool=pool) r.set('foo', 'bar') print(r.get('foo'))