通过StackExchange.Redis中的键模式获取值 [英] Get values by key pattern in 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屋!