redis key模糊查找

https://blog.csdn.net/zhaipengfei1231/article/details/80819454?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-6.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-6.nonecase

https://blog.csdn.net/honer123/article/details/79698828?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1.nonecase

*:通配任意多个字符

?:通配单个字符

[]:通配括号内的某一个字符

returnstringRedisTemplate.keys("*"+ pattern + "*");

return stringRedisTemplate.keys("?" + pattern);

return stringRedisTemplate.keys("[" + pattern + "]");

 

127.0.0.1:6379> keys *ge
1) "vge"
2) "sge"
3) "zge"
4) "age"
127.0.0.1:6379> keys *e
1) "vge"
2) "sge"
3) "name"
4) "zge"
5) "age"
6) "namee"
7) "allSeedName"
127.0.0.1:6379> keys ?e
(empty list or set)
127.0.0.1:6379> keys ?ge
1) "vge"
2) "sge"
3) "zge"
4) "age"
127.0.0.1:6379> keys ???
1) "vge"
2) "sge"
3) "www"
4) "zge"
5) "age"

posted @ 2020-05-11 14:41  Caesar_the_great  阅读(7021)  评论(0编辑  收藏  举报