通过StackExchange.Redis中的键模式获取值 [英] Get values by key pattern in StackExchange.Redis

查看:644
本文介绍了通过StackExchange.Redis中的键模式获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用模式来通过 Stackexchange.Redis 检索与模式匹配的所有键。

I'm trying to use a pattern to retrieve all keys matching a pattern by Stackexchange.Redis.

代码

KEYS *o*


推荐答案

在项目首页上已链接 KEYS SCAN code>, FLUSHDB 等?,其中提供了有关如何访问它的完整详细信息,以及为什么它不在 IDatabase上。我应该指出,您应该避免在生产服务器上使用 KEYS 。如果可用,该库将自动尝试使用 SCAN -危害程度较小,但仍应谨慎对待。最好将相关的密钥显式存储在集合或哈希中。

On the project homepage is linked Where are KEYS, SCAN, FLUSHDB etc? which gives full details on how to access this, and why it isn't on IDatabase. I should point out that you should avoid KEYS on a production server. The library will automatically try to use SCAN instead if it is available - which is less harmful but should still be treated with some caution. It would be preferable to explicitly store related keys in a set or hash.

这篇关于通过StackExchange.Redis中的键模式获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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