標籤:http io os 使用 ar for sp div art
想知道redis針對各種程式設計語言推薦的介面API實現,請參考http://redis.io/clients/
選擇python語言,則使用https://github.com/andymccurdy/redis-py
Installation
redis-py requires a running Redis server. See Redis‘s quickstart(http://redis.io/topics/quickstart) for installation instructions.
To install redis-py, simply:
$ sudo pip install redis
or alternatively (you really should be using pip though):
$ sudo easy_install redis
or from source:
$ sudo python setup.py install
Getting Started
>>> import redis>>> r = redis.StrictRedis(host=‘localhost‘, port=6379, db=0)>>> r.set(‘foo‘, ‘bar‘)True>>> r.get(‘foo‘)‘bar‘
API Reference
The official Redis command documentation does a great job of explaining each command in detail. redis-py exposes two client classes that implement these commands. The StrictRedis class attempts to adhere to the official command syntax. There are a few exceptions:
redis client API