shell 匹配删除指定前缀的keyredis
#! /bin/bash rediscom="/redis/src/redis-cli -a auth -h redis.host -n 0"; `$rediscom keys LM*`|xargs `$rediscom del `
shell 匹配修改key的有效期shell
#! /bin/bash rediscom=""; scannum=0; endnum=1; expire=86400; while [ $scannum -ne $endnum ] do endnum=1; arr=(`$rediscom scan $scannum` ); scannum=${arr[0]}; for key in ${arr[@]:1} do echo `${rediscom} expire ${key} $expire`; done; done;
redis 的逐出策略收到maxmemory的限制,超过这个数有一些key就会被逐出内存释放空间bash