| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
jopen
9年前发布

Redis 的 Python 客户端:credis

credis 是使用 cython 开发的 Redis 的 Python 客户端开发包。

示例代码:

>>> from credis import Connection  >>> conn = Connection(host='127.0.0.1', port=6379)  >>> conn.execute('set', 'test', 1)  'OK'  >>> conn.execute('get', 'test')  '1'

connection pool for gevent

>>> from credis.geventpool import ResourcePool  >>> pool = ResourcePool(32, Connection, host='127.0.0.1', port=6379)  >>> with pool.ctx() as conn:  ...     conn.execute('get', 'test')  '1'  >>> pool.execute('get', 'test')  '1'  >>> commands = [('get', 'test%d'%i) for i in range(3)]  >>> pool.execute_pipeline(*commands)  ('1', '2', '3')

execute pipelined commands

>>> commands = [('set', 'test%d'%i, i) for i in range(3)]  >>> conn.execute_pipeline(*commands)  ('OK', 'OK', 'OK')


项目主页:http://www.open-open.com/lib/view/home/1451271352558

 本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1451271352558.html
credis Redis NoSQL数据库