9951 explained code solutions for 126 technologies


python-redisDelete keys in Redis by pattern


r = redis.Redis()
keys = r.keys('ke*')
r.delete(*keys)ctrl + c
redis.Redis

connect to Redis server

r.keys

get all keys from Redis that match specified pattern

r.delete(*keys)

delete all specified keys (thus, all keys from Redis)

'ke*'

pattern to obtain all keys starting with ke