首页 > 代码库 > Python-Redis

Python-Redis

pip install redis

#!/usr/bin/env python
#coding=utf8
import redis

r = redis.Redis(host='<ip>', port=<port>, db=<dbname>)

r.set('kin','kin')

r.get('kin')

r.dbsize()

r.delete('kin')

r.dbsize()

r.save()

r.flushdb()

Reference:

https://github.com/andymccurdy/redis-py

Python-Redis