通过 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
、FLUSHDB
等在哪里? 提供了有关如何访问它的完整详细信息,以及为什么它不是't 在 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屋!