Python 操作 Redis
程序员文章站
2022-04-18 23:20:22
...
安装 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
请关注
下一篇: PHP常用开发函数解析之数组篇[未完结]