def rewrite_list(key):
# 使用LRANGE命令获取列表键包含的所有元素
item1,item2,...,itemN = LRANGE(key,0,-1)
# 使用RPUSH命令重写列表键
f.write_command(RPUSH,key,item1,item2,....,itemN)
def rewrite_hash(key):
field1,value1,field2,value2,...,fieldN,valueN = HGETALL(key)
f.write_command(HSET,key,field1,value1,field2,value2,...,fieldN,valueN)
def rewrite_set(key):
elem1,elem2,...,elemN = SMEMBERS(key)
f.write_command(SADD,key,elem1,elem2,...,elemN)
def rewrite_sorted_set(key):
member1,score1,member2,score2,...,memberN,scoreN = ZRANGE(key,0,-1,"WITHSCORES")
f.write_command(member1,score1,member2,score2,...,memberN,scoreN)
def rewrite_expire_time(key):
timestamp = get_expire_time_in_unixstamp(key)
f.write_command(pexpireat,key,timestamp)
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx