Home >php教程 >php手册 >Python 操作 Redis

Python 操作 Redis

WBOY
WBOYOriginal
2016-06-06 20:00:351255browse

安装 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

请关注

Python 操作 Redis


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:c# 自定义模板Next article:php三种分页