#!/usr/bin/python import redis r = redis.Redis(host='127.0.0.1',password='123',port=6379,db=1) #print r.get('SGP1234_form_id_oi0yf4t2OCDtxGTJHYLjHIR-d_iw') for k in r.keys('*SGP1234_form_id*'): if r.ttl(k) == -1: print k #r.delete(k)
删除没有过期时间的key
#!/usr/bin/python import redis r = redis.Redis(host='127.0.0.1',password='123',port=6379,db=1) #print r.get('SGP1234_form_id_oi0yf4t2OCDtxGTJHYLjHIR-d_iw') for k in r.keys('*SGP1234_form_id*'): if r.ttl(k) == -1: print k #r.delete(k)
删除没有过期时间的key