Redis键功能可匹配多种模式 [英] Redis keys function for match with multiple pattern

查看:123
本文介绍了Redis键功能可匹配多种模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何找到具有多个匹配模式的键,例如我的键具有

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

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

我如何找到具有Redis键功能的键以与foo:*或poi:*模式匹配,就像

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:*

推荐答案

您不应这样做. KEYS主要是调试命令.不应将其用于其他任何用途.

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

Redis不是支持临时查询的数据库:您应该为放入Redis的数据提供访问路径(使用额外的set或hash或zset索引).

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).

如果您确实需要在键上运行任意布尔表达式以选择数据,我建议通过使用 rdb-redis-tools 包.

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.

这篇关于Redis键功能可匹配多种模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆