Redis keys function for match with multiple pattern

瘦欲@ 提交于 2020-08-09 13:35:33

问题


How i can find keys with multiple match pattern, for example i've keys with

foo:*, event:*, poi:* and article:* patterns.

how i find keys with redis keys function for match with foo:* or poi:* pattern, its like

find all keys with preffix foo:* or poi:*

回答1:


You should not do this. KEYS is mainly a debug command. It is not supposed to be used for anything else.

Redis is not a database supporting ad-hoc queries: you are supposed to provide access paths for the data you put into Redis (using extra set or hash or zset indexes).

If you really need to run arbitrary boolean expressions on keys to select data, I would suggest to do it offline by using the rdb-redis-tools package.



来源:https://stackoverflow.com/questions/20949147/redis-keys-function-for-match-with-multiple-pattern

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!