[root@njdyw site-packages]#python2.7.3
Python 2.7.3 (
default
, Mar 21 2013, 10:06:48)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type
"help"
,
"copyright"
,
"credits"
or
"license"
for
more information.
>>>import redis
>>>redisClient=redis.StrictRedis(host=
'127.0.0.1'
,port=6379,db=0)
>>> redisClient.set(
'test_redis'
,
'Hello Python'
)
True
>>> value=redisClient.get(
'test_redis'
)
>>>
print
value
Hello Python
>>> redisClient.
delete
(
'test_redis'
)
True
>>> value=redisClient.get(
'test_redis'
)
>>>
print
value
None
>>> dir(redis)
[
'AuthenticationError'
,
'Connection'
,
'ConnectionError'
,
'ConnectionPool'
,
'DataError'
,
'InvalidResponse'
,
'PubSubError'
,
'Redis'
,
'RedisError'
,
'ResponseError'
,
'StrictRedis'
,
'UnixDomainSocketConnection'
,
'VERSION'
,
'WatchError'
,
'__all__'
,
'__builtins__'
,
'__doc__'
,
'__file__'
,
'__loader__'
,
'__name__'
,
'__package__'
,
'__path__'
,
'__version__'
,
'_compat'
,
'client'
,
'connection'
,
'exceptions'
,
'from_url'
,
'utils'
]
>>> redisClient=redis.StrictRedis(host=
'127.0.0.1'
,port=6379,db=0)
>>> dir(redisClient)
[
'RESPONSE_CALLBACKS'
,
'__class__'
,
'__contains__'
,
'__delattr__'
,
'__delitem__'
,
'__dict__'
,
'__doc__'
,
'__format__'
,
'__getattribute__'
,
'__getitem__'
,
'__hash__'
,
'__init__'
,
'__module__'
,
'__new__'
,
'__reduce__'
,
'__reduce_ex__'
,
'__repr__'
,
'__setattr__'
,
'__setitem__'
,
'__sizeof__'
,
'__str__'
,
'__subclasshook__'
,
'__weakref__'
,
'_zaggregate'
,
'append'
,
'bgrewriteaof'
,
'bgsave'
,
'bitcount'
,
'bitop'
,
'blpop'
,
'brpop'
,
'brpoplpush'
,
'client_kill'
,
'client_list'
,
'config_get'
,
'config_set'
,
'connection_pool'
,
'dbsize'
,
'debug_object'
,
'decr'
,
'delete'
,
'echo'
,
'eval'
,
'evalsha'
,
'execute_command'
,
'exists'
,
'expire'
,
'expireat'
,
'flushall'
,
'flushdb'
,
'from_url'
,
'get'
,
'getbit'
,
'getrange'
,
'getset'
,
'hdel'
,
'hexists'
,
'hget'
,
'hgetall'
,
'hincrby'
,
'hincrbyfloat'
,
'hkeys'
,
'hlen'
,
'hmget'
,
'hmset'
,
'hset'
,
'hsetnx'
,
'hvals'
,
'incr'
,
'incrbyfloat'
,
'info'
,
'keys'
,
'lastsave'
,
'lindex'
,
'linsert'
,
'llen'
,
'lock'
,
'lpop'
,
'lpush'
,
'lpushx'
,
'lrange'
,
'lrem'
,
'lset'
,
'ltrim'
,
'mget'
,
'move'
,
'mset'
,
'msetnx'
,
'object'
,
'parse_response'
,
'persist'
,
'pexpire'
,
'pexpireat'
,
'ping'
,
'pipeline'
,
'pttl'
,
'publish'
,
'pubsub'
,
'randomkey'
,
'register_script'
,
'rename'
,
'renamenx'
,
'response_callbacks'
,
'rpop'
,
'rpoplpush'
,
'rpush'
,
'rpushx'
,
'sadd'
,
'save'
,
'scard'
,
'script_exists'
,
'script_flush'
,
'script_kill'
,
'script_load'
,
'sdiff'
,
'sdiffstore'
,
'set'
,
'set_response_callback'
,
'setbit'
,
'setex'
,
'setnx'
,
'setrange'
,
'shutdown'
,
'sinter'
,
'sinterstore'
,
'sismember'
,
'slaveof'
,
'smembers'
,
'smove'
,
'sort'
,
'spop'
,
'srandmember'
,
'srem'
,
'strlen'
,
'substr'
,
'sunion'
,
'sunionstore'
,
'time'
,
'transaction'
,
'ttl'
,
'type'
,
'unwatch'
,
'watch'
,
'zadd'
,
'zcard'
,
'zcount'
,
'zincrby'
,
'zinterstore'
,
'zrange'
,
'zrangebyscore'
,
'zrank'
,
'zrem'
,
'zremrangebyrank'
,
'zremrangebyscore'
,
'zrevrange'
,
'zrevrangebyscore'
,
'zrevrank'
,
'zscore'
,
'zunionstore'
]
>>>