python-redis
链接redis #!/usr/bin/python # -*- coding: UTF-8 -*- import redis HOST = "172.16.10.15" PORT = "6379" PSWD = "1234qwer" pool = redis.ConnectionPool(host=HOST, port=PORT,password=PSWD ,max_connections=1000) r = redis.Redis(connection_pool=pool) r.set("xiao","123") print(r.get('xiao'))
StrictRedis 链接方式:
#!/usr/bin/python # -*- coding: UTF-8 -*- import redis HOST = "172.16.10.15" PORT = "6379" PSWD = "1234qwer" pool = redis.ConnectionPool(host=HOST, port=PORT,password=PSWD ,max_connections=1000) r = redis.StrictRedis(connection_pool=pool) r.set("long",'60',"123") print(r.get('xiao'))