import redis   # 导入redis模块，通过python操作redis 也可以直接在redis主机的服务端操作缓存数据库

r = redis.Redis(host='localhost', port=6379, db=0)   # host是redis主机，需要redis服务端和客户端都启动 redis默认端口是6379
# r.set('tasklist', 'junxi')  # key是"foo" value是"bar" 将键值对存入redis缓存
# print(r['tasklist'])
# print(r.get('tasklist'))  # 取出键name对应的值
# print(type(r.get('tasklist')))
# print(r.keys())
print(r.dbsize())

# 字典
# r.hset('dict', 'url3', 'wwww123')
# print(r.hgetall('dict'))

# 列表
r.lpush('list', "{url:123555}")
r.lpush('list', "{url:1235554}")
print(r.lrange('list', 0, -1))
607ca90d292373cdb7ba13f1ae508f4d01b38490
<mask token>

<mask token>
print(r.dbsize())
r.lpush('list', '{url:123555}')
r.lpush('list', '{url:1235554}')
print(r.lrange('list', 0, -1))

<mask token>
r = redis.Redis(host='localhost', port=6379, db=0)
print(r.dbsize())
r.lpush('list', '{url:123555}')
r.lpush('list', '{url:1235554}')
print(r.lrange('list', 0, -1))

import redis
r = redis.Redis(host='localhost', port=6379, db=0)
print(r.dbsize())
r.lpush('list', '{url:123555}')
r.lpush('list', '{url:1235554}')
print(r.lrange('list', 0, -1))

import redis   # 导入redis模块，通过python操作redis 也可以直接在redis主机的服务端操作缓存数据库

r = redis.Redis(host='localhost', port=6379, db=0)   # host是redis主机，需要redis服务端和客户端都启动 redis默认端口是6379
# r.set('tasklist', 'junxi')  # key是"foo" value是"bar" 将键值对存入redis缓存
# print(r['tasklist'])
# print(r.get('tasklist'))  # 取出键name对应的值
# print(type(r.get('tasklist')))
# print(r.keys())
print(r.dbsize())

# 字典
# r.hset('dict', 'url3', 'wwww123')
# print(r.hgetall('dict'))

# 列表
r.lpush('list', "{url:123555}")
r.lpush('list', "{url:1235554}")
print(r.lrange('list', 0, -1))