python連線redis測試

hotdog04發表於2015-05-27

下載redis支援包:
https://pypi.python.org/pypi?%3Aaction=search&term=redis&submit=search

安裝:

下載解壓後,進入目錄:
cd redis-2.10.3
python setup.py install


測試:
[root@localhost 6379]# python
Python 2.6.6 (r266:84292, Nov 22 2013, 12:16:22)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import redis
>>> r = redis.StrictRedis(host='localhost', port=6379, db=0)
>>> r.set('foo', 'bar')
True
>>> r.get('foo')
'bar'
>>>

 

https://pypi.python.org/pypi?%3Aaction=search&term=redis&submit=search
https://pypi.python.org/pypi/redis/2.10.3

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20625855/viewspace-1673125/,如需轉載,請註明出處,否則將追究法律責任。

相關文章