Redis Stack Exchange如何按模式删除或获取密钥

编程入门 行业动态 更新时间:2024-10-24 06:35:59
本文介绍了Redis Stack Exchange如何按模式删除或获取密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在C#中安装了Stack Exchange redis客户端.我只能删除一个键或键数组,但不知道如何删除带前缀的键.或者另一种解决方案是先按模式获取所有密钥,然后将其删除.但是我也不知道如何通过模式来获取密钥.

I installed Stack Exchange redis client in C#. I can only delete one key or array of keys but I don't know how to delete keys with prefix. Or another solution can be first get all keys by pattern and then delete them. But I don't know how to get keys by pattern too.

推荐答案

删除操作是用键分开的,除非要刷新整个数据库.

Deletion is separate by key, unless you are flushing the entire database.

密钥扫描可在 IServer API上轻松获得,并在此处进行了更多讨论: stackexchange.github.io/StackExchange.Redis/KeysScan

Key scanning is readily available on the IServer API, and is discussed much more here: stackexchange.github.io/StackExchange.Redis/KeysScan

但是,通常仍应在生产中避免使用它-这不是Redis的预期用例.

However, it should still usually be avoided in production - that isn't the intended use-case for redis.

更多推荐

Redis Stack Exchange如何按模式删除或获取密钥

本文发布于:2023-11-17 08:16:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1609436.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:密钥   模式   Redis   Stack   Exchange

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!